|
@@ -278,18 +278,20 @@ void ItemListEditor::_add_pressed() {
|
|
|
|
|
|
void ItemListEditor::_delete_pressed() {
|
|
|
|
|
|
- TreeItem *ti = tree->get_selected();
|
|
|
-
|
|
|
- if (!ti)
|
|
|
+ if (selected_idx == -1)
|
|
|
return;
|
|
|
|
|
|
- if (ti->get_parent() != tree->get_root())
|
|
|
+ String current_selected = (String)property_editor->get_selected_path();
|
|
|
+
|
|
|
+ if (current_selected == "")
|
|
|
return;
|
|
|
|
|
|
- int idx = ti->get_text(0).to_int();
|
|
|
+ // FIXME: Currently relying on selecting a *property* to derive what item to delete
|
|
|
+ // e.g. you select "1/enabled" to delete item 1.
|
|
|
+ // This should be fixed so that you can delete by selecting the item section header,
|
|
|
+ // or a delete button on that header.
|
|
|
|
|
|
- if (selected_idx == -1)
|
|
|
- return;
|
|
|
+ int idx = current_selected.get_slice("/", 0).to_int();
|
|
|
|
|
|
item_plugins[selected_idx]->erase(idx);
|
|
|
}
|
|
@@ -382,13 +384,9 @@ ItemListEditor::ItemListEditor() {
|
|
|
hbc->add_child(del_button);
|
|
|
del_button->connect("pressed", this, "_delete_button");
|
|
|
|
|
|
- property_editor = memnew(PropertyEditor);
|
|
|
- property_editor->hide_top_label();
|
|
|
- property_editor->set_subsection_selectable(true);
|
|
|
+ property_editor = memnew(EditorInspector);
|
|
|
vbc->add_child(property_editor);
|
|
|
property_editor->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
-
|
|
|
- tree = property_editor->get_property_tree();
|
|
|
}
|
|
|
|
|
|
ItemListEditor::~ItemListEditor() {
|