diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-02-24 22:53:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-24 22:53:44 +0100 |
commit | 757c151219cccc197cb5ff80dbbdf3e4a9b46e0d (patch) | |
tree | 386b721e0ed59918bebb46c06ab3d16100e5b89a /editor | |
parent | a1b5d8fbfe097bf66428f5e6dad206b2fdb90eb1 (diff) | |
parent | 881d1984cf9ecd6057b3aeb3600b6fa2e3236491 (diff) |
Merge pull request #46394 from YeldhamDev/import_defaults_fix
Fix import selector resetting in Import Defaults Editor
Diffstat (limited to 'editor')
-rw-r--r-- | editor/import_defaults_editor.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/editor/import_defaults_editor.cpp b/editor/import_defaults_editor.cpp index ad08411403..28c595614f 100644 --- a/editor/import_defaults_editor.cpp +++ b/editor/import_defaults_editor.cpp @@ -75,6 +75,7 @@ void ImportDefaultsEditor::_reset() { settings->notify_property_list_changed(); } } + void ImportDefaultsEditor::_save() { if (settings->importer.is_valid()) { Dictionary modified; @@ -140,12 +141,22 @@ void ImportDefaultsEditor::_update_importer() { inspector->edit(settings); } + void ImportDefaultsEditor::_importer_selected(int p_index) { _update_importer(); } + void ImportDefaultsEditor::clear() { + String last_selected; + if (importers->get_selected() > 0) { + last_selected = importers->get_item_text(importers->get_selected()); + } + importers->clear(); + importers->add_item("<" + TTR("Select Importer") + ">"); + importers->set_item_disabled(0, true); + List<Ref<ResourceImporter>> importer_list; ResourceFormatImporter::get_singleton()->get_importers(&importer_list); Vector<String> names; @@ -157,11 +168,17 @@ void ImportDefaultsEditor::clear() { for (int i = 0; i < names.size(); i++) { importers->add_item(names[i]); + + if (names[i] == last_selected) { + importers->select(i + 1); + } } } + void ImportDefaultsEditor::_bind_methods() { ADD_SIGNAL(MethodInfo("project_settings_changed")); } + ImportDefaultsEditor::ImportDefaultsEditor() { HBoxContainer *hb = memnew(HBoxContainer); hb->add_child(memnew(Label(TTR("Importer:")))); |