diff options
author | Silc Renew <tokage.it.lab@gmail.com> | 2022-07-26 18:48:08 +0900 |
---|---|---|
committer | Silc Renew <tokage.it.lab@gmail.com> | 2022-07-26 18:48:08 +0900 |
commit | dde235ad82c7c1ea54ef764056ee5bd3a28a94ab (patch) | |
tree | 79c1412ac57a2d8fda3730281c1249b40e6888d1 /editor/plugins | |
parent | 6d57e209e91b8f564ed79b2cad6165dcd9edf196 (diff) |
add position track normalization & post process key value for retarget
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/bone_map_editor_plugin.cpp | 17 | ||||
-rw-r--r-- | editor/plugins/skeleton_3d_editor_plugin.cpp | 4 |
2 files changed, 15 insertions, 6 deletions
diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp index 967a95be9d..9a00bb93b8 100644 --- a/editor/plugins/bone_map_editor_plugin.cpp +++ b/editor/plugins/bone_map_editor_plugin.cpp @@ -33,6 +33,7 @@ #include "editor/editor_scale.h" #include "editor/import/post_import_plugin_skeleton_renamer.h" #include "editor/import/post_import_plugin_skeleton_rest_fixer.h" +#include "editor/import/post_import_plugin_skeleton_track_organizer.h" #include "editor/import/scene_import_settings.h" void BoneMapperButton::fetch_textures() { @@ -379,11 +380,15 @@ void BoneMapEditor::create_editors() { } void BoneMapEditor::fetch_objects() { + skeleton = nullptr; // Hackey... but it may be the easist way to get a selected object from "ImporterScene". SceneImportSettings *si = SceneImportSettings::get_singleton(); if (!si) { return; } + if (!si->is_visible()) { + return; + } Node *selected = si->get_selected_node(); if (selected) { Skeleton3D *sk = Object::cast_to<Skeleton3D>(selected); @@ -404,11 +409,11 @@ void BoneMapEditor::_notification(int p_what) { create_editors(); } break; case NOTIFICATION_EXIT_TREE: { - if (!bone_mapper) { - return; + if (bone_mapper) { + remove_child(bone_mapper); + bone_mapper->queue_delete(); } - remove_child(bone_mapper); - bone_mapper->queue_delete(); + skeleton = nullptr; } break; } } @@ -444,6 +449,10 @@ BoneMapEditorPlugin::BoneMapEditorPlugin() { inspector_plugin.instantiate(); add_inspector_plugin(inspector_plugin); + Ref<PostImportPluginSkeletonTrackOrganizer> post_import_plugin_track_organizer; + post_import_plugin_track_organizer.instantiate(); + add_scene_post_import_plugin(post_import_plugin_track_organizer); + Ref<PostImportPluginSkeletonRenamer> post_import_plugin_renamer; post_import_plugin_renamer.instantiate(); add_scene_post_import_plugin(post_import_plugin_renamer); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 93e44c8ca0..5d6c56d5f0 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -157,7 +157,7 @@ void BoneTransformEditor::_property_keyed(const String &p_path, bool p_advance) if (split.size() == 3 && split[0] == "bones") { int bone_idx = split[1].to_int(); if (split[2] == "position") { - te->insert_transform_key(skeleton, skeleton->get_bone_name(bone_idx), Animation::TYPE_POSITION_3D, skeleton->get(p_path)); + te->insert_transform_key(skeleton, skeleton->get_bone_name(bone_idx), Animation::TYPE_POSITION_3D, (Vector3)skeleton->get(p_path) / skeleton->get_motion_scale()); } if (split[2] == "rotation") { te->insert_transform_key(skeleton, skeleton->get_bone_name(bone_idx), Animation::TYPE_ROTATION_3D, skeleton->get(p_path)); @@ -319,7 +319,7 @@ void Skeleton3DEditor::insert_keys(const bool p_all_bones) { } if (pos_enabled && (p_all_bones || te->has_track(skeleton, name, Animation::TYPE_POSITION_3D))) { - te->insert_transform_key(skeleton, name, Animation::TYPE_POSITION_3D, skeleton->get_bone_pose_position(i)); + te->insert_transform_key(skeleton, name, Animation::TYPE_POSITION_3D, skeleton->get_bone_pose_position(i) / skeleton->get_motion_scale()); } if (rot_enabled && (p_all_bones || te->has_track(skeleton, name, Animation::TYPE_ROTATION_3D))) { te->insert_transform_key(skeleton, name, Animation::TYPE_ROTATION_3D, skeleton->get_bone_pose_rotation(i)); |