diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index a9c43e573f6..8f6db09c636 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -1972,7 +1972,7 @@ void ResourceImporterScene::_optimize_track_usage(AnimationPlayer *p_player, Ani } } -Node *ResourceImporterScene::pre_import(const String &p_source_file) { +Node *ResourceImporterScene::pre_import(const String &p_source_file, const HashMap &p_options) { Ref importer; String ext = p_source_file.get_extension().to_lower(); @@ -1997,8 +1997,13 @@ Node *ResourceImporterScene::pre_import(const String &p_source_file) { ERR_FAIL_COND_V(!importer.is_valid(), nullptr); + int bake_fps = 30; + if (p_options.has(SNAME("animation/fps"))) { + bake_fps = p_options[SNAME("animation/fps")]; + } + Error err = OK; - Node *scene = importer->import_scene(p_source_file, EditorSceneFormatImporter::IMPORT_ANIMATION | EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS, HashMap(), 15, nullptr, &err); + Node *scene = importer->import_scene(p_source_file, EditorSceneFormatImporter::IMPORT_ANIMATION | EditorSceneFormatImporter::IMPORT_GENERATE_TANGENT_ARRAYS, p_options, bake_fps, nullptr, &err); if (!scene || err != OK) { return nullptr; } diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h index c143e86bd4c..b77c1dccb47 100644 --- a/editor/import/resource_importer_scene.h +++ b/editor/import/resource_importer_scene.h @@ -281,7 +281,7 @@ public: void _optimize_animations(AnimationPlayer *anim, float p_max_lin_error, float p_max_ang_error, float p_max_angle); void _compress_animations(AnimationPlayer *anim, int p_page_size_kb); - Node *pre_import(const String &p_source_file); + Node *pre_import(const String &p_source_file, const HashMap &p_options); virtual Error import(const String &p_source_file, const String &p_save_path, const HashMap &p_options, List *r_platform_variants, List *r_gen_files = nullptr, Variant *r_metadata = nullptr) override; virtual bool has_advanced_options() const override; diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp index af145c22b40..8f6463140bf 100644 --- a/editor/import/scene_import_settings.cpp +++ b/editor/import/scene_import_settings.cpp @@ -538,12 +538,6 @@ void SceneImportSettings::open_settings(const String &p_path, bool p_for_animati scene_import_settings_data->settings = nullptr; scene_import_settings_data->path = p_path; - scene = ResourceImporterScene::get_scene_singleton()->pre_import(p_path); // Use the scene singleton here because we want to see the full thing. - if (scene == nullptr) { - EditorNode::get_singleton()->show_warning(TTR("Error opening scene")); - return; - } - // Visibility data_mode->set_tab_hidden(1, p_for_animation); data_mode->set_tab_hidden(2, p_for_animation); @@ -589,6 +583,12 @@ void SceneImportSettings::open_settings(const String &p_path, bool p_for_animati } } + scene = ResourceImporterScene::get_scene_singleton()->pre_import(p_path, defaults); // Use the scene singleton here because we want to see the full thing. + if (scene == nullptr) { + EditorNode::get_singleton()->show_warning(TTR("Error opening scene")); + return; + } + first_aabb = true; _update_scene();