Skip to content

Commit

Permalink
Merge pull request #87050 from nikitalita/convert-3.x-skeletons
Browse files Browse the repository at this point in the history
Skeleton3D: Convert 3.x skeletons
  • Loading branch information
YuriSizov committed Jan 22, 2024
2 parents c721067 + bcad569 commit 36f5050
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scene/3d/skeleton_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ bool Skeleton3D::_set(const StringName &p_path, const Variant &p_value) {
set_bone_pose_rotation(which, p_value);
} else if (what == "scale") {
set_bone_pose_scale(which, p_value);
#ifndef DISABLE_DEPRECATED
} else if (what == "pose") {
// Kept for compatibility from 3.x to 4.x.
WARN_DEPRECATED_MSG("Skeleton uses old pose format, which is deprecated (and loads slower). Consider re-importing or re-saving the scene." +
(is_inside_tree() ? vformat(" Path: \"%s\"", get_path()) : String()));
// Old Skeleton poses were relative to rest, new ones are absolute, so we need to recompute the pose.
// Skeleton3D nodes were always written with rest before pose, so this *SHOULD* work...
Transform3D rest = get_bone_rest(which);
Transform3D pose = rest * (Transform3D)p_value;
set_bone_pose_position(which, pose.origin);
set_bone_pose_rotation(which, pose.basis.get_rotation_quaternion());
set_bone_pose_scale(which, pose.basis.get_scale());
#endif
} else {
return false;
}
Expand Down

0 comments on commit 36f5050

Please sign in to comment.