Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/TokageItLab/retarget-modifier' …
Browse files Browse the repository at this point in the history
…into groups-staging-4.4
  • Loading branch information
fire committed Oct 13, 2024
2 parents 4179355 + e42e587 commit 02b7ea4
Show file tree
Hide file tree
Showing 18 changed files with 873 additions and 22 deletions.
6 changes: 6 additions & 0 deletions doc/classes/AnimationLibrary.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
Returns the keys for the [Animation]s stored in the library.
</description>
</method>
<method name="get_animation_list_size" qualifiers="const">
<return type="int" />
<description>
Returns the key count for the [Animation]s stored in the library.
</description>
</method>
<method name="has_animation" qualifiers="const">
<return type="bool" />
<param index="0" name="name" type="StringName" />
Expand Down
34 changes: 34 additions & 0 deletions doc/classes/RetargetModifier3D.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="RetargetModifier3D" inherits="SkeletonModifier3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
A modifier to transfer parent skeleton poses (or global poses) to child skeletons in model space with different rests.
</brief_description>
<description>
Retrieves the pose (or global pose) relative to the parent Skeleton's rest in model space and transfers it to the child Skeleton.
This modifier rewrites the pose of the child skeleton directly in the parent skeleton's update process. This means that it overwrites the mapped bone pose set in the normal process on the target skeleton. If you want to set the target skeleton bone pose after retargeting, you will need to add a child [SkeletonModifier3D] to the target skeleton and thereby modify the pose.
[b]Note:[/b] When the [member use_global_pose] is enabled, even if it is an unmapped bone, it can cause visual problems because the global pose is applied ignoring the parent bone's pose [b]if it has mapped bone children[/b]. See also [member use_global_pose].
</description>
<tutorials>
</tutorials>
<members>
<member name="position_enabled" type="bool" setter="set_position_enabled" getter="is_position_enabled" default="true">
If [code]true[/code], allows to retarget the position.
</member>
<member name="profile" type="SkeletonProfile" setter="set_profile" getter="get_profile">
[SkeletonProfile] for retargeting bones with names matching the bone list.
</member>
<member name="rotation_enabled" type="bool" setter="set_rotation_enabled" getter="is_rotation_enabled" default="true">
If [code]true[/code], allows to retarget the rotation.
</member>
<member name="scale_enabled" type="bool" setter="set_scale_enabled" getter="is_scale_enabled" default="true">
If [code]true[/code], allows to retarget the scale.
</member>
<member name="use_global_pose" type="bool" setter="set_use_global_pose" getter="is_using_global_pose" default="false">
If [code]false[/code], in case the target skeleton has fewer bones than the source skeleton, the source bone parent's transform will be ignored.
Instead, it is possible to retarget between models with different body shapes, and position, rotation, and scale can be retargeted separately.
If [code]true[/code], Retargeting is performed taking into account global pose.
In case the target skeleton has fewer bones than the source skeleton, the source bone parent's transform is taken into account. However, bone length between skeletons must match exactly, if not, the bones will be forced to expand or shrink.
This is useful for using dummy bone which length is [b]0[/b] to match postures when retargeting between models with different number of bones.
</member>
</members>
</class>
4 changes: 4 additions & 0 deletions doc/classes/Skeleton3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@
[b]Note:[/b] During the update process, this signal is not fired, so modification by [SkeletonModifier3D] is not detected.
</description>
</signal>
<signal name="rest_updated">
<description>
</description>
</signal>
<signal name="show_rest_only_changed">
<description>
Emitted when the value of [member show_rest_only] changes.
Expand Down
1 change: 1 addition & 0 deletions editor/icons/RetargetModifier3D.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion editor/import/3d/post_import_plugin_skeleton_renamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

void PostImportPluginSkeletonRenamer::get_internal_import_options(InternalImportCategory p_category, List<ResourceImporter::ImportOption> *r_options) {
if (p_category == INTERNAL_IMPORT_CATEGORY_SKELETON_3D_NODE) {
r_options->push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "retarget/bone_renamer/rename_bones"), true));
r_options->push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "retarget/bone_renamer/rename_bones", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "retarget/bone_renamer/unique_node/make_unique"), true));
r_options->push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::STRING, "retarget/bone_renamer/unique_node/skeleton_name"), "GeneralSkeleton"));
}
Expand Down
Loading

0 comments on commit 02b7ea4

Please sign in to comment.