diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-04-13 22:47:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-13 22:47:54 +0200 |
commit | 970debed93fd172776914b9482e2c110e01a1ac1 (patch) | |
tree | 0ef1e35464549a6932b6cb7f65376cbc81a7148d /modules | |
parent | 8ada85ef1d7ddfa30871f002812efaec65f4a170 (diff) | |
parent | 66009318e0827f01a584aca14c6e9ec0079354d3 (diff) |
Merge pull request #60177 from reduz/animation-library-import
Import scenes as AnimationLibrary
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gltf/editor/editor_scene_importer_blend.cpp | 14 | ||||
-rw-r--r-- | modules/gltf/editor/editor_scene_importer_blend.h | 4 | ||||
-rw-r--r-- | modules/gltf/editor/editor_scene_importer_fbx.cpp | 7 | ||||
-rw-r--r-- | modules/gltf/editor/editor_scene_importer_fbx.h | 4 | ||||
-rw-r--r-- | modules/gltf/editor/editor_scene_importer_gltf.cpp | 5 | ||||
-rw-r--r-- | modules/gltf/editor/editor_scene_importer_gltf.h | 2 | ||||
-rw-r--r-- | modules/gltf/register_types.cpp | 6 |
7 files changed, 14 insertions, 28 deletions
diff --git a/modules/gltf/editor/editor_scene_importer_blend.cpp b/modules/gltf/editor/editor_scene_importer_blend.cpp index ae05c1b68d..173d5131cf 100644 --- a/modules/gltf/editor/editor_scene_importer_blend.cpp +++ b/modules/gltf/editor/editor_scene_importer_blend.cpp @@ -238,13 +238,12 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_ return gltf->generate_scene(state, p_bake_fps); } -Ref<Animation> EditorSceneFormatImporterBlend::import_animation(const String &p_path, uint32_t p_flags, - const Map<StringName, Variant> &p_options, int p_bake_fps) { - return Ref<Animation>(); -} - -Variant EditorSceneFormatImporterBlend::get_option_visibility(const String &p_path, const String &p_option, +Variant EditorSceneFormatImporterBlend::get_option_visibility(const String &p_path, bool p_for_animation, const String &p_option, const Map<StringName, Variant> &p_options) { + if (p_path.get_extension().to_lower() != "blend") { + return true; + } + if (p_option.begins_with("animation/")) { if (p_option != "animation/import" && !bool(p_options["animation/import"])) { return false; @@ -254,6 +253,9 @@ Variant EditorSceneFormatImporterBlend::get_option_visibility(const String &p_pa } void EditorSceneFormatImporterBlend::get_import_options(const String &p_path, List<ResourceImporter::ImportOption> *r_options) { + if (p_path.get_extension().to_lower() != "blend") { + return; + } #define ADD_OPTION_BOOL(PATH, VALUE) \ r_options->push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, SNAME(PATH)), VALUE)); #define ADD_OPTION_ENUM(PATH, ENUM_HINT, VALUE) \ diff --git a/modules/gltf/editor/editor_scene_importer_blend.h b/modules/gltf/editor/editor_scene_importer_blend.h index 9a1b5f5803..0925333a28 100644 --- a/modules/gltf/editor/editor_scene_importer_blend.h +++ b/modules/gltf/editor/editor_scene_importer_blend.h @@ -68,11 +68,9 @@ public: virtual Node *import_scene(const String &p_path, uint32_t p_flags, const Map<StringName, Variant> &p_options, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr) override; - virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, - const Map<StringName, Variant> &p_options, int p_bake_fps) override; virtual void get_import_options(const String &p_path, List<ResourceImporter::ImportOption> *r_options) override; - virtual Variant get_option_visibility(const String &p_path, const String &p_option, + virtual Variant get_option_visibility(const String &p_path, bool p_for_animation, const String &p_option, const Map<StringName, Variant> &p_options) override; }; diff --git a/modules/gltf/editor/editor_scene_importer_fbx.cpp b/modules/gltf/editor/editor_scene_importer_fbx.cpp index 24564f55be..893d2efcec 100644 --- a/modules/gltf/editor/editor_scene_importer_fbx.cpp +++ b/modules/gltf/editor/editor_scene_importer_fbx.cpp @@ -105,12 +105,7 @@ Node *EditorSceneFormatImporterFBX::import_scene(const String &p_path, uint32_t return gltf->generate_scene(state, p_bake_fps); } -Ref<Animation> EditorSceneFormatImporterFBX::import_animation(const String &p_path, - uint32_t p_flags, const Map<StringName, Variant> &p_options, int p_bake_fps) { - return Ref<Animation>(); -} - -Variant EditorSceneFormatImporterFBX::get_option_visibility(const String &p_path, +Variant EditorSceneFormatImporterFBX::get_option_visibility(const String &p_path, bool p_for_animation, const String &p_option, const Map<StringName, Variant> &p_options) { return true; } diff --git a/modules/gltf/editor/editor_scene_importer_fbx.h b/modules/gltf/editor/editor_scene_importer_fbx.h index bb69cfaa30..84de7fd1cc 100644 --- a/modules/gltf/editor/editor_scene_importer_fbx.h +++ b/modules/gltf/editor/editor_scene_importer_fbx.h @@ -47,11 +47,9 @@ public: virtual Node *import_scene(const String &p_path, uint32_t p_flags, const Map<StringName, Variant> &p_options, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr) override; - virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, - const Map<StringName, Variant> &p_options, int p_bake_fps) override; virtual void get_import_options(const String &p_path, List<ResourceImporter::ImportOption> *r_options) override; - virtual Variant get_option_visibility(const String &p_path, const String &p_option, + virtual Variant get_option_visibility(const String &p_path, bool p_for_animation, const String &p_option, const Map<StringName, Variant> &p_options) override; }; diff --git a/modules/gltf/editor/editor_scene_importer_gltf.cpp b/modules/gltf/editor/editor_scene_importer_gltf.cpp index 1d6a82e58a..5e7811ad2b 100644 --- a/modules/gltf/editor/editor_scene_importer_gltf.cpp +++ b/modules/gltf/editor/editor_scene_importer_gltf.cpp @@ -64,9 +64,4 @@ Node *EditorSceneFormatImporterGLTF::import_scene(const String &p_path, uint32_t return doc->generate_scene(state, p_bake_fps); } -Ref<Animation> EditorSceneFormatImporterGLTF::import_animation(const String &p_path, - uint32_t p_flags, const Map<StringName, Variant> &p_options, int p_bake_fps) { - return Ref<Animation>(); -} - #endif // TOOLS_ENABLED diff --git a/modules/gltf/editor/editor_scene_importer_gltf.h b/modules/gltf/editor/editor_scene_importer_gltf.h index 1f62ca9537..b714ada124 100644 --- a/modules/gltf/editor/editor_scene_importer_gltf.h +++ b/modules/gltf/editor/editor_scene_importer_gltf.h @@ -47,8 +47,6 @@ public: virtual Node *import_scene(const String &p_path, uint32_t p_flags, const Map<StringName, Variant> &p_options, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr) override; - virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, - const Map<StringName, Variant> &p_options, int p_bake_fps) override; }; #endif // TOOLS_ENABLED diff --git a/modules/gltf/register_types.cpp b/modules/gltf/register_types.cpp index e09c76f052..b656788a10 100644 --- a/modules/gltf/register_types.cpp +++ b/modules/gltf/register_types.cpp @@ -60,7 +60,7 @@ static void _editor_init() { Ref<EditorSceneFormatImporterGLTF> import_gltf; import_gltf.instantiate(); - ResourceImporterScene::get_singleton()->add_importer(import_gltf); + ResourceImporterScene::add_importer(import_gltf); // Blend to glTF importer. @@ -72,7 +72,7 @@ static void _editor_init() { if (blend_enabled) { Ref<EditorSceneFormatImporterBlend> importer; importer.instantiate(); - ResourceImporterScene::get_singleton()->add_importer(importer); + ResourceImporterScene::add_importer(importer); Ref<EditorFileSystemImportFormatSupportQueryBlend> blend_import_query; blend_import_query.instantiate(); @@ -95,7 +95,7 @@ static void _editor_init() { } else { Ref<EditorSceneFormatImporterFBX> importer; importer.instantiate(); - ResourceImporterScene::get_singleton()->add_importer(importer); + ResourceImporterScene::add_importer(importer); } } } |