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,14 +1649,18 @@ 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 ((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) { if (orient_type_scene == V3D_ORIENT_CUSTOM) {
const int index_custom = orient_slot->index_custom; const int index_custom = orient_slot->index_custom;
orient_type_scene += index_custom; orient_type_scene += index_custom;
} }
}
short orient_types[3]; short orient_types[3];
float custom_matrix[3][3]; float custom_matrix[3][3];

View File

@@ -552,14 +552,12 @@ short transform_orientation_matrix_get(bContext *C,
return V3D_ORIENT_CUSTOM_MATRIX; return V3D_ORIENT_CUSTOM_MATRIX;
} }
if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
Object *ob = CTX_data_active_object(C); Object *ob = CTX_data_active_object(C);
Object *obedit = CTX_data_active_object(C); Object *obedit = CTX_data_active_object(C);
RegionView3D *rv3d = NULL; RegionView3D *rv3d = t->region->regiondata;
int orientation_index_custom = 0; 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) { if (orientation >= V3D_ORIENT_CUSTOM) {
orientation_index_custom = orientation - V3D_ORIENT_CUSTOM; orientation_index_custom = orientation - V3D_ORIENT_CUSTOM;
} }
@@ -576,6 +574,10 @@ short transform_orientation_matrix_get(bContext *C,
t->around); t->around);
} }
unit_m3(r_spacemtx);
return V3D_ORIENT_GLOBAL;
}
const char *transform_orientations_spacename_get(TransInfo *t, const short orient_type) const char *transform_orientations_spacename_get(TransInfo *t, const short orient_type)
{ {
switch (orient_type) { switch (orient_type) {