godot icon indicating copy to clipboard operation
godot copied to clipboard

Add apply node transforms option to rest fixer

Open TokageItLab opened this issue 2 years ago • 4 comments

Fixes #63641. Implement apply node transforms in rest fixer.

image

This option discards all rotations and scales of the Skeleton's parent nodes and includes them in Rest (then that Scale is converted to Translate).

This can cause problems if there are Skeleton sibling objects or BoneAttachment in the scene, but since this is probably a corner case and this option can be disabled, so I think that it is not a problem for now.

TokageItLab avatar Jul 30 '22 00:07 TokageItLab

Lyuma had some off github discussion:

トカゲ I'm not convinced this is the best approach I still think we should add a new bone as parent of other bones, which counteracts the node scale

fire avatar Jul 30 '22 06:07 fire

An alternative approach is start the skeleton at the common parent that is not identity transform

fire avatar Jul 30 '22 06:07 fire

The approach @lyuma described was to insert a bone to cancel the transform further into the parent of the bone root and keep parent node transform, but I disagree.

That approach requires a reserved word. Also if you take out the Skeleton after Make Local, the Transform of the Skeleton will change. This is an obstacle when creating a game with only the Skeleton extracted.

Also, unlike concepts such as virtual bones to fill in missing bones created during mapping, such as UpperChest, the insertion of cancel bones is a complete hack. It would be confusing because the average user would not realize that applying a transform and implicitly adding a cancel bone are related.

So I rather prefer to correct the transform of the entire scene correctly in the pre process as in #60115.

TokageItLab avatar Jul 30 '22 07:07 TokageItLab

After discussions with @lyuma and @fire, we have reached an agreement that this PR has a different purpose than #60115 and that both can be implemented.

#60115 feature is intended to modify the root scale, and it fixes the LOD, etc. of the Mesh at a stage prior to PostImportProcess.

This PR feature is there mainly for retargeting and removes not only the Transform of the root node, but also all Transforms from SkeletonNode to the root node by applying them to the Skeleton bones.

However, there may be room to discuss whether to implement an option to import the Skeleton as a SceneRoot with Transform applied instead of this PR, such like Import as Skeleton, Import as Skeleton + AnimationLibrary. @reduz How do you think?

TokageItLab avatar Aug 06 '22 19:08 TokageItLab

This seems good, I feel we should ask a bit more for advise on some of the names for these things which may not be entirely obvious at first glance, although given we can document these properties nowadays it may not be as important.

reduz avatar Aug 18 '22 09:08 reduz

Yes, it is my todo to document retargeting and changed blend animations after the feature freezes.

TokageItLab avatar Aug 18 '22 09:08 TokageItLab

Thanks!

akien-mga avatar Aug 22 '22 20:08 akien-mga

Should this setting be disabled when Apply Root Scale is disabled? It seems counter-intuitive to have code that applies node transforms (including scale) when the import setting to apply root scale is disabled.

aaronfranke avatar Feb 07 '23 02:02 aaronfranke

This option is performed in priority to the disabling of Apply Root Scale because it is an option to eliminate all Transforms of the Skeleton's parent regardless of whether the node is root or not to remove visual differences of transform in Skeleton.

Be aware that this is a "PostImportProcess". It may don't take into account any processing that prior to this.

TokageItLab avatar Feb 07 '23 02:02 TokageItLab