Fix converted 3.x Skeleton3D
missing pose
#88009
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue that I missed in my previous PR (#87050), which introduced converting 3.x Skeletons.
For 3.x Skeletons, poses are relative to the rest position. If a pose is set to the rest position value, the pose will be set to default
Transform()
value. Since this is the default value forpose
, this means that the pose property is not saved to the scene.Thus, when a deprecated Skeleton is loaded, the
pose
value is not set, and the skeleton position, rotation, and scale will be set to their default values and you'll get funky looking skeletons like this:Fortunately, there is an easy fix.
bound_children
is a deprecated property on 3.x skeletons that we weren't doing anything with because it's not present in the currentSkeleton3D
format (bound children find their parent index automatically in 4.x). However, this property just so happens to be always set on allSkeleton
nodes from 3.0 to 3.x branch current regardless of value, and it's always set AFTER both the pose and the rest properties. Thus, when that property is set on the Skeleton3D node, we just check to see if the position, rotation, and scale are their default values, and if so, set the pose to the rest position.