[Bf-blender-cvs] [a69983f30e3] master: Fix T85229: Transform operator saving a different orientation than the chosen one

Germano Cavalcante noreply at git.blender.org
Mon Feb 1 15:17:29 CET 2021


Commit: a69983f30e3fd342a605910fa81ae72c25869ff0
Author: Germano Cavalcante
Date:   Mon Feb 1 11:16:49 2021 -0300
Branches: master
https://developer.blender.org/rBa69983f30e3fd342a605910fa81ae72c25869ff0

Fix T85229: Transform operator saving a different orientation than the chosen one

Some orientations are not possible to be calculated for certain scenes.

In these cases, others are chosen and informed by the operator.

However, the user may prefer that the chosen one be displayed (even if it
is not actually used).

This corresponds to older versions of Blender.

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

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

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

diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 3b39f4d06ad..6d1bb9cc0de 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -521,23 +521,19 @@ short ED_transform_calc_orientation_from_type_ex(const bContext *C,
                                                  const int pivot_point)
 {
   switch (orientation_type) {
-    case V3D_ORIENT_GLOBAL: {
-      unit_m3(r_mat);
-      return V3D_ORIENT_GLOBAL;
-    }
     case V3D_ORIENT_GIMBAL: {
       if (ob && gimbal_axis(ob, r_mat)) {
-        return V3D_ORIENT_GIMBAL;
+        break;
       }
-      /* if not gimbal, fall through to normal */
+      /* If not gimbal, fall through to normal. */
       ATTR_FALLTHROUGH;
     }
     case V3D_ORIENT_NORMAL: {
       if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
         ED_getTransformOrientationMatrix(C, ob, obedit, pivot_point, r_mat);
-        return V3D_ORIENT_NORMAL;
+        break;
       }
-      /* no break we define 'normal' as 'local' in Object mode */
+      /* No break we define 'normal' as 'local' in Object mode. */
       ATTR_FALLTHROUGH;
     }
     case V3D_ORIENT_LOCAL: {
@@ -552,10 +548,14 @@ short ED_transform_calc_orientation_from_type_ex(const bContext *C,
         else {
           transform_orientations_create_from_axis(r_mat, UNPACK3(ob->obmat));
         }
-        return V3D_ORIENT_LOCAL;
+        break;
       }
+      /* If not local, fall through to global. */
+      ATTR_FALLTHROUGH;
+    }
+    case V3D_ORIENT_GLOBAL: {
       unit_m3(r_mat);
-      return V3D_ORIENT_GLOBAL;
+      break;
     }
     case V3D_ORIENT_VIEW: {
       if (rv3d != NULL) {
@@ -565,11 +565,11 @@ short ED_transform_calc_orientation_from_type_ex(const bContext *C,
       else {
         unit_m3(r_mat);
       }
-      return V3D_ORIENT_VIEW;
+      break;
     }
     case V3D_ORIENT_CURSOR: {
       BKE_scene_cursor_rot_to_mat3(&scene->cursor, r_mat);
-      return V3D_ORIENT_CURSOR;
+      break;
     }
     case V3D_ORIENT_CUSTOM_MATRIX: {
       /* Do nothing. */;



More information about the Bf-blender-cvs mailing list