Only store _edit_use_anchors_
metadata if value is not the default
The default value is assumed to be `false`, so this metadata only needs to be stored if the value is `true`.
This commit is contained in:
parent
747d11b5b9
commit
3b25190494
1 changed files with 11 additions and 3 deletions
|
@ -4529,9 +4529,13 @@ void CanvasItemEditor::_set_anchors_and_margins_to_keep_ratio() {
|
||||||
undo_redo->add_do_method(control, "set_anchor", MARGIN_BOTTOM, bottom_right_anchor.y, false, true);
|
undo_redo->add_do_method(control, "set_anchor", MARGIN_BOTTOM, bottom_right_anchor.y, false, true);
|
||||||
undo_redo->add_do_method(control, "set_meta", "_edit_use_anchors_", true);
|
undo_redo->add_do_method(control, "set_meta", "_edit_use_anchors_", true);
|
||||||
|
|
||||||
bool use_anchors = control->has_meta("_edit_use_anchors_") && control->get_meta("_edit_use_anchors_");
|
const bool use_anchors = control->has_meta("_edit_use_anchors_") && control->get_meta("_edit_use_anchors_");
|
||||||
undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state());
|
undo_redo->add_undo_method(control, "_edit_set_state", control->_edit_get_state());
|
||||||
undo_redo->add_undo_method(control, "set_meta", "_edit_use_anchors_", use_anchors);
|
if (use_anchors) {
|
||||||
|
undo_redo->add_undo_method(control, "set_meta", "_edit_use_anchors_", true);
|
||||||
|
} else {
|
||||||
|
undo_redo->add_undo_method(control, "remove_meta", "_edit_use_anchors_");
|
||||||
|
}
|
||||||
|
|
||||||
anchors_mode = true;
|
anchors_mode = true;
|
||||||
anchor_mode_button->set_pressed(anchors_mode);
|
anchor_mode_button->set_pressed(anchors_mode);
|
||||||
|
@ -4803,7 +4807,11 @@ void CanvasItemEditor::_button_toggle_anchor_mode(bool p_status) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
control->set_meta("_edit_use_anchors_", p_status);
|
if (p_status) {
|
||||||
|
control->set_meta("_edit_use_anchors_", true);
|
||||||
|
} else {
|
||||||
|
control->remove_meta("_edit_use_anchors_");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors_mode = p_status;
|
anchors_mode = p_status;
|
||||||
|
|
Loading…
Reference in a new issue