Skip to content

Add copy_bone_skin_scale to RetargetModifier3D - #122729

Open
TokageItLab wants to merge 2 commits into
godotengine:masterfrom
TokageItLab:skin-scale-retarget
Open

Add copy_bone_skin_scale to RetargetModifier3D#122729
TokageItLab wants to merge 2 commits into
godotengine:masterfrom
TokageItLab:skin-scale-retarget

Conversation

@TokageItLab

Copy link
Copy Markdown
Member

What problem(s) does this PR solve?

When using RetargetModifier3D, if you want to scale a model’s skin using skin_scale, you’ll need to scale the skin of the OriginalSkeleton because the GeneralSkeleton does not have a skin. However, doing so causes a significant misalignment between the GeneralSkeleton and the OriginalSkeleton, making it difficult to view.

image

If you apply skin_scale and BoneSpreader only to GeneralSkeleton, only the position animation will be retargeted, and the skin scaling will be ignored.

image

We will add an option to RetargetModifier to copy the skin_scale from the GeneralSkeleton to the OriginalSkeleton. This automates the coordinate transformation, allowing skin_scale to be applied to both. The process is as follows:

image image

@TokageItLab TokageItLab added this to the 4.x milestone Aug 22, 2026
@TokageItLab
TokageItLab requested review from a team as code owners August 22, 2026 23:37
@TokageItLab
TokageItLab requested review from a team as code owners August 22, 2026 23:37

@AThousandShips AThousandShips left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Some are missed cases from the original PR I believe, can apply them here or over there depending on which is most appropriate)

<member name="copy_bone_skin_scale" type="bool" setter="set_copy_bone_skin_scale" getter="is_copying_bone_skin_scale" default="true">
If [code]true[/code], copies [method Skeleton3D.get_bone_skin_scale] of the source skeleton's bones to the child skeletons' mapped bones.
If [code]false[/code], the skin scale of the child skeletons' mapped bones are reset to [code]Vector3(1, 1, 1)[/code] once and will not be overwritten after that.
[b]Note:[/b] If you want to use [method Skeleton3D.set_bone_skin_scale] on the child skeleton's mapped bone, set this to [code]false[/code]. Even if you are not using [method Skeleton3D.set_bone_skin_scale] with parent skeleton, [code]Vector3(1, 1, 1)[/code] will always be set for the child skeletons' mapped bones.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[b]Note:[/b] If you want to use [method Skeleton3D.set_bone_skin_scale] on the child skeleton's mapped bone, set this to [code]false[/code]. Even if you are not using [method Skeleton3D.set_bone_skin_scale] with parent skeleton, [code]Vector3(1, 1, 1)[/code] will always be set for the child skeletons' mapped bones.
[b]Note:[/b] If you want to use [method Skeleton3D.set_bone_skin_scale] on a child skeleton's mapped bone, set this to [code]false[/code]. Even if you are not using [method Skeleton3D.set_bone_skin_scale] with parent skeleton, [code]Vector3(1, 1, 1)[/code] will always be set for the child skeletons' mapped bones.

I'd say

<param index="1" name="skin_scale" type="Vector3" />
<description>
Sets the skin scale of the bone at [param bone_idx] to [param skin_scale]. This scale does not affect bone children. This is useful for modifying the visual thickness of a skin.
Even if the skin is visually deformed, neither scaling nor repositioning of the bones occurs. It means that you may need to adjust the origin of the child bone to synchronize its joint position with the scaling by using [BoneSpreader3D].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Even if the skin is visually deformed, neither scaling nor repositioning of the bones occurs. It means that you may need to adjust the origin of the child bone to synchronize its joint position with the scaling by using [BoneSpreader3D].
Even if the skin is visually deformed, neither scaling nor repositioning of the bones occurs. This means that you may need to adjust the origin of the child bone to synchronize its joint position with the scaling by using [BoneSpreader3D].

Comment on lines +7 to +10
Inputs a scale and converts it to the position of a child bone. Intended for use in combination with [method Skeleton3D.set_bone_skin_scale].
The skin scale modification is sufficiently working for scaling along axes other than the one connecting the parent to the child bone.
However, if the child bone is positioned outside the axis, visual discrepancies occur.
This modifier converts the scale value into the child's bone position and corrects these discrepancies.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs to be four paragraphs

Also what does "The skin scale modification is sufficiently working" mean?

PopupMenu *p = skeleton_options->get_popup();
p->add_shortcut(ED_SHORTCUT("skeleton_3d_editor/reset_all_poses", TTRC("Reset All Bone Poses")), SKELETON_OPTION_RESET_ALL_POSES);
p->add_shortcut(ED_SHORTCUT("skeleton_3d_editor/reset_selected_poses", TTRC("Reset Selected Poses")), SKELETON_OPTION_RESET_SELECTED_POSES);
p->add_shortcut(ED_SHORTCUT("skeleton_3d_editor/reset_all_pose_and_skin_scales", TTRC("Reset All Bone Pose & Skin Scales")), SKELETON_OPTION_RESET_ALL_POSE_AND_SKIN_SCALES);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
p->add_shortcut(ED_SHORTCUT("skeleton_3d_editor/reset_all_pose_and_skin_scales", TTRC("Reset All Bone Pose & Skin Scales")), SKELETON_OPTION_RESET_ALL_POSE_AND_SKIN_SCALES);
p->add_shortcut(ED_SHORTCUT("skeleton_3d_editor/reset_all_poses_and_skin_scales", TTRC("Reset All Bone Poses & Skin Scales")), SKELETON_OPTION_RESET_ALL_POSE_AND_SKIN_SCALES);

enum SkeletonOption {
SKELETON_OPTION_RESET_ALL_POSES,
SKELETON_OPTION_RESET_SELECTED_POSES,
SKELETON_OPTION_RESET_ALL_POSE_AND_SKIN_SCALES,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SKELETON_OPTION_RESET_ALL_POSE_AND_SKIN_SCALES,
SKELETON_OPTION_RESET_ALL_POSES_AND_SKIN_SCALES,

<return type="bool" />
<param index="0" name="index" type="int" />
<description>
Returns whether to use the `skin_scale` property of a [Skeleton3D]'s bone of the setting at [param index].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns whether to use the [code]skin_scale[/code] property of a [Skeleton3D]'s bone of the setting at [param index].

<param index="0" name="index" type="int" />
<param index="1" name="enabled" type="bool" />
<description>
Sets whether to use the `skin_scale` property of a [Skeleton3D]'s bone of the setting at [param index].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Sets whether to use the [code]skin_scale[/code] property of a [Skeleton3D]'s bone of the setting at [param index].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants