@@ -305,35 +305,38 @@ void EditorPropertyArray::_create_new_property_slot() {
305305 int idx = slots.size ();
306306 HBoxContainer *hbox = memnew (HBoxContainer);
307307
308+ EditorProperty *prop = memnew (EditorPropertyNil);
309+
308310 Button *reorder_button = memnew (Button);
309311 reorder_button->set_accessibility_name (TTRC (" Reorder" ));
310312 reorder_button->set_button_icon (get_editor_theme_icon (SNAME (" TripleBar" )));
311313 reorder_button->set_default_cursor_shape (Control::CURSOR_MOVE);
312314 reorder_button->set_disabled (is_read_only ());
315+ reorder_button->set_theme_type_variation (SceneStringName (FlatButton));
313316 reorder_button->connect (SceneStringName (gui_input), callable_mp (this , &EditorPropertyArray::_reorder_button_gui_input));
314317 reorder_button->connect (SNAME (" button_up" ), callable_mp (this , &EditorPropertyArray::_reorder_button_up));
315318 reorder_button->connect (SNAME (" button_down" ), callable_mp (this , &EditorPropertyArray::_reorder_button_down).bind (idx));
316319
317- hbox->add_child (reorder_button);
318- EditorProperty *prop = memnew (EditorPropertyNil);
319320 hbox->add_child (prop);
320321
321322 bool is_untyped_array = object->get_array ().get_type () == Variant::ARRAY && subtype == Variant::NIL;
322323
324+ Button *edit_btn = nullptr ;
325+ Button *remove_btn = nullptr ;
323326 if (is_untyped_array) {
324- Button * edit_btn = memnew (Button);
327+ edit_btn = memnew (Button);
325328 edit_btn->set_accessibility_name (TTRC (" Edit" ));
326329 edit_btn->set_button_icon (get_editor_theme_icon (SNAME (" Edit" )));
327330 edit_btn->set_disabled (is_read_only ());
331+ edit_btn->set_theme_type_variation (SceneStringName (FlatButton));
328332 edit_btn->connect (SceneStringName (pressed), callable_mp (this , &EditorPropertyArray::_change_type).bind (edit_btn, idx));
329- hbox->add_child (edit_btn);
330333 } else {
331- Button * remove_btn = memnew (Button);
334+ remove_btn = memnew (Button);
332335 remove_btn->set_accessibility_name (TTRC (" Remove" ));
333336 remove_btn->set_button_icon (get_editor_theme_icon (SNAME (" Remove" )));
334337 remove_btn->set_disabled (is_read_only ());
338+ remove_btn->set_theme_type_variation (SceneStringName (FlatButton));
335339 remove_btn->connect (SceneStringName (pressed), callable_mp (this , &EditorPropertyArray::_remove_pressed).bind (idx));
336- hbox->add_child (remove_btn);
337340 }
338341 property_vbox->add_child (hbox);
339342
@@ -342,6 +345,8 @@ void EditorPropertyArray::_create_new_property_slot() {
342345 slot.object = object;
343346 slot.container = hbox;
344347 slot.reorder_button = reorder_button;
348+ slot.edit_button = edit_btn;
349+ slot.remove_button = remove_btn;
345350 slot.set_index (idx + page_index * page_length);
346351 slots.push_back (slot);
347352}
@@ -513,6 +518,17 @@ void EditorPropertyArray::update_property() {
513518 new_prop->connect (SNAME (" object_id_selected" ), callable_mp (this , &EditorPropertyArray::_object_id_selected));
514519 new_prop->set_h_size_flags (SIZE_EXPAND_FILL);
515520 new_prop->set_read_only (is_read_only ());
521+
522+ if (slot.reorder_button ) {
523+ new_prop->add_inline_control (slot.reorder_button , INLINE_CONTROL_LEFT);
524+ slot.reorder_button ->get_parent ()->move_child (slot.reorder_button , 0 );
525+ }
526+ if (slot.edit_button ) {
527+ new_prop->add_inline_control (slot.edit_button , INLINE_CONTROL_RIGHT);
528+ } else if (slot.remove_button ) {
529+ new_prop->add_inline_control (slot.remove_button , INLINE_CONTROL_RIGHT);
530+ }
531+
516532 slot.prop ->add_sibling (new_prop, false );
517533 slot.prop ->queue_free ();
518534 slot.prop = new_prop;
@@ -1047,33 +1063,34 @@ void EditorPropertyDictionary::_create_new_property_slot(int p_idx) {
10471063 EditorProperty *prop_key = nullptr ;
10481064 if (p_idx != EditorPropertyDictionaryObject::NEW_KEY_INDEX && p_idx != EditorPropertyDictionaryObject::NEW_VALUE_INDEX) {
10491065 prop_key = memnew (EditorPropertyNil);
1050- hbox->add_child (prop_key);
10511066 }
10521067
10531068 EditorProperty *prop = memnew (EditorPropertyNil);
10541069 prop->set_h_size_flags (SIZE_EXPAND_FILL);
1055- if (p_idx != EditorPropertyDictionaryObject::NEW_KEY_INDEX && p_idx != EditorPropertyDictionaryObject::NEW_VALUE_INDEX) {
1056- prop->set_draw_label (false );
1057- }
10581070 hbox->add_child (prop);
1071+ if (prop_key) {
1072+ prop->add_inline_control (prop_key, INLINE_CONTROL_LEFT);
1073+ }
10591074
10601075 bool use_key = p_idx == EditorPropertyDictionaryObject::NEW_KEY_INDEX;
10611076 bool is_untyped_dict = (use_key ? key_subtype : value_subtype) == Variant::NIL;
10621077
1078+ Button *edit_btn = nullptr ;
1079+ Button *remove_btn = nullptr ;
10631080 if (is_untyped_dict) {
1064- Button * edit_btn = memnew (Button);
1081+ edit_btn = memnew (Button);
10651082 edit_btn->set_accessibility_name (TTRC (" Edit" ));
10661083 edit_btn->set_button_icon (get_editor_theme_icon (SNAME (" Edit" )));
10671084 edit_btn->set_disabled (is_read_only ());
1085+ edit_btn->set_theme_type_variation (SceneStringName (FlatButton));
10681086 edit_btn->connect (SceneStringName (pressed), callable_mp (this , &EditorPropertyDictionary::_change_type).bind (edit_btn, slots.size ()));
1069- hbox->add_child (edit_btn);
10701087 } else if (p_idx >= 0 ) {
1071- Button * remove_btn = memnew (Button);
1088+ remove_btn = memnew (Button);
10721089 remove_btn->set_accessibility_name (TTRC (" Remove" ));
10731090 remove_btn->set_button_icon (get_editor_theme_icon (SNAME (" Remove" )));
10741091 remove_btn->set_disabled (is_read_only ());
1092+ remove_btn->set_theme_type_variation (SceneStringName (FlatButton));
10751093 remove_btn->connect (SceneStringName (pressed), callable_mp (this , &EditorPropertyDictionary::_remove_pressed).bind (slots.size ()));
1076- hbox->add_child (remove_btn);
10771094 }
10781095
10791096 if (add_panel) {
@@ -1087,6 +1104,8 @@ void EditorPropertyDictionary::_create_new_property_slot(int p_idx) {
10871104 slot.prop_key = prop_key;
10881105 slot.object = object;
10891106 slot.container = hbox;
1107+ slot.edit_button = edit_btn;
1108+ slot.remove_button = remove_btn;
10901109 int index = p_idx + (p_idx >= 0 ? page_index * page_length : 0 );
10911110 slot.set_index (index);
10921111 slots.push_back (slot);
@@ -1360,6 +1379,9 @@ void EditorPropertyDictionary::update_property() {
13601379 dict_prop->set_preview_value (true );
13611380 }
13621381 slot.set_key_prop (new_prop);
1382+ if (slot.prop ) {
1383+ slot.prop ->add_inline_control (new_prop, INLINE_CONTROL_LEFT);
1384+ }
13631385 }
13641386 }
13651387
@@ -1395,10 +1417,22 @@ void EditorPropertyDictionary::update_property() {
13951417 new_prop->connect (SNAME (" object_id_selected" ), callable_mp (this , &EditorPropertyDictionary::_object_id_selected));
13961418 new_prop->set_h_size_flags (SIZE_EXPAND_FILL);
13971419 if (slot.index != EditorPropertyDictionaryObject::NEW_KEY_INDEX && slot.index != EditorPropertyDictionaryObject::NEW_VALUE_INDEX) {
1398- new_prop->set_draw_label (false );
1420+ new_prop->set_label (" " );
1421+ new_prop->set_label_overlayed (true );
13991422 }
14001423 new_prop->set_read_only (is_read_only ());
1424+ if (slot.remove_button ) {
1425+ new_prop->add_inline_control (slot.remove_button , INLINE_CONTROL_RIGHT);
1426+ }
1427+ if (slot.edit_button ) {
1428+ new_prop->add_inline_control (slot.edit_button , INLINE_CONTROL_RIGHT);
1429+ }
1430+ if (slot.prop_key ) {
1431+ new_prop->add_inline_control (slot.prop_key , INLINE_CONTROL_LEFT);
1432+ }
1433+
14011434 slot.set_prop (new_prop);
1435+
14021436 } else if (slot.index != EditorPropertyDictionaryObject::NEW_KEY_INDEX && slot.index != EditorPropertyDictionaryObject::NEW_VALUE_INDEX) {
14031437 Variant key = dict.get_key_at_index (slot.index );
14041438 String cs = key.get_construct_string ();
0 commit comments