Fix transform plane constraint orientation cycle

Regression since 2.79b release
This commit is contained in:
Campbell Barton
2018-07-10 06:51:25 +02:00
parent 8c528a4f0a
commit f51c6efbc1

View File

@@ -895,7 +895,7 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf)
return keymap;
}
static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cmode)
static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cmode, bool is_plane)
{
if (!(t->flag & T_NO_CONSTRAINT)) {
int constraint_axis, constraint_plane;
@@ -948,17 +948,21 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
else {
short orientation = (t->current_orientation != V3D_MANIP_GLOBAL ?
t->current_orientation : V3D_MANIP_LOCAL);
if (!(t->modifiers & MOD_CONSTRAINT_PLANE))
if (is_plane == false) {
setUserConstraint(t, orientation, constraint_axis, msg2);
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
}
else {
setUserConstraint(t, orientation, constraint_plane, msg3);
}
}
}
else {
if (!(t->modifiers & MOD_CONSTRAINT_PLANE))
if (is_plane == false) {
setUserConstraint(t, V3D_MANIP_GLOBAL, constraint_axis, msg2);
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
}
else {
setUserConstraint(t, V3D_MANIP_GLOBAL, constraint_plane, msg3);
}
}
}
t->redraw |= TREDRAW_HARD;
@@ -1136,57 +1140,42 @@ int transformEvent(TransInfo *t, const wmEvent *event)
break;
case TFM_MODAL_AXIS_X:
if (!(t->flag & T_NO_CONSTRAINT)) {
transform_event_xyz_constraint(t, XKEY, cmode);
transform_event_xyz_constraint(t, XKEY, cmode, false);
t->redraw |= TREDRAW_HARD;
handled = true;
}
break;
case TFM_MODAL_AXIS_Y:
if ((t->flag & T_NO_CONSTRAINT) == 0) {
transform_event_xyz_constraint(t, YKEY, cmode);
transform_event_xyz_constraint(t, YKEY, cmode, false);
t->redraw |= TREDRAW_HARD;
handled = true;
}
break;
case TFM_MODAL_AXIS_Z:
if ((t->flag & (T_NO_CONSTRAINT)) == 0) {
transform_event_xyz_constraint(t, ZKEY, cmode);
transform_event_xyz_constraint(t, ZKEY, cmode, false);
t->redraw |= TREDRAW_HARD;
handled = true;
}
break;
case TFM_MODAL_PLANE_X:
if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) {
if (cmode == 'X') {
stopConstraint(t);
}
else {
setUserConstraint(t, t->current_orientation, (CON_AXIS1 | CON_AXIS2), IFACE_("locking %s X"));
}
transform_event_xyz_constraint(t, XKEY, cmode, true);
t->redraw |= TREDRAW_HARD;
handled = true;
}
break;
case TFM_MODAL_PLANE_Y:
if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) {
if (cmode == 'Y') {
stopConstraint(t);
}
else {
setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS2), IFACE_("locking %s Y"));
}
transform_event_xyz_constraint(t, YKEY, cmode, true);
t->redraw |= TREDRAW_HARD;
handled = true;
}
break;
case TFM_MODAL_PLANE_Z:
if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) {
if (cmode == 'Z') {
stopConstraint(t);
}
else {
setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS1), IFACE_("locking %s Z"));
}
transform_event_xyz_constraint(t, ZKEY, cmode, true);
t->redraw |= TREDRAW_HARD;
handled = true;
}