[Bf-blender-cvs] [92743cc895d] master: Fix T85886: Rotate Tool and Adjust Last Operation - angles inverted

Germano Cavalcante noreply at git.blender.org
Sat Feb 27 21:23:03 CET 2021


Commit: 92743cc895dd34bdaa165679bf9d06dfa3f8cb24
Author: Germano Cavalcante
Date:   Sat Feb 27 17:10:18 2021 -0300
Branches: master
https://developer.blender.org/rB92743cc895dd34bdaa165679bf9d06dfa3f8cb24

Fix T85886: Rotate Tool and Adjust Last Operation - angles inverted

The constraint was not set when redoing.

This commit also removes `postInputRotation`. I really couldn't see a use for it.

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

M	source/blender/editors/transform/transform_constraints.c
M	source/blender/editors/transform/transform_generics.c
M	source/blender/editors/transform/transform_mode.c
M	source/blender/editors/transform/transform_mode.h
M	source/blender/editors/transform/transform_mode_bend.c
M	source/blender/editors/transform/transform_mode_edge_rotate_normal.c
M	source/blender/editors/transform/transform_mode_rotate.c

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

diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 1f589a830fc..93d5d41e121 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -572,7 +572,7 @@ static void constraints_rotation_impl(TransInfo *t,
       break;
   }
   /* don't flip axis if asked to or if num input */
-  if (r_angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
+  if (r_angle && !((mode & CON_NOFLIP) || hasNumInput(&t->num) || (t->flag & T_INPUT_IS_VALUES_FINAL))) {
     float view_vector[3];
     view_vector_calc(t, t->center_global, view_vector);
     if (dot_v3v3(r_vec, view_vector) > 0.0f) {
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 6fca49495e9..e43a3ff3635 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -381,12 +381,10 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
 
   if (op && (prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
     bool constraint_axis[3] = {false, false, false};
-    if (t->flag & T_INPUT_IS_VALUES_FINAL) {
-      if (t_values_set_is_array) {
-        /* For operators whose `t->values` is array, set constraint so that the
-         * orientation is more intuitive in the Redo Panel. */
-        constraint_axis[0] = constraint_axis[1] = constraint_axis[2] = true;
-      }
+    if (t_values_set_is_array && t->flag & T_INPUT_IS_VALUES_FINAL) {
+      /* For operators whose `t->values` is array (as Move and Scale), set constraint so that the
+       * orientation is more intuitive in the Redo Panel. */
+      constraint_axis[0] = constraint_axis[1] = constraint_axis[2] = true;
     }
     else if (RNA_property_is_set(op->ptr, prop)) {
       RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
diff --git a/source/blender/editors/transform/transform_mode.c b/source/blender/editors/transform/transform_mode.c
index 9e6e4d8807e..d14f693da9c 100644
--- a/source/blender/editors/transform/transform_mode.c
+++ b/source/blender/editors/transform/transform_mode.c
@@ -554,15 +554,6 @@ void headerRotation(TransInfo *t, char str[UI_MAX_DRAW_STR], float final)
   }
 }
 
-void postInputRotation(TransInfo *t, float values[3])
-{
-  float axis_final[3];
-  copy_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, values);
-  }
-}
-
 /**
  * Applies values of rotation to `td->loc` and `td->ext->quat`
  * based on a rotation matrix (mat) and a pivot (center).
diff --git a/source/blender/editors/transform/transform_mode.h b/source/blender/editors/transform/transform_mode.h
index 7a05506e12c..6d7a0b528ae 100644
--- a/source/blender/editors/transform/transform_mode.h
+++ b/source/blender/editors/transform/transform_mode.h
@@ -47,7 +47,6 @@ void protectedTransBits(short protectflag, float vec[3]);
 void protectedSizeBits(short protectflag, float size[3]);
 void constraintTransLim(TransInfo *t, TransData *td);
 void constraintSizeLim(TransInfo *t, TransData *td);
-void postInputRotation(TransInfo *t, float values[3]);
 void headerRotation(TransInfo *t, char *str, float final);
 void ElementRotation_ex(TransInfo *t,
                         TransDataContainer *tc,
diff --git a/source/blender/editors/transform/transform_mode_bend.c b/source/blender/editors/transform/transform_mode_bend.c
index adf3a0346a0..038f7d48c66 100644
--- a/source/blender/editors/transform/transform_mode_bend.c
+++ b/source/blender/editors/transform/transform_mode_bend.c
@@ -254,7 +254,6 @@ void initBend(TransInfo *t)
   t->transform = Bend;
   t->handleEvent = handleEventBend;
 
-  setInputPostFct(&t->mouse, postInputRotation);
   initMouseInputMode(t, &t->mouse, INPUT_ANGLE_SPRING);
 
   t->idx_max = 1;
diff --git a/source/blender/editors/transform/transform_mode_edge_rotate_normal.c b/source/blender/editors/transform/transform_mode_edge_rotate_normal.c
index 32f0d4bd365..c78115561b2 100644
--- a/source/blender/editors/transform/transform_mode_edge_rotate_normal.c
+++ b/source/blender/editors/transform/transform_mode_edge_rotate_normal.c
@@ -127,7 +127,6 @@ void initNormalRotation(TransInfo *t)
   t->mode = TFM_NORMAL_ROTATION;
   t->transform = applyNormalRotation;
 
-  setInputPostFct(&t->mouse, postInputRotation);
   initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
 
   t->idx_max = 0;
diff --git a/source/blender/editors/transform/transform_mode_rotate.c b/source/blender/editors/transform/transform_mode_rotate.c
index fa02e5382a7..8d8594d5775 100644
--- a/source/blender/editors/transform/transform_mode_rotate.c
+++ b/source/blender/editors/transform/transform_mode_rotate.c
@@ -197,7 +197,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
   float final = t->values[0];
 
   if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
-    t->con.applyRot(t, NULL, NULL, axis_final, NULL);
+    t->con.applyRot(t, NULL, NULL, axis_final, &final);
   }
   else {
     negate_v3_v3(axis_final, t->spacemtx[t->orient_axis]);
@@ -234,7 +234,6 @@ void initRotation(TransInfo *t)
   t->tsnap.applySnap = ApplySnapRotation;
   t->tsnap.distance = RotationBetween;
 
-  setInputPostFct(&t->mouse, postInputRotation);
   initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
 
   t->idx_max = 0;



More information about the Bf-blender-cvs mailing list