[Bf-blender-cvs] [8bff3ec76bb] master: Transform: Don't negate the z axis of the View orientation

Germano Cavalcante noreply at git.blender.org
Wed May 20 21:23:06 CEST 2020


Commit: 8bff3ec76bbdb934a5bf7bdb53c14a59481a3aed
Author: Germano Cavalcante
Date:   Wed May 20 16:22:28 2020 -0300
Branches: master
https://developer.blender.org/rB8bff3ec76bbdb934a5bf7bdb53c14a59481a3aed

Transform: Don't negate the z axis of the View orientation

This was so because of the rotate transformation mode but it can make
other modes confusing and add unnecessary complexity.

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

M	source/blender/editors/transform/transform_constraints.c
M	source/blender/editors/transform/transform_gizmo_3d.c
M	source/blender/editors/transform/transform_mode_rotate.c
M	source/blender/editors/transform/transform_mode_shear.c
M	source/blender/editors/transform/transform_orientations.c

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

diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index ffbc9d0953c..b05b99d9601 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -679,10 +679,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
       break;
     case V3D_ORIENT_VIEW:
       BLI_snprintf(text, sizeof(text), ftext, TIP_("view"));
-      float mtx[3][3];
-      copy_m3_m3(mtx, t->spacemtx);
-      negate_v3(mtx[2]);
-      setConstraint(t, mtx, mode, text);
+      setConstraint(t, t->spacemtx, mode, text);
       break;
     case V3D_ORIENT_CURSOR:
       BLI_snprintf(text, sizeof(text), ftext, TIP_("cursor"));
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index 19f0eb7ac90..f143d4c2993 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -1404,7 +1404,7 @@ void drawDial3d(const TransInfo *t)
     }
     else {
       axis_idx = MAN_AXIS_ROT_C;
-      negate_v3_v3(mat_basis[2], t->spacemtx[t->orient_axis]);
+      copy_v3_v3(mat_basis[2], t->spacemtx[t->orient_axis]);
       scale *= 1.2f;
       line_with -= 1.0f;
     }
diff --git a/source/blender/editors/transform/transform_mode_rotate.c b/source/blender/editors/transform/transform_mode_rotate.c
index f52bfda0d14..55c97630487 100644
--- a/source/blender/editors/transform/transform_mode_rotate.c
+++ b/source/blender/editors/transform/transform_mode_rotate.c
@@ -146,7 +146,8 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
   snapGridIncrement(t, &final);
 
   float axis_final[3];
-  copy_v3_v3(axis_final, t->spacemtx[t->orient_axis]);
+  /* Use the negative axis to match the default Z axis of the view matrix. */
+  negate_v3_v3(axis_final, t->spacemtx[t->orient_axis]);
 
   if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
     t->con.applyRot(t, NULL, NULL, axis_final, NULL);
diff --git a/source/blender/editors/transform/transform_mode_shear.c b/source/blender/editors/transform/transform_mode_shear.c
index da34bf50ba3..dc0479f4e60 100644
--- a/source/blender/editors/transform/transform_mode_shear.c
+++ b/source/blender/editors/transform/transform_mode_shear.c
@@ -58,12 +58,12 @@ static void initShear_mouseInputMode(TransInfo *t)
   /* Needed for axis aligned view gizmo. */
   if (t->orientation.types[t->orientation.index] == V3D_ORIENT_VIEW) {
     if (t->orient_axis_ortho == 0) {
-      if (t->center2d[1] < t->mouse.imval[1]) {
+      if (t->center2d[1] > t->mouse.imval[1]) {
         dir_flip = !dir_flip;
       }
     }
     else if (t->orient_axis_ortho == 1) {
-      if (t->center2d[0] < t->mouse.imval[0]) {
+      if (t->center2d[0] > t->mouse.imval[0]) {
         dir_flip = !dir_flip;
       }
     }
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 81c63278366..ff15bbfb5d6 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -486,7 +486,6 @@ void initTransformOrientation(bContext *C, TransInfo *t, short orientation)
       else {
         unit_m3(mat);
       }
-      negate_v3(mat[2]);
       copy_m3_m3(t->spacemtx, mat);
       break;
     }
@@ -511,6 +510,8 @@ void initTransformOrientation(bContext *C, TransInfo *t, short orientation)
       }
       break;
   }
+
+  invert_m3_m3(t->spacemtx_inv, t->spacemtx);
 }
 
 /**



More information about the Bf-blender-cvs mailing list