Commit: 03da3b6593a24d24af60ec13ffb218ad06b5fd66
Author: Campbell Barton
Date:   Thu Feb 28 02:30:26 2019 +1100
Branches: master
https://developer.blender.org/rB03da3b6593a24d24af60ec13ffb218ad06b5fd66

Transform: fix redo rotate adjusting orientation

Regression in recent update.
Also de-duplicate orientation matrix initialization.

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

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

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

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 878f9385c04..6f979460f8b 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2226,8 +2226,10 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator 
*op)
                 * so use the orientation in the constraint if set */
 
                /* Use 'orient_matrix' instead. */
-               if (orientation != V3D_ORIENT_CUSTOM_MATRIX) {
-                       RNA_property_enum_set(op->ptr, prop, orientation);
+               if (t->flag & T_MODAL) {
+                       if (orientation != V3D_ORIENT_CUSTOM_MATRIX) {
+                               RNA_property_enum_set(op->ptr, prop, 
orientation);
+                       }
                }
        }
 
@@ -3459,10 +3461,6 @@ static void initShear(TransInfo *t)
                t->orient_axis = 2;
                t->orient_axis_ortho = 1;
        }
-       if (t->orient_matrix_is_set == false) {
-               t->orient_matrix_is_set = true;
-               copy_m3_m3(t->orient_matrix, t->spacemtx);
-       }
 
        initShear_mouseInputMode(t);
 
@@ -4166,18 +4164,6 @@ static void initRotation(TransInfo *t)
 
        if (t->flag & T_2D_EDIT)
                t->flag |= T_NO_CONSTRAINT;
-
-       if ((t->options & CTX_PAINT_CURVE) == 0) {
-               if (t->orient_matrix_is_set == false) {
-                       t->orient_matrix_is_set = true;
-                       t->orientation.unset = V3D_ORIENT_VIEW;
-                       copy_m3_m4(t->orient_matrix, t->viewinv);
-                       normalize_m3(t->orient_matrix);
-                       negate_m3(t->orient_matrix);
-               }
-       }
-
-       t->orient_axis = 2;
 }
 
 /* Used by Transform Rotation and Transform Normal Rotation */
@@ -4692,16 +4678,6 @@ static void initNormalRotation(TransInfo *t)
 
                storeCustomLNorValue(tc, bm);
        }
-
-       if (t->orient_matrix_is_set == false) {
-               t->orient_matrix_is_set = true;
-               t->orientation.unset = V3D_ORIENT_VIEW;
-               copy_m3_m4(t->orient_matrix, t->viewinv);
-               normalize_m3(t->orient_matrix);
-               negate_m3(t->orient_matrix);
-       }
-
-       t->orient_axis = 2;
 }
 
 /* Works by getting custom normal from clnor_data, transform, then store */
diff --git a/source/blender/editors/transform/transform_generics.c 
b/source/blender/editors/transform/transform_generics.c
index 46eeb049b42..4039252e500 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1342,6 +1342,10 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator 
*op, const wmEvent *eve
        /* Leave 't->orient_matrix_is_set' to false,
         * so we overwrite it when we have a useful value. */
 
+       /* Default to rotate on the Z axis. */
+       t->orient_axis = 2;
+       t->orient_axis_ortho = 1;
+
        /* if there's an event, we're modal */
        if (event) {
                t->flag |= T_MODAL;
diff --git a/source/blender/editors/transform/transform_orientations.c 
b/source/blender/editors/transform/transform_orientations.c
index 019ea2c0580..b486976bfad 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -483,6 +483,20 @@ void initTransformOrientation(bContext *C, TransInfo *t)
                        }
                        break;
        }
+
+       if (t->orient_matrix_is_set == false) {
+               t->orient_matrix_is_set = true;
+               if (t->flag & T_MODAL) {
+                       /* Rotate for example defaults to operating on the view 
plane. */
+                       t->orientation.unset = V3D_ORIENT_VIEW;
+                       copy_m3_m4(t->orient_matrix, t->viewinv);
+                       normalize_m3(t->orient_matrix);
+               }
+               else {
+                       copy_m3_m3(t->orient_matrix, t->spacemtx);
+               }
+               negate_m3(t->orient_matrix);
+       }
 }
 
 /**

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to