diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-07 13:49:00 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-07 13:49:00 +0200 |
commit | 4eb614568d833b69fddd97f17cecfb40e87bb18c (patch) | |
tree | 6a3712b11d88ba0d2c28a7c61583dce5e42592ef | |
parent | 82e77eab35d1cfbcc5fd78782244f73f574b8b95 (diff) | |
parent | c7cb65f15990ce6545a0c22ed9fe101f15dff3c8 (diff) | |
download | redot-engine-4eb614568d833b69fddd97f17cecfb40e87bb18c.tar.gz |
Merge pull request #91641 from TokageItLab/silhouette-visibility
Make silhouette fixer option visibility dependent on availability
-rw-r--r-- | editor/import/3d/post_import_plugin_skeleton_rest_fixer.cpp | 15 | ||||
-rw-r--r-- | editor/import/3d/post_import_plugin_skeleton_rest_fixer.h | 1 |
2 files changed, 15 insertions, 1 deletions
diff --git a/editor/import/3d/post_import_plugin_skeleton_rest_fixer.cpp b/editor/import/3d/post_import_plugin_skeleton_rest_fixer.cpp index 44016292b1..99e535f023 100644 --- a/editor/import/3d/post_import_plugin_skeleton_rest_fixer.cpp +++ b/editor/import/3d/post_import_plugin_skeleton_rest_fixer.cpp @@ -43,7 +43,7 @@ void PostImportPluginSkeletonRestFixer::get_internal_import_options(InternalImpo r_options->push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "retarget/rest_fixer/normalize_position_tracks"), true)); r_options->push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "retarget/rest_fixer/overwrite_axis"), true)); r_options->push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "retarget/rest_fixer/reset_all_bone_poses_after_import"), true)); - r_options->push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "retarget/rest_fixer/fix_silhouette/enable"), false)); + r_options->push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "retarget/rest_fixer/fix_silhouette/enable", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false)); // TODO: PostImportPlugin need to be implemented such as validate_option(PropertyInfo &property, const Dictionary &p_options). // get_internal_option_visibility() is not sufficient because it can only retrieve options implemented in the core and can only read option values. // r_options->push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::ARRAY, "retarget/rest_fixer/filter", PROPERTY_HINT_ARRAY_TYPE, vformat("%s/%s:%s", Variant::STRING_NAME, PROPERTY_HINT_ENUM, "Hips,Spine,Chest")), Array())); @@ -53,6 +53,19 @@ void PostImportPluginSkeletonRestFixer::get_internal_import_options(InternalImpo } } +Variant PostImportPluginSkeletonRestFixer::get_internal_option_visibility(InternalImportCategory p_category, bool p_for_animation, const String &p_option, const HashMap<StringName, Variant> &p_options) const { + if (p_category == INTERNAL_IMPORT_CATEGORY_SKELETON_3D_NODE) { + if (p_option.begins_with("retarget/rest_fixer/fix_silhouette/")) { + if (!bool(p_options["retarget/rest_fixer/fix_silhouette/enable"])) { + if (!p_option.ends_with("enable")) { + return false; + } + } + } + } + return true; +} + void PostImportPluginSkeletonRestFixer::internal_process(InternalImportCategory p_category, Node *p_base_scene, Node *p_node, Ref<Resource> p_resource, const Dictionary &p_options) { if (p_category == INTERNAL_IMPORT_CATEGORY_SKELETON_3D_NODE) { // Prepare objects. diff --git a/editor/import/3d/post_import_plugin_skeleton_rest_fixer.h b/editor/import/3d/post_import_plugin_skeleton_rest_fixer.h index c765169fd0..1750ed1233 100644 --- a/editor/import/3d/post_import_plugin_skeleton_rest_fixer.h +++ b/editor/import/3d/post_import_plugin_skeleton_rest_fixer.h @@ -38,6 +38,7 @@ class PostImportPluginSkeletonRestFixer : public EditorScenePostImportPlugin { public: virtual void get_internal_import_options(InternalImportCategory p_category, List<ResourceImporter::ImportOption> *r_options) override; + virtual Variant get_internal_option_visibility(InternalImportCategory p_category, bool p_for_animation, const String &p_option, const HashMap<StringName, Variant> &p_options) const override; virtual void internal_process(InternalImportCategory p_category, Node *p_base_scene, Node *p_node, Ref<Resource> p_resource, const Dictionary &p_options) override; PostImportPluginSkeletonRestFixer(); |