From 169e7325184351f4d7d7fd5092c8f8342a121b99 Mon Sep 17 00:00:00 2001 From: Hilderin <81109165+Hilderin@users.noreply.github.com> Date: Sun, 7 Jul 2024 22:38:06 -0400 Subject: Fix missing options in Project Import Defaults --- editor/import_dock.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'editor/import_dock.cpp') diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 846456ea55..a8f8e9ef11 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -431,31 +431,39 @@ void ImportDock::_importer_selected(int i_idx) { void ImportDock::_preset_selected(int p_idx) { int item_id = preset->get_popup()->get_item_id(p_idx); + String setting_name = "importer_defaults/" + params->importer->get_importer_name(); switch (item_id) { case ITEM_SET_AS_DEFAULT: { - Dictionary d; + Dictionary import_settings; + // When import settings already exist, we will update these settings + // to ensure that the dictionary retains settings that are not displayed in the + // editor. For Scene, the dictionary is the same for FBX, GLTF, and Blender, but each + // file type has some different settings. + if (ProjectSettings::get_singleton()->has_setting(setting_name)) { + import_settings = GLOBAL_GET(setting_name); + } for (const PropertyInfo &E : params->properties) { - d[E.name] = params->values[E.name]; + import_settings[E.name] = params->values[E.name]; } - ProjectSettings::get_singleton()->set("importer_defaults/" + params->importer->get_importer_name(), d); + ProjectSettings::get_singleton()->set(setting_name, import_settings); ProjectSettings::get_singleton()->save(); _update_preset_menu(); } break; case ITEM_LOAD_DEFAULT: { - ERR_FAIL_COND(!ProjectSettings::get_singleton()->has_setting("importer_defaults/" + params->importer->get_importer_name())); + ERR_FAIL_COND(!ProjectSettings::get_singleton()->has_setting(setting_name)); - Dictionary d = GLOBAL_GET("importer_defaults/" + params->importer->get_importer_name()); - List v; - d.get_key_list(&v); + Dictionary import_settings = GLOBAL_GET(setting_name); + List keys; + import_settings.get_key_list(&keys); if (params->checking) { params->checked.clear(); } - for (const Variant &E : v) { - params->values[E] = d[E]; + for (const Variant &E : keys) { + params->values[E] = import_settings[E]; if (params->checking) { params->checked.insert(E); } @@ -463,7 +471,7 @@ void ImportDock::_preset_selected(int p_idx) { params->update(); } break; case ITEM_CLEAR_DEFAULT: { - ProjectSettings::get_singleton()->set("importer_defaults/" + params->importer->get_importer_name(), Variant()); + ProjectSettings::get_singleton()->set(setting_name, Variant()); ProjectSettings::get_singleton()->save(); _update_preset_menu(); } break; -- cgit v1.2.3