Transform: Don't negate the z axis of the View orientation

This was so because of the rotate transformation mode but it can make
other modes confusing and add unnecessary complexity.
This commit is contained in:
Germano Cavalcante 2020-05-20 16:22:28 -03:00
parent 600fd1c6f0
commit 8bff3ec76b
5 changed files with 8 additions and 9 deletions

View File

@ -679,10 +679,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
break;
case V3D_ORIENT_VIEW:
BLI_snprintf(text, sizeof(text), ftext, TIP_("view"));
float mtx[3][3];
copy_m3_m3(mtx, t->spacemtx);
negate_v3(mtx[2]);
setConstraint(t, mtx, mode, text);
setConstraint(t, t->spacemtx, mode, text);
break;
case V3D_ORIENT_CURSOR:
BLI_snprintf(text, sizeof(text), ftext, TIP_("cursor"));

View File

@ -1404,7 +1404,7 @@ void drawDial3d(const TransInfo *t)
}
else {
axis_idx = MAN_AXIS_ROT_C;
negate_v3_v3(mat_basis[2], t->spacemtx[t->orient_axis]);
copy_v3_v3(mat_basis[2], t->spacemtx[t->orient_axis]);
scale *= 1.2f;
line_with -= 1.0f;
}

View File

@ -146,7 +146,8 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
snapGridIncrement(t, &final);
float axis_final[3];
copy_v3_v3(axis_final, t->spacemtx[t->orient_axis]);
/* Use the negative axis to match the default Z axis of the view matrix. */
negate_v3_v3(axis_final, t->spacemtx[t->orient_axis]);
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
t->con.applyRot(t, NULL, NULL, axis_final, NULL);

View File

@ -58,12 +58,12 @@ static void initShear_mouseInputMode(TransInfo *t)
/* Needed for axis aligned view gizmo. */
if (t->orientation.types[t->orientation.index] == V3D_ORIENT_VIEW) {
if (t->orient_axis_ortho == 0) {
if (t->center2d[1] < t->mouse.imval[1]) {
if (t->center2d[1] > t->mouse.imval[1]) {
dir_flip = !dir_flip;
}
}
else if (t->orient_axis_ortho == 1) {
if (t->center2d[0] < t->mouse.imval[0]) {
if (t->center2d[0] > t->mouse.imval[0]) {
dir_flip = !dir_flip;
}
}

View File

@ -486,7 +486,6 @@ void initTransformOrientation(bContext *C, TransInfo *t, short orientation)
else {
unit_m3(mat);
}
negate_v3(mat[2]);
copy_m3_m3(t->spacemtx, mat);
break;
}
@ -511,6 +510,8 @@ void initTransformOrientation(bContext *C, TransInfo *t, short orientation)
}
break;
}
invert_m3_m3(t->spacemtx_inv, t->spacemtx);
}
/**