Fix T96728: 'Automatic Constraint' using the wrong orientation

If the `Automatic Constraint` modifier was activated while an axis
constraint was already set, the orientation used would be the default
orientation of the mode and not that of the scene.

This was because the `initSelectConstraint` function was not called in
this case and the `Automatic Constraint` mode was enabled by other
indirect means

So the solution is to call `initSelectConstraint` in either case and
remove these "indirect means" of enabling `Automatic Constraint`.
This commit is contained in:
Germano Cavalcante 2022-03-23 12:19:30 -03:00
parent e25238e146
commit 6cc83f9079
Notes: blender-bot 2023-02-14 03:21:27 +01:00
Referenced by commit 827e9ccb29, Revert "Fix T96728: 'Automatic Constraint' using the wrong orientation"
Referenced by issue #96728, axis constrain in local mode only works the first time
2 changed files with 3 additions and 20 deletions

View File

@ -845,10 +845,6 @@ int transformEvent(TransInfo *t, const wmEvent *event)
handled = true;
}
else if (event->type == MOUSEMOVE) {
if (t->modifiers & (MOD_CONSTRAINT_SELECT_AXIS | MOD_CONSTRAINT_SELECT_PLANE)) {
t->con.mode |= CON_SELECT;
}
copy_v2_v2_int(t->mval, event->mval);
/* Use this for soft redraw. Might cause flicker in object mode */
@ -1116,10 +1112,8 @@ int transformEvent(TransInfo *t, const wmEvent *event)
if (t->con.mode & CON_APPLY) {
stopConstraint(t);
}
else {
initSelectConstraint(t);
postSelectConstraint(t);
}
initSelectConstraint(t);
}
}
t->redraw |= TREDRAW_HARD;

View File

@ -984,6 +984,7 @@ void initSelectConstraint(TransInfo *t)
}
setUserConstraint(t, CON_APPLY | CON_SELECT, "%s");
selectConstraint(t);
}
void selectConstraint(TransInfo *t)
@ -996,19 +997,7 @@ void selectConstraint(TransInfo *t)
void postSelectConstraint(TransInfo *t)
{
if (!(t->con.mode & CON_SELECT)) {
return;
}
t->con.mode &= ~CON_AXIS0;
t->con.mode &= ~CON_AXIS1;
t->con.mode &= ~CON_AXIS2;
t->con.mode &= ~CON_SELECT;
setNearestAxis(t);
startConstraint(t);
t->redraw = TREDRAW_HARD;
}
static void setNearestAxis2d(TransInfo *t)