[Bf-blender-cvs] [12a83db83c5] master: Fix T93290: Rotation without contraint after extrude has wrong axis

Germano Cavalcante noreply at git.blender.org
Fri Nov 26 14:49:59 CET 2021


Commit: 12a83db83c5e23f5d0dccd420fa875a736a7b10f
Author: Germano Cavalcante
Date:   Fri Nov 26 10:45:28 2021 -0300
Branches: master
https://developer.blender.org/rB12a83db83c5e23f5d0dccd420fa875a736a7b10f

Fix T93290: Rotation without contraint after extrude has wrong axis

The default orientation of the mode was being indicated as overridden,
although the one of constraint was used.

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

M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_generics.c
M	source/blender/editors/transform/transform_mode.c

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

diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index d78cd13f8b8..380df739876 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -608,7 +608,7 @@ typedef struct TransInfo {
    * mouse button then.) */
   bool is_launch_event_tweak;
 
-  bool is_orient_set;
+  bool is_orient_default_overwrite;
 
   struct {
     short type;
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index c911331404f..84a685c2e72 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -493,25 +493,31 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
       }
     }
 
+    orient_type_default = orient_type_scene;
+
     if (orient_type_set != -1) {
-      orient_type_default = orient_type_set;
-      t->is_orient_set = true;
+      if (!(t->con.mode & CON_APPLY)) {
+        /* Only overwrite default if not constrained. */
+        orient_type_default = orient_type_set;
+        t->is_orient_default_overwrite = true;
+      }
     }
     else if (orient_type_matrix_set != -1) {
-      orient_type_default = orient_type_set = orient_type_matrix_set;
-      t->is_orient_set = true;
+      orient_type_set = orient_type_matrix_set;
+      if (!(t->con.mode & CON_APPLY)) {
+        /* Only overwrite default if not constrained. */
+        orient_type_default = orient_type_set;
+        t->is_orient_default_overwrite = true;
+      }
     }
     else if (t->con.mode & CON_APPLY) {
-      orient_type_default = orient_type_set = orient_type_scene;
+      orient_type_set = orient_type_scene;
+    }
+    else if (orient_type_scene == V3D_ORIENT_GLOBAL) {
+      orient_type_set = V3D_ORIENT_LOCAL;
     }
     else {
-      orient_type_default = orient_type_scene;
-      if (orient_type_scene == V3D_ORIENT_GLOBAL) {
-        orient_type_set = V3D_ORIENT_LOCAL;
-      }
-      else {
-        orient_type_set = V3D_ORIENT_GLOBAL;
-      }
+      orient_type_set = V3D_ORIENT_GLOBAL;
     }
 
     BLI_assert(!ELEM(-1, orient_type_default, orient_type_set));
diff --git a/source/blender/editors/transform/transform_mode.c b/source/blender/editors/transform/transform_mode.c
index 5e0abbc1a08..0f520c4d3f1 100644
--- a/source/blender/editors/transform/transform_mode.c
+++ b/source/blender/editors/transform/transform_mode.c
@@ -1240,7 +1240,7 @@ void transform_mode_default_modal_orientation_set(TransInfo *t, int type)
   /* Currently only these types are supported. */
   BLI_assert(ELEM(type, V3D_ORIENT_GLOBAL, V3D_ORIENT_VIEW));
 
-  if (t->is_orient_set) {
+  if (t->is_orient_default_overwrite) {
     return;
   }



More information about the Bf-blender-cvs mailing list