Transform: use bool when local matrix is needed

Existing code checked pose/edit mode to check for transforming in an
objects local space.

This added many similar checks all over the code,
which leads to confusion.
Multi-edit caused a regression in UV transform since where UV's
had the object matrix applied by accident.

Now there is a boolean to use a local matrix,
this allows for any mode to have a 4x4 matrix
applied w/o adding mode specific checks everywhere.
This commit is contained in:
2018-05-04 14:41:51 +02:00
parent 90e61275d3
commit 844a17a3d9
5 changed files with 71 additions and 78 deletions

View File

@@ -430,7 +430,7 @@ static void applyObjectConstraintVec(
mul_m3_v3(td->axismtx, out);
if (t->flag & T_EDIT) {
mul_m3_v3(tc->obedit_mat, out);
mul_m3_v3(tc->mat3_unit, out);
}
}
}
@@ -486,7 +486,7 @@ static void applyObjectConstraintSize(
mul_m3_m3m3(tmat, smat, imat);
if (t->flag & T_EDIT) {
mul_m3_m3m3(smat, tc->obedit_mat, smat);
mul_m3_m3m3(smat, tc->mat3_unit, smat);
}
mul_m3_m3m3(smat, td->axismtx, tmat);
}
@@ -562,7 +562,7 @@ static void applyObjectConstraintRot(
}
if (t->flag & T_EDIT) {
mul_m3_m3m3(tmp_axismtx, tc->obedit_mat, td->axismtx);
mul_m3_m3m3(tmp_axismtx, tc->mat3_unit, td->axismtx);
axismtx = tmp_axismtx;
}
else {
@@ -616,7 +616,7 @@ void setAxisMatrixConstraint(TransInfo *t, int mode, const char text[])
if (t->data_len_all == 1) {
float axismtx[3][3];
if (t->flag & T_EDIT) {
mul_m3_m3m3(axismtx, tc->obedit_mat, tc->data->axismtx);
mul_m3_m3m3(axismtx, tc->mat3_unit, tc->data->axismtx);
}
else {
copy_m3_m3(axismtx, tc->data->axismtx);
@@ -646,7 +646,7 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[])
if (t->flag & T_EDIT) {
/* Use the active (first) edit object. */
TransDataContainer *tc = t->data_container;
setConstraint(t, tc->obedit_mat, mode, text);
setConstraint(t, tc->mat3_unit, mode, text);
}
else {
setAxisMatrixConstraint(t, mode, text);
@@ -872,13 +872,13 @@ static void drawObjectConstraint(TransInfo *t)
axismtx = td->axismtx;
}
else if (t->flag & T_EDIT) {
mul_v3_m4v3(co, tc->obedit->obmat, td->center);
mul_v3_m4v3(co, tc->mat, td->center);
mul_m3_m3m3(tmp_axismtx, tc->obedit_mat, td->axismtx);
mul_m3_m3m3(tmp_axismtx, tc->mat3_unit, td->axismtx);
axismtx = tmp_axismtx;
}
else if (t->flag & T_POSE) {
mul_v3_m4v3(co, tc->poseobj->obmat, td->center);
mul_v3_m4v3(co, tc->mat, td->center);
axismtx = td->axismtx;
}
else {