[Bf-blender-cvs] [5ca8875f69d] master: Fix T73148: Incorrect Repeat Last for transforms with Individual Origins and Normal orientation

Germano Cavalcante noreply at git.blender.org
Tue May 19 23:55:38 CEST 2020


Commit: 5ca8875f69d3b3644ca30882428608773fcc4481
Author: Germano Cavalcante
Date:   Tue May 19 18:54:46 2020 -0300
Branches: master
https://developer.blender.org/rB5ca8875f69d3b3644ca30882428608773fcc4481

Fix T73148: Incorrect Repeat Last for transforms with Individual Origins and Normal orientation

`pvec` was confusing and was adding steps that are apparently unnecessary.
So the code has been redone so as not to use this pvec.

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

M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_constraints.c
M	source/blender/editors/transform/transform_mode_edge_seq_slide.c
M	source/blender/editors/transform/transform_mode_translate.c

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

diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 503e7bd4691..943b8234f1e 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -139,8 +139,7 @@ typedef struct TransCon {
                    struct TransDataContainer *tc,
                    struct TransData *td,
                    const float in[3],
-                   float out[3],
-                   float pvec[3]);
+                   float out[3]);
   /** Apply function pointer for size transformation. */
   void (*applySize)(struct TransInfo *t,
                     struct TransDataContainer *tc,
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index b07eb6edf5a..ffbc9d0953c 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -121,10 +121,8 @@ void constraintNumInput(TransInfo *t, float vec[3])
   }
 }
 
-static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
+static void postConstraintChecks(TransInfo *t, float vec[3])
 {
-  int i = 0;
-
   mul_m3_v3(t->con.imtx, vec);
 
   snapGridIncrement(t, vec);
@@ -155,16 +153,6 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
     /* inverse transformation at the end */
   }
 
-  if (t->con.mode & CON_AXIS0) {
-    pvec[i++] = vec[0];
-  }
-  if (t->con.mode & CON_AXIS1) {
-    pvec[i++] = vec[1];
-  }
-  if (t->con.mode & CON_AXIS2) {
-    pvec[i++] = vec[2];
-  }
-
   mul_m3_v3(t->con.mtx, vec);
 }
 
@@ -346,12 +334,8 @@ static void planeProjection(const TransInfo *t, const float in[3], float out[3])
  * (in perspective mode, the view vector is relative to the position on screen)
  */
 
-static void applyAxisConstraintVec(TransInfo *t,
-                                   TransDataContainer *UNUSED(tc),
-                                   TransData *td,
-                                   const float in[3],
-                                   float out[3],
-                                   float pvec[3])
+static void applyAxisConstraintVec(
+    TransInfo *t, TransDataContainer *UNUSED(tc), TransData *td, const float in[3], float out[3])
 {
   copy_v3_v3(out, in);
   if (!td && t->con.mode & CON_APPLY) {
@@ -382,7 +366,7 @@ static void applyAxisConstraintVec(TransInfo *t,
         axisProjection(t, c, in, out);
       }
     }
-    postConstraintChecks(t, out, pvec);
+    postConstraintChecks(t, out);
   }
 }
 
@@ -397,12 +381,8 @@ static void applyAxisConstraintVec(TransInfo *t,
  * Further down, that vector is mapped to each data's space.
  */
 
-static void applyObjectConstraintVec(TransInfo *t,
-                                     TransDataContainer *tc,
-                                     TransData *td,
-                                     const float in[3],
-                                     float out[3],
-                                     float pvec[3])
+static void applyObjectConstraintVec(
+    TransInfo *t, TransDataContainer *tc, TransData *td, const float in[3], float out[3])
 {
   copy_v3_v3(out, in);
   if (t->con.mode & CON_APPLY) {
@@ -431,23 +411,9 @@ static void applyObjectConstraintVec(TransInfo *t,
         }
         axisProjection(t, c, in, out);
       }
-      postConstraintChecks(t, out, pvec);
-      copy_v3_v3(out, pvec);
+      postConstraintChecks(t, out);
     }
     else {
-      int i = 0;
-
-      out[0] = out[1] = out[2] = 0.0f;
-      if (t->con.mode & CON_AXIS0) {
-        out[0] = in[i++];
-      }
-      if (t->con.mode & CON_AXIS1) {
-        out[1] = in[i++];
-      }
-      if (t->con.mode & CON_AXIS2) {
-        out[2] = in[i++];
-      }
-
       mul_m3_v3(td->axismtx, out);
       if (t->flag & T_EDIT) {
         mul_m3_v3(tc->mat3_unit, out);
@@ -653,7 +619,7 @@ void setAxisMatrixConstraint(TransInfo *t, int mode, const char text[])
   }
   else {
     BLI_strncpy(t->con.text + 1, text, sizeof(t->con.text) - 1);
-    copy_m3_m3(t->con.mtx, tc->data->axismtx);
+    unit_m3(t->con.mtx);
     t->con.mode = mode;
     getConstraintMatrix(t);
 
diff --git a/source/blender/editors/transform/transform_mode_edge_seq_slide.c b/source/blender/editors/transform/transform_mode_edge_seq_slide.c
index ee91459dcdd..8690cd54a3b 100644
--- a/source/blender/editors/transform/transform_mode_edge_seq_slide.c
+++ b/source/blender/editors/transform/transform_mode_edge_seq_slide.c
@@ -101,9 +101,8 @@ static void applySeqSlide(TransInfo *t, const int mval[2])
   snapSequenceBounds(t, mval);
 
   if (t->con.mode & CON_APPLY) {
-    float pvec[3] = {0.0f, 0.0f, 0.0f};
     float tvec[3];
-    t->con.applyVec(t, NULL, NULL, t->values, tvec, pvec);
+    t->con.applyVec(t, NULL, NULL, t->values, tvec);
     copy_v3_v3(t->values_final, tvec);
   }
   else {
diff --git a/source/blender/editors/transform/transform_mode_translate.c b/source/blender/editors/transform/transform_mode_translate.c
index 0a7d8bd90d3..4b380264dde 100644
--- a/source/blender/editors/transform/transform_mode_translate.c
+++ b/source/blender/editors/transform/transform_mode_translate.c
@@ -277,8 +277,7 @@ static void applyTranslationValue(TransInfo *t, const float vec[3])
       }
 
       if (t->con.applyVec) {
-        float pvec[3];
-        t->con.applyVec(t, tc, td, vec, tvec, pvec);
+        t->con.applyVec(t, tc, td, vec, tvec);
       }
       else {
         copy_v3_v3(tvec, vec);
@@ -319,7 +318,6 @@ static void applyTranslationValue(TransInfo *t, const float vec[3])
 static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
 {
   char str[UI_MAX_DRAW_STR];
-  float values_final[3];
 
   if (t->flag & T_INPUT_IS_VALUES_FINAL) {
     copy_v3_v3(t->values_final, t->values);
@@ -336,28 +334,24 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
 
     applySnapping(t, t->values_final);
   }
-  copy_v3_v3(values_final, t->values_final);
 
   if (t->con.mode & CON_APPLY) {
-    float pvec[3] = {0.0f, 0.0f, 0.0f};
-    t->con.applyVec(t, NULL, NULL, t->values_final, values_final, pvec);
-    headerTranslation(t, pvec, str);
-
-    /* only so we have re-usable value with redo, see T46741. */
-    mul_v3_m3v3(t->values_final, t->con.imtx, values_final);
+    float values_final[3];
+    copy_v3_v3(values_final, t->values_final);
+    t->con.applyVec(t, NULL, NULL, values_final, t->values_final);
+    headerTranslation(t, t->values_final, str);
   }
   else {
     headerTranslation(t, t->values_final, str);
-    copy_v3_v3(values_final, t->values_final);
   }
 
   /* don't use 't->values' now on */
 
-  applyTranslationValue(t, values_final);
+  applyTranslationValue(t, t->values_final);
 
   /* evil hack - redo translation if clipping needed */
-  if (t->flag & T_CLIP_UV && clipUVTransform(t, values_final, 0)) {
-    applyTranslationValue(t, values_final);
+  if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values_final, 0)) {
+    applyTranslationValue(t, t->values_final);
 
     /* In proportional edit it can happen that */
     /* vertices in the radius of the brush end */



More information about the Bf-blender-cvs mailing list