summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-15 14:41:27 +0100
committerGitHub <noreply@github.com>2022-02-15 14:41:27 +0100
commit1d910b1e5868814938d644ff181cf30d75516762 (patch)
treef7ce3ad10de612969150ae0775d1c66ccf3b247d /editor
parent6d708dfd6a1b94dae44ea89b1bc7d9374650eca8 (diff)
parent7ca843b655906604284588724fceae376a5ace1a (diff)
Merge pull request #57863 from Calinou/editor-use-anchors-metadata-no-redundant
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/control_editor_plugin.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp
index c1264395e0..8d2ba1bbaf 100644
--- a/editor/plugins/control_editor_plugin.cpp
+++ b/editor/plugins/control_editor_plugin.cpp
@@ -504,9 +504,13 @@ void ControlEditorToolbar::_set_anchors_and_offsets_to_keep_ratio() {
undo_redo->add_do_method(control, "set_anchor", SIDE_BOTTOM, bottom_right_anchor.y, false, 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, "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;
anchor_mode_button->set_pressed(anchors_mode);
@@ -596,7 +600,11 @@ void ControlEditorToolbar::_button_toggle_anchor_mode(bool p_status) {
continue;
}
- E->set_meta("_edit_use_anchors_", p_status);
+ if (p_status) {
+ E->set_meta("_edit_use_anchors_", true);
+ } else {
+ E->remove_meta("_edit_use_anchors_");
+ }
}
anchors_mode = p_status;