diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2020-01-19 18:50:37 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2020-01-19 18:50:37 +0300 |
commit | 9b70950e3c93986db216c28396aacdd6343a10aa (patch) | |
tree | f94c7f80b0e5e3ea889b5c90247b395660f1e639 | |
parent | c2e62c1292352dc6006e5ca4d474f809faf1d166 (diff) | |
parent | d1657b406ed0f3df9e1690cd445702c6178ffd15 (diff) |
Merge branch 'blender-v2.82-release'
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index c588ee80c78..e4da10797ff 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2293,13 +2293,17 @@ void mat3_to_vec_roll(const float mat[3][3], float r_vec[3], float *r_roll) * If vec is the Y vector from purely rotational mat, result should be exact. */ void mat3_vec_to_roll(const float mat[3][3], const float vec[3], float *r_roll) { - float vecmat[3][3], vecmatinv[3][3], rollmat[3][3]; + float vecmat[3][3], vecmatinv[3][3], rollmat[3][3], q[4]; + /* Compute the orientation relative to the vector with zero roll. */ vec_roll_to_mat3(vec, 0.0f, vecmat); invert_m3_m3(vecmatinv, vecmat); mul_m3_m3m3(rollmat, vecmatinv, mat); - *r_roll = atan2f(rollmat[2][0], rollmat[2][2]); + /* Extract the twist angle as the roll value. */ + mat3_to_quat(q, rollmat); + + *r_roll = quat_split_swing_and_twist(q, 1, NULL, NULL); } /* Calculates the rest matrix of a bone based on its vector and a roll around that vector. */ |