diff options
author | Hilderin <81109165+Hilderin@users.noreply.github.com> | 2024-07-07 22:38:06 -0400 |
---|---|---|
committer | Hilderin <81109165+Hilderin@users.noreply.github.com> | 2024-07-09 09:33:39 -0400 |
commit | 169e7325184351f4d7d7fd5092c8f8342a121b99 (patch) | |
tree | 8fc262d761d039441e13e36daf788426454d3161 /editor/import_dock.cpp | |
parent | 42e5b3ac2da07d2105c775977b39e6949c723ded (diff) | |
download | redot-engine-169e7325184351f4d7d7fd5092c8f8342a121b99.tar.gz |
Fix missing options in Project Import Defaults
Diffstat (limited to 'editor/import_dock.cpp')
-rw-r--r-- | editor/import_dock.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
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<Variant> v; - d.get_key_list(&v); + Dictionary import_settings = GLOBAL_GET(setting_name); + List<Variant> 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; |