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.
This commit is contained in:
Germano Cavalcante 2021-02-01 11:16:49 -03:00
parent 9e9ebaba8d
commit a69983f30e
Notes: blender-bot 2024-04-11 14:26:06 +02:00
Referenced by issue #85229, Enabling Normal option for Orientation not working
1 changed files with 12 additions and 12 deletions

View File

@ -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. */;