Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Moving EditorPropertyArray's and EditorPropertyDictionary's right_container to be the last child, so that pressing Tab focuses elements in the expected order.

bluebirdsan9c0648760e3f
diff --git a/editor/inspector/editor_properties_array_dict.cpp b/editor/inspector/editor_properties_array_dict.cpp
index bb31ce365ae..217bcfb5ed4 100644
--- a/editor/inspector/editor_properties_array_dict.cpp
+++ b/editor/inspector/editor_properties_array_dict.cpp
@@ -567,6 +567,10 @@ void EditorPropertyArray::update_property() {
new_prop->add_inline_control(slot.remove_button, INLINE_CONTROL_RIGHT);
}
+ // Move the right container to be the last child, so that focusing on the next Control behaves in the expected order.
+ Control *right_cont = new_prop->get_inline_container(INLINE_CONTROL_RIGHT);
+ right_cont->get_parent()->move_child(right_cont, new_prop->get_child_count() - 1);
+
slot.prop->add_sibling(new_prop, false);
slot.prop->queue_free();
slot.prop = new_prop;
@@ -1488,6 +1492,10 @@ void EditorPropertyDictionary::update_property() {
new_prop->add_inline_control(slot.prop_key, INLINE_CONTROL_LEFT);
}
+ // Move the right container to be the last child, so that focusing on the next Control behaves in the expected order.
+ Control *right_cont = new_prop->get_inline_container(INLINE_CONTROL_RIGHT);
+ right_cont->get_parent()->move_child(right_cont, new_prop->get_child_count() - 1);
+
slot.set_prop(new_prop);
} else if (slot.index != EditorPropertyDictionaryObject::NEW_KEY_INDEX && slot.index != EditorPropertyDictionaryObject::NEW_VALUE_INDEX) {