[Bf-blender-cvs] [dba0b84359e] master: Cleanup: Simplify transform_orientation_matrix_get
Germano Cavalcante
noreply at git.blender.org
Thu Oct 8 18:39:49 CEST 2020
Commit: dba0b84359e47b374647e10fa6ae72dd6a9f4528
Author: Germano Cavalcante
Date: Thu Oct 8 11:20:06 2020 -0300
Branches: master
https://developer.blender.org/rBdba0b84359e47b374647e10fa6ae72dd6a9f4528
Cleanup: Simplify transform_orientation_matrix_get
This simplifies obtaining the parameters for internal functions.
(switch was complicating a little)
Also removes ureachable code.
===================================================================
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 548c1042682..eabc5ede993 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -537,41 +537,24 @@ short ED_transform_calc_orientation_from_type_ex(const bContext *C,
short transform_orientation_matrix_get(
bContext *C, TransInfo *t, short orientation, const float custom[3][3], float r_spacemtx[3][3])
{
- Object *ob = NULL;
- Object *obedit = NULL;
- Scene *scene = NULL;
- RegionView3D *rv3d = NULL;
- int orientation_index_custom = 0;
-
if (orientation == V3D_ORIENT_CUSTOM_MATRIX) {
copy_m3_m3(r_spacemtx, custom);
return V3D_ORIENT_CUSTOM_MATRIX;
}
+ Object *ob = CTX_data_active_object(C);
+ Object *obedit = CTX_data_edit_object(C);
+ Scene *scene = t->scene;
+ RegionView3D *rv3d = NULL;
+ int orientation_index_custom = 0;
+
if (orientation >= V3D_ORIENT_CUSTOM) {
orientation_index_custom = orientation - V3D_ORIENT_CUSTOM;
orientation = V3D_ORIENT_CUSTOM;
}
- switch (orientation) {
- case V3D_ORIENT_GIMBAL:
- case V3D_ORIENT_LOCAL:
- case V3D_ORIENT_NORMAL:
- ob = CTX_data_active_object(C);
- obedit = CTX_data_edit_object(C);
- break;
- case V3D_ORIENT_VIEW:
- if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
- rv3d = t->region->regiondata;
- }
- break;
- case V3D_ORIENT_CURSOR:
- case V3D_ORIENT_CUSTOM:
- scene = t->scene;
- break;
- case V3D_ORIENT_GLOBAL:
- case V3D_ORIENT_CUSTOM_MATRIX:
- default:
- break;
+
+ if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
+ rv3d = t->region->regiondata;
}
return ED_transform_calc_orientation_from_type_ex(C,
@@ -584,9 +567,6 @@ short transform_orientation_matrix_get(
orientation,
orientation_index_custom,
t->around);
-
- unit_m3(r_spacemtx);
- return V3D_ORIENT_GLOBAL;
}
const char *transform_orientations_spacename_get(TransInfo *t, const short orient_type)
More information about the Bf-blender-cvs
mailing list