Skip to content

Commit

Permalink
Fix T77206: G + MMB Doesn't work in Graph Editor if the transform ori…
Browse files Browse the repository at this point in the history
…entation is set to 'Local'

Scene orientation is used only for 3DView.
  • Loading branch information
Germano Cavalcante committed May 30, 2020
1 parent 347c191 commit ba71182
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
14 changes: 9 additions & 5 deletions source/blender/editors/transform/transform_generics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
40 changes: 21 additions & 19 deletions source/blender/editors/transform/transform_orientations.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ba71182

Please sign in to comment.