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.
This commit is contained in:
2020-05-30 18:11:36 -03:00
parent 347c191292
commit ba711824b3
2 changed files with 30 additions and 24 deletions

View File

@@ -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_set = -1;
short orient_type_matrix_set = -1; short orient_type_matrix_set = -1;
short orient_type_scene = orient_slot->type; short orient_type_scene = V3D_ORIENT_GLOBAL;
if (orient_type_scene == V3D_ORIENT_CUSTOM) {
const int index_custom = orient_slot->index_custom; if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
orient_type_scene += index_custom; 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]; short orient_types[3];

View File

@@ -552,28 +552,30 @@ short transform_orientation_matrix_get(bContext *C,
return V3D_ORIENT_CUSTOM_MATRIX; 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)) { if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
rv3d = t->region->regiondata; Object *ob = CTX_data_active_object(C);
} Object *obedit = CTX_data_active_object(C);
if (orientation >= V3D_ORIENT_CUSTOM) { RegionView3D *rv3d = t->region->regiondata;
orientation_index_custom = orientation - V3D_ORIENT_CUSTOM; 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, unit_m3(r_spacemtx);
r_spacemtx, return V3D_ORIENT_GLOBAL;
/* extra args (can be accessed from context) */
t->scene,
rv3d,
ob,
obedit,
orientation,
orientation_index_custom,
t->around);
} }
const char *transform_orientations_spacename_get(TransInfo *t, const short orient_type) const char *transform_orientations_spacename_get(TransInfo *t, const short orient_type)