Merge pull request #46394 from YeldhamDev/import_defaults_fix
Fix import selector resetting in Import Defaults Editor
This commit is contained in:
commit
757c151219
@ -75,6 +75,7 @@ void ImportDefaultsEditor::_reset() {
|
|||||||
settings->notify_property_list_changed();
|
settings->notify_property_list_changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportDefaultsEditor::_save() {
|
void ImportDefaultsEditor::_save() {
|
||||||
if (settings->importer.is_valid()) {
|
if (settings->importer.is_valid()) {
|
||||||
Dictionary modified;
|
Dictionary modified;
|
||||||
@ -140,12 +141,22 @@ void ImportDefaultsEditor::_update_importer() {
|
|||||||
|
|
||||||
inspector->edit(settings);
|
inspector->edit(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportDefaultsEditor::_importer_selected(int p_index) {
|
void ImportDefaultsEditor::_importer_selected(int p_index) {
|
||||||
_update_importer();
|
_update_importer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportDefaultsEditor::clear() {
|
void ImportDefaultsEditor::clear() {
|
||||||
|
String last_selected;
|
||||||
|
if (importers->get_selected() > 0) {
|
||||||
|
last_selected = importers->get_item_text(importers->get_selected());
|
||||||
|
}
|
||||||
|
|
||||||
importers->clear();
|
importers->clear();
|
||||||
|
|
||||||
importers->add_item("<" + TTR("Select Importer") + ">");
|
importers->add_item("<" + TTR("Select Importer") + ">");
|
||||||
|
importers->set_item_disabled(0, true);
|
||||||
|
|
||||||
List<Ref<ResourceImporter>> importer_list;
|
List<Ref<ResourceImporter>> importer_list;
|
||||||
ResourceFormatImporter::get_singleton()->get_importers(&importer_list);
|
ResourceFormatImporter::get_singleton()->get_importers(&importer_list);
|
||||||
Vector<String> names;
|
Vector<String> names;
|
||||||
@ -157,11 +168,17 @@ void ImportDefaultsEditor::clear() {
|
|||||||
|
|
||||||
for (int i = 0; i < names.size(); i++) {
|
for (int i = 0; i < names.size(); i++) {
|
||||||
importers->add_item(names[i]);
|
importers->add_item(names[i]);
|
||||||
|
|
||||||
|
if (names[i] == last_selected) {
|
||||||
|
importers->select(i + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportDefaultsEditor::_bind_methods() {
|
void ImportDefaultsEditor::_bind_methods() {
|
||||||
ADD_SIGNAL(MethodInfo("project_settings_changed"));
|
ADD_SIGNAL(MethodInfo("project_settings_changed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportDefaultsEditor::ImportDefaultsEditor() {
|
ImportDefaultsEditor::ImportDefaultsEditor() {
|
||||||
HBoxContainer *hb = memnew(HBoxContainer);
|
HBoxContainer *hb = memnew(HBoxContainer);
|
||||||
hb->add_child(memnew(Label(TTR("Importer:"))));
|
hb->add_child(memnew(Label(TTR("Importer:"))));
|
||||||
|
Loading…
Reference in New Issue
Block a user