[Bf-blender-cvs] [58229b191a1] master: Fix T68145: Bone Rotate Individual Axes fail.

Bastien Montagne noreply at git.blender.org
Mon Aug 5 15:47:46 CEST 2019


Commit: 58229b191a177ec0192786df005c9b586991c43a
Author: Bastien Montagne
Date:   Mon Aug 5 15:42:48 2019 +0200
Branches: master
https://developer.blender.org/rB58229b191a177ec0192786df005c9b586991c43a

Fix T68145: Bone Rotate Individual Axes fail.

Rotation matrix would not get updated every time it would need to, after
own changes to handle 'big' rotations from keyboard input (rBcee484a4c51a3d2).

===================================================================

M	source/blender/editors/transform/transform.c

===================================================================

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 973c1c0b7f7..9723e640259 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -4607,6 +4607,10 @@ static void applyRotationValue(TransInfo *t,
   }
 
   axis_angle_normalized_to_mat3(mat, axis, angle);
+  /* Counter for needed updates (when we need to update to non-default matrix,
+   * we also need another update on next iteration to go back to default matrix,
+   * hence the '2' value used here, instead of a mere boolean). */
+  short do_update_matrix = 0;
 
   FOREACH_TRANS_DATA_CONTAINER (t, tc) {
     TransData *td = tc->data;
@@ -4623,6 +4627,9 @@ static void applyRotationValue(TransInfo *t,
       if (t->con.applyRot) {
         t->con.applyRot(t, tc, td, axis, NULL);
         angle_final = angle * td->factor;
+        /* Even though final angle might be identical to orig value,
+         * we have to update the rotation matrix in that case... */
+        do_update_matrix = 2;
       }
       else if (t->flag & T_PROP_EDIT) {
         angle_final = angle * td->factor;
@@ -4645,11 +4652,17 @@ static void applyRotationValue(TransInfo *t,
           axis_angle_normalized_to_mat3(mat, axis, angle_progress);
           ElementRotation(t, tc, td, mat, t->around);
         }
-        axis_angle_normalized_to_mat3(mat, axis, angle_final);
+        do_update_matrix = 2;
       }
       else if (angle_final != angle) {
+        do_update_matrix = 2;
+      }
+
+      if (do_update_matrix > 0) {
         axis_angle_normalized_to_mat3(mat, axis, angle_final);
+        do_update_matrix--;
       }
+
       ElementRotation(t, tc, td, mat, t->around);
     }
   }



More information about the Bf-blender-cvs mailing list