From ba711824b3aec2ab4678e50f15b75cd417f56a70 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Sat, 30 May 2020 18:11:36 -0300 Subject: Fix T77206: G + MMB Doesn't work in Graph Editor if the transform orientation is set to 'Local' Scene orientation is used only for 3DView. --- .../blender/editors/transform/transform_generics.c | 14 +++++--- .../editors/transform/transform_orientations.c | 40 ++++++++++++---------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index b1e69dde0ac..a16bc038902 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1649,13 +1649,17 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } { - TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT]; short orient_type_set = -1; short orient_type_matrix_set = -1; - short orient_type_scene = orient_slot->type; - if (orient_type_scene == V3D_ORIENT_CUSTOM) { - const int index_custom = orient_slot->index_custom; - orient_type_scene += index_custom; + short orient_type_scene = V3D_ORIENT_GLOBAL; + + if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { + TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT]; + orient_type_scene = orient_slot->type; + if (orient_type_scene == V3D_ORIENT_CUSTOM) { + const int index_custom = orient_slot->index_custom; + orient_type_scene += index_custom; + } } short orient_types[3]; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index d0d04793eae..70060b5812b 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -552,28 +552,30 @@ short transform_orientation_matrix_get(bContext *C, return V3D_ORIENT_CUSTOM_MATRIX; } - Object *ob = CTX_data_active_object(C); - Object *obedit = CTX_data_active_object(C); - RegionView3D *rv3d = NULL; - int orientation_index_custom = 0; - if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { - rv3d = t->region->regiondata; - } - if (orientation >= V3D_ORIENT_CUSTOM) { - orientation_index_custom = orientation - V3D_ORIENT_CUSTOM; + Object *ob = CTX_data_active_object(C); + Object *obedit = CTX_data_active_object(C); + RegionView3D *rv3d = t->region->regiondata; + int orientation_index_custom = 0; + + if (orientation >= V3D_ORIENT_CUSTOM) { + orientation_index_custom = orientation - V3D_ORIENT_CUSTOM; + } + + return ED_transform_calc_orientation_from_type_ex(C, + r_spacemtx, + /* extra args (can be accessed from context) */ + t->scene, + rv3d, + ob, + obedit, + orientation, + orientation_index_custom, + t->around); } - return ED_transform_calc_orientation_from_type_ex(C, - r_spacemtx, - /* extra args (can be accessed from context) */ - t->scene, - rv3d, - ob, - obedit, - 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) -- cgit v1.2.3