Transform: use the scenes transform orientation

- Use the user orientation when pressing XYZ keys,
  second press switches to global.
- Pressing again switches to global, or local
  if you're have global orientation set.

The option for gizmos to have their own orientations will be added,
see: D4075
This commit is contained in:
Campbell Barton 2018-12-19 20:44:14 +11:00
parent a246604937
commit 231ea39ed1
Notes: blender-bot 2023-02-14 05:36:11 +01:00
Referenced by issue #64613, Transforming along an axis in an alternative orientation while in edit mode is broken (it ignores user settings)
2 changed files with 7 additions and 6 deletions

View File

@ -1381,15 +1381,15 @@ int transformEvent(TransInfo *t, const wmEvent *event)
}
else {
if (event->shift) {
initSelectConstraint(t, t->spacemtx);
}
else {
/* bit hackish... but it prevents mmb select to print the orientation from menu */
float mati[3][3];
strcpy(t->spacename, "global");
unit_m3(mati);
initSelectConstraint(t, mati);
}
else {
initSelectConstraint(t, t->spacemtx);
}
postSelectConstraint(t);
}
}

View File

@ -1408,13 +1408,14 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->orientation.index = 0;
ARRAY_SET_ITEMS(
t->orientation.types,
NULL,
&t->orientation.user);
&t->orientation.user,
NULL);
/* Make second orientation local if both are global. */
if (t->orientation.user == V3D_MANIP_GLOBAL) {
t->orientation.user_alt = V3D_MANIP_LOCAL;
t->orientation.types[1] = &t->orientation.user_alt;
t->orientation.types[0] = &t->orientation.user_alt;
SWAP(short *, t->orientation.types[0], t->orientation.types[1]);
}
/* exceptional case */