diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-10-08 17:20:06 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-10-08 19:39:41 +0300 |
commit | dba0b84359e47b374647e10fa6ae72dd6a9f4528 (patch) | |
tree | 49cf47e8c07b179b1e3a0cfdcd291d9c3344bff8 /source | |
parent | 043ddcf3ad3bdcba2c980af76202bc6f177f4b0d (diff) |
Cleanup: Simplify transform_orientation_matrix_get
This simplifies obtaining the parameters for internal functions.
(switch was complicating a little)
Also removes ureachable code.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 38 |
1 files changed, 9 insertions, 29 deletions
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) |