[Bf-blender-cvs] [2dace5f3ef5] master: Cleanup: use 3D dot product (not 4D) when comparing pose-bone axes

Campbell Barton noreply at git.blender.org
Tue Oct 5 03:11:59 CEST 2021


Commit: 2dace5f3ef54cc25ed31fe20fd33df727f10a9ac
Author: Campbell Barton
Date:   Tue Oct 5 10:59:49 2021 +1100
Branches: master
https://developer.blender.org/rB2dace5f3ef54cc25ed31fe20fd33df727f10a9ac

Cleanup: use 3D dot product (not 4D) when comparing pose-bone axes

Also use more meaningful variable name.

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

M	source/blender/blenkernel/intern/action_mirror.c

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

diff --git a/source/blender/blenkernel/intern/action_mirror.c b/source/blender/blenkernel/intern/action_mirror.c
index 48472dfc9b3..cc3a15aa546 100644
--- a/source/blender/blenkernel/intern/action_mirror.c
+++ b/source/blender/blenkernel/intern/action_mirror.c
@@ -327,10 +327,10 @@ static void action_flip_pchan(Object *ob_arm,
      * the X-axis, it turns into a 180 degree rotation over the Y-axis.
      * This has only been observed with bones that can't be flipped,
      * hence the check for `pchan_flip`. */
-    const float unit_x[4] = {1.0f, 0.0f, 0.0f, 0.0f};
-    const bool is_problematic = pchan_flip == NULL &&
-                                fabsf(dot_v4v4(pchan->bone->arm_mat[0], unit_x)) <= 1e-6;
-    if (is_problematic) {
+    const float unit_x[3] = {1.0f, 0.0f, 0.0f};
+    const bool is_x_axis_orthogonal = (pchan_flip == NULL) &&
+                                      (fabsf(dot_v3v3(pchan->bone->arm_mat[0], unit_x)) <= 1e-6f);
+    if (is_x_axis_orthogonal) {
       /* Matrix needs to flip both the X and Z axes to come out right. */
       float extra_mat[4][4] = {
           {-1.0f, 0.0f, 0.0f, 0.0f},



More information about the Bf-blender-cvs mailing list