Fix T80937: Changing the contrain axis does not return to the scene orientation

This was the behavior in old versions of blender.

During a transformation operation, when pressing a contrain key, the chosen
orientation is that of the scene.

If you press the same key, the orientation changes to Global or Local.

However, if you choose another contrain axis with the orientation changed,
the orientation does not return to the set for the scene.

It remains Global or Local.

Now when changing a contrain axis, no matter what the current orientation is,
it always returns to the scene orientation.
This commit is contained in:
2020-09-24 19:16:41 -03:00
parent d5a6b3b18c
commit 388b916246
6 changed files with 95 additions and 85 deletions

View File

@@ -686,9 +686,15 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[])
* ftext is a format string passed to BLI_snprintf. It will add the name of
* the orientation where %s is (logically).
*/
void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[])
void setUserConstraint(TransInfo *t, int mode, const char ftext[])
{
char text[256];
short orientation = t->orient[t->orient_curr].type;
if (orientation == V3D_ORIENT_CUSTOM_MATRIX) {
/* Use the real value of the "orient_type". */
orientation = t->orient[0].type;
}
const char *spacename = transform_orientations_spacename_get(t, orientation);
BLI_snprintf(text, sizeof(text), ftext, spacename);
@@ -943,12 +949,10 @@ void stopConstraint(TransInfo *t)
void initSelectConstraint(TransInfo *t)
{
if (t->orient_curr == 0) {
t->orient_curr = 1;
transform_orientations_current_set(t, t->orient_curr);
transform_orientations_current_set(t, 1);
}
short orientation = t->orient[t->orient_curr].type;
setUserConstraint(t, orientation, CON_APPLY | CON_SELECT, "%s");
setUserConstraint(t, CON_APPLY | CON_SELECT, "%s");
setNearestAxis(t);
}