Fix T76504: Change in behavior of constraints orientation

The Extrude operator, whose orientation is NORMAL, has undergone some seemingly accidental changes:
- In 2.79 if you press the same key as the axis in constraint, it changes from Normal to No Contraint -> Global -> Normal and repeat this.
- In 2.80 it changes from Normal to Local -> No Contraint -> Global -> Local and repeat this.

This committee resumes the behavior of 2.79
This commit is contained in:
Germano Cavalcante 2020-05-07 15:49:10 -03:00
parent ab122c73ba
commit 2f63e47931
Notes: blender-bot 2023-02-14 11:18:07 +01:00
Referenced by commit b026965f80, Revert "Fix T76504: Change in behavior of constraints orientation"
Referenced by issue #76647, transform orientation always uses global.  Ignores any other setting (local, normal, gimbal etc)
Referenced by issue #76504, Extrusion doesn't take in account the current transform orientation
2 changed files with 17 additions and 5 deletions

View File

@ -825,11 +825,15 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, bool is
}
}
else if (!edit_2d) {
if (ELEM(cmode, '\0', axis)) {
if (cmode == axis) {
/* Successive presses on existing axis, cycle orientation modes. */
t->orientation.index = (t->orientation.index + 1) % ARRAY_SIZE(t->orientation.types);
initTransformOrientation(t->context, t, t->orientation.types[t->orientation.index]);
}
else if (t->orientation.index != 1) {
t->orientation.index = 1;
initTransformOrientation(t->context, t, t->orientation.types[t->orientation.index]);
}
if (t->orientation.index == 0) {
stopConstraint(t);

View File

@ -1681,13 +1681,21 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
t->orientation.types[0] = orient_type_default;
t->orientation.types[1] = orient_type_constraint;
t->orientation.types[2] = orient_type_constraint != V3D_ORIENT_GLOBAL ? V3D_ORIENT_GLOBAL :
V3D_ORIENT_LOCAL;
t->orientation.custom = custom_orientation;
/* To keep the old behavior logic to init contraint orientarions became this: */
t->orientation.types[1] = V3D_ORIENT_GLOBAL;
t->orientation.types[2] = orient_type_constraint != V3D_ORIENT_GLOBAL ?
orient_type_constraint :
V3D_ORIENT_LOCAL;
if (t->con.mode & CON_APPLY) {
t->orientation.index = 1;
if (orient_type_constraint == V3D_ORIENT_GLOBAL) {
t->orientation.index = 1;
}
else {
t->orientation.index = 2;
}
}
}