From a69983f30e3fd342a605910fa81ae72c25869ff0 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Mon, 1 Feb 2021 11:16:49 -0300 Subject: 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. --- .../editors/transform/transform_orientations.c | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) 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. */; -- cgit v1.2.3