Skip to content

Commit

Permalink
Undoing an Anchor Preset on a Control will correctly restore its posi…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
TheSofox committed Mar 29, 2024
1 parent 29b3d9e commit 785b8a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3747,7 +3747,11 @@ void EditorInspector::_edit_set(const String &p_name, const Variant &p_value, bo
bool valid = false;
Variant value = object->get(p_name, &valid);
if (valid) {
undo_redo->add_undo_property(object, p_name, value);
if (Object::cast_to<Control>(object) && (p_name == "anchors_preset" || p_name == "layout_mode")) {
undo_redo->add_undo_method(object, "_edit_set_state", Object::cast_to<Control>(object)->_edit_get_state());
} else {
undo_redo->add_undo_property(object, p_name, value);
}
}

List<StringName> linked_properties;
Expand Down

0 comments on commit 785b8a6

Please sign in to comment.