Repository: godotengine/godot
File: editor/inspector/editor_properties_array_dict.cpp (C++)

Code before:

	Button *reorder_button = memnew(Button);
	reorder_button->set_accessibility_name(TTRC("Reorder"));
	reorder_button->set_button_icon(get_editor_theme_icon(SNAME("TripleBar")));
	reorder_button->set_default_cursor_shape(Control::CURSOR_MOVE);
	reorder_button->set_disabled(is_read_only());
	reorder_button->set_flat(true);
	reorder_button->connect(SceneStringName(gui_input), callable_mp(this, &EditorPropertyArray::_reorder_button_gui_input));
	reorder_button->connect(SNAME("button_up"), callable_mp(this, &EditorPropertyArray::_reorder_button_up));
	reorder_button->connect(SNAME("button_down"), callable_mp(this, &EditorPropertyArray::_reorder_button_down).bind(idx));

	prop->add_inline_control(reorder_button, LEFT);
	hbox->add_child(prop);

	bool is_untyped_array = object->get_array().get_type() == Variant::ARRAY && subtype == Variant::NIL;

	Button *edit_btn = nullptr;
	Button *remove_btn = nullptr;
	if (is_untyped_array) {
		edit_btn = memnew(Button);
		edit_btn->set_accessibility_name(TTRC("Edit"));
		edit_btn->set_button_icon(get_editor_theme_icon(SNAME("Edit")));
		edit_btn->set_disabled(is_read_only());
		edit_btn->set_flat(true);
		edit_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyArray::_change_type).bind(edit_btn, idx));
		prop->add_inline_control(edit_btn, CENTER);
	} else {
		remove_btn = memnew(Button);
		remove_btn->set_accessibility_name(TTRC("Remove"));
		remove_btn->set_button_icon(get_editor_theme_icon(SNAME("Remove")));
		remove_btn->set_disabled(is_read_only());
		remove_btn->set_flat(true);
		remove_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyArray::_remove_pressed).bind(idx));
		prop->add_inline_control(remove_btn, RIGHT);
	}
	property_vbox->add_child(hbox);

	Slot slot;
	slot.prop = prop;
	slot.object = object;
	slot.container = hbox;
	slot.reorder_button = reorder_button;
	slot.edit_button = edit_btn;
	slot.remove_button = remove_btn;
	slot.set_index(idx + page_index * page_length);
	slots.push_back(slot);
}

void EditorPropertyArray::set_preview_value(bool p_preview_value) {
	preview_value = p_preview_value;
}

Review comment (bug):
Something is weird here. I checked the structure with EditorDebugger and the center container is unused:

<img width="421" height="139" alt="Image" src="https://github.com/user-attachments/assets/66c6aac1-6869-470f-ad10-2dd62804bfd1" />

The property looks like this:

<img width="391" height="58" alt="Image" src="https://github.com/user-attachments/assets/e71d9d97-86e1-4e4e-8923-b0dccad64a02" />

The Edit button is on the right; I assume that's how it's supposed to look. What is the center container for?

Code after:

	Button *reorder_button = memnew(Button);
	reorder_button->set_accessibility_name(TTRC("Reorder"));
	reorder_button->set_button_icon(get_editor_theme_icon(SNAME("TripleBar")));
	reorder_button->set_default_cursor_shape(Control::CURSOR_MOVE);
	reorder_button->set_disabled(is_read_only());
	reorder_button->set_theme_type_variation(SceneStringName(FlatButton));
	reorder_button->connect(SceneStringName(gui_input), callable_mp(this, &EditorPropertyArray::_reorder_button_gui_input));
	reorder_button->connect(SNAME("button_up"), callable_mp(this, &EditorPropertyArray::_reorder_button_up));
	reorder_button->connect(SNAME("button_down"), callable_mp(this, &EditorPropertyArray::_reorder_button_down).bind(idx));

	hbox->add_child(prop);

	bool is_untyped_array = object->get_array().get_type() == Variant::ARRAY && subtype == Variant::NIL;

	Button *edit_btn = nullptr;
	Button *remove_btn = nullptr;
	if (is_untyped_array) {
		edit_btn = memnew(Button);
		edit_btn->set_accessibility_name(TTRC("Edit"));
		edit_btn->set_button_icon(get_editor_theme_icon(SNAME("Edit")));
		edit_btn->set_disabled(is_read_only());
		edit_btn->set_theme_type_variation(SceneStringName(FlatButton));
		edit_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyArray::_change_type).bind(edit_btn, idx));
	} else {
		remove_btn = memnew(Button);
		remove_btn->set_accessibility_name(TTRC("Remove"));
		remove_btn->set_button_icon(get_editor_theme_icon(SNAME("Remove")));
		remove_btn->set_disabled(is_read_only());
		remove_btn->set_theme_type_variation(SceneStringName(FlatButton));
		remove_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyArray::_remove_pressed).bind(idx));
	}
	property_vbox->add_child(hbox);

	Slot slot;
	slot.prop = prop;
	slot.object = object;
	slot.container = hbox;
	slot.reorder_button = reorder_button;
	slot.edit_button = edit_btn;
	slot.remove_button = remove_btn;
	slot.set_index(idx + page_index * page_length);
	slots.push_back(slot);
}

void EditorPropertyArray::set_preview_value(bool p_preview_value) {
	preview_value = p_preview_value;
}

void EditorPropertyArray::update_property() {
	Variant array = get_edited_property_value();