From a5e0bb447c339365d99dba772ea733c997c21200 Mon Sep 17 00:00:00 2001 From: tagcup Date: Sat, 14 Apr 2018 15:53:25 -0400 Subject: Avoid converting Quat to Euler angles when not necessary. Also ensure that get_scale doesn't arbitrarlity change the signs of scales, ensuring that the combination of get_rotation and get_scale gives the correct basis. Added various missing functions and constructors. Should close #17968. --- scene/3d/spatial.cpp | 4 +--- scene/animation/animation_player.cpp | 4 +--- scene/animation/animation_tree_player.cpp | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) (limited to 'scene') diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index f8a5c7f400..dab0e573d7 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -85,9 +85,7 @@ void Spatial::_notify_dirty() { } void Spatial::_update_local_transform() const { - data.local_transform.basis = Basis(); - data.local_transform.basis.scale(data.scale); - data.local_transform.basis.rotate(data.rotation); + data.local_transform.basis.set_euler_scale(data.rotation, data.scale); data.dirty &= ~DIRTY_LOCAL; } diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 63580bcae6..eca7caeaf0 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -590,9 +590,7 @@ void AnimationPlayer::_animation_update_transforms() { Transform t; t.origin = nc->loc_accum; - t.basis.scale(nc->scale_accum); - t.basis.rotate(nc->rot_accum.get_euler()); - + t.basis.set_quat_scale(nc->rot_accum, nc->scale_accum); if (nc->skeleton && nc->bone_idx >= 0) { nc->skeleton->set_bone_pose(nc->bone_idx, t); diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index e811b7a7b3..42fa20068b 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -900,8 +900,7 @@ void AnimationTreePlayer::_process_animation(float p_delta) { t.scale.x += 1.0; t.scale.y += 1.0; t.scale.z += 1.0; - xform.basis.scale(t.scale); - xform.basis.rotate(t.rot.get_euler()); + xform.basis.set_quat_scale(t.rot, t.scale); if (t.bone_idx >= 0) { if (t.skeleton) -- cgit v1.2.3