Individual Element (object) center for Rotate and Resize. Note that using this in edit mode is a bit useless right now, but we have some surprises in our bozo bin :P
Transform can switch mode on the fly again (GRS). Fixed a bug with the BIF constraint call, needed to call startConstraint and normalise the space matrix (this affected the manipulator).
This commit is contained in:
@@ -930,9 +930,7 @@ static void ObjectToTransData(TransData *td, Object *ob)
|
||||
VECCOPY(td->center, ob->obmat[3]);
|
||||
|
||||
Mat3CpyMat4(td->axismtx, ob->obmat);
|
||||
Normalise(td->axismtx[0]);
|
||||
Normalise(td->axismtx[1]);
|
||||
Normalise(td->axismtx[2]);
|
||||
Mat3Ortho(td->axismtx);
|
||||
|
||||
if (ob->parent)
|
||||
{
|
||||
@@ -1403,12 +1401,22 @@ void Transform(int mode)
|
||||
ret_val = TRANS_CONFIRM;
|
||||
break;
|
||||
case GKEY:
|
||||
case SKEY:
|
||||
case RKEY:
|
||||
if (G.qual == LR_CTRLKEY)
|
||||
applyTransObjects(&Trans);
|
||||
else
|
||||
restoreTransObjects(&Trans);
|
||||
initTransModeFlags(&Trans, TFM_TRANSLATION);
|
||||
initTranslation(&Trans);
|
||||
Trans.redraw = 1;
|
||||
break;
|
||||
case SKEY:
|
||||
restoreTransObjects(&Trans);
|
||||
initTransModeFlags(&Trans, TFM_RESIZE);
|
||||
initResize(&Trans);
|
||||
Trans.redraw = 1;
|
||||
break;
|
||||
case RKEY:
|
||||
restoreTransObjects(&Trans);
|
||||
initTransModeFlags(&Trans, TFM_ROTATION);
|
||||
initRotation(&Trans);
|
||||
Trans.redraw = 1;
|
||||
break;
|
||||
case XKEY:
|
||||
if (cmode == 'X') {
|
||||
@@ -1994,6 +2002,10 @@ int Resize(TransInfo *t, short mval[2])
|
||||
t->con.applySize(t, td, tmat);
|
||||
}
|
||||
|
||||
if (G.vd->around == V3D_LOCAL) {
|
||||
VECCOPY(t->center, td->center);
|
||||
}
|
||||
|
||||
if (td->ext) {
|
||||
float fsize[3];
|
||||
|
||||
@@ -2249,6 +2261,10 @@ int Rotation(TransInfo *t, short mval[2])
|
||||
VecRotToMat3(axis, final * td->factor, mat);
|
||||
}
|
||||
|
||||
if (G.vd->around == V3D_LOCAL) {
|
||||
VECCOPY(t->center, td->center);
|
||||
}
|
||||
|
||||
if (t->flag & T_EDIT) {
|
||||
Mat3MulMat3(totmat, mat, td->mtx);
|
||||
Mat3MulMat3(smat, td->smtx, totmat);
|
||||
|
||||
@@ -590,10 +590,14 @@ void BIF_setSingleAxisConstraint(float vec[3]) {
|
||||
Crossf(space[1], vec, v);
|
||||
Crossf(space[2], vec, space[1]);
|
||||
|
||||
Mat3Ortho(space);
|
||||
|
||||
Mat3CpyMat3(t->con.mtx, space);
|
||||
t->con.mode = (CON_AXIS0|CON_APPLY);
|
||||
getConstraintMatrix(t);
|
||||
|
||||
startConstraint(t);
|
||||
|
||||
t->con.drawExtra = NULL;
|
||||
t->con.applyVec = applyAxisConstraintVec;
|
||||
t->con.applySize = applyAxisConstraintSize;
|
||||
@@ -609,10 +613,14 @@ void BIF_setDualAxisConstraint(float vec1[3], float vec2[3]) {
|
||||
VECCOPY(space[1], vec2);
|
||||
Crossf(space[2], space[0], space[1]);
|
||||
|
||||
Mat3Ortho(space);
|
||||
|
||||
Mat3CpyMat3(t->con.mtx, space);
|
||||
t->con.mode = (CON_AXIS0|CON_AXIS1|CON_APPLY);
|
||||
getConstraintMatrix(t);
|
||||
|
||||
startConstraint(t);
|
||||
|
||||
t->con.drawExtra = NULL;
|
||||
t->con.applyVec = applyAxisConstraintVec;
|
||||
t->con.applySize = applyAxisConstraintSize;
|
||||
|
||||
@@ -336,10 +336,12 @@ void drawLine(float *center, float *dir, char axis, short options)
|
||||
glColor3ubv(col2);
|
||||
|
||||
setlinestyle(0);
|
||||
glLineWidth(3.0);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex3fv(v1);
|
||||
glVertex3fv(v2);
|
||||
glEnd();
|
||||
glLineWidth(1.0);
|
||||
|
||||
myloadmatrix(G.vd->viewmat);
|
||||
}
|
||||
@@ -474,11 +476,7 @@ static void restore_ipokey(float *poin, float *old)
|
||||
}
|
||||
}
|
||||
|
||||
void restoreTransObjects(TransInfo *t)
|
||||
{
|
||||
TransData *td;
|
||||
|
||||
for (td = t->data; td < t->data + t->total; td++) {
|
||||
void restoreElement(TransData *td) {
|
||||
VECCOPY(td->loc, td->iloc);
|
||||
if (td->val) {
|
||||
*td->val = td->ival;
|
||||
@@ -511,7 +509,14 @@ void restoreTransObjects(TransInfo *t)
|
||||
restore_ipokey(tdi->sizey, tdi->oldsize+1);
|
||||
restore_ipokey(tdi->sizez, tdi->oldsize+2);
|
||||
}
|
||||
}
|
||||
|
||||
void restoreTransObjects(TransInfo *t)
|
||||
{
|
||||
TransData *td;
|
||||
|
||||
for (td = t->data; td < t->data + t->total; td++) {
|
||||
restoreElement(td);
|
||||
}
|
||||
recalcData(t);
|
||||
}
|
||||
@@ -673,7 +678,7 @@ void calculatePropRatio(TransInfo *t)
|
||||
*/
|
||||
td->flag |= TD_NOACTION;
|
||||
td->factor = 0.0f;
|
||||
break;
|
||||
restoreElement(td);
|
||||
}
|
||||
else {
|
||||
td->flag &= ~TD_NOACTION;
|
||||
@@ -693,6 +698,7 @@ void calculatePropRatio(TransInfo *t)
|
||||
break;
|
||||
case PROP_CONST:
|
||||
td->factor = 1;
|
||||
//td->factor = (float)sqrt(2*dist - dist * dist);
|
||||
break;
|
||||
default:
|
||||
td->factor = 1;
|
||||
@@ -713,6 +719,7 @@ void calculatePropRatio(TransInfo *t)
|
||||
strcpy(t->proptext, "(Linear)");
|
||||
break;
|
||||
case PROP_CONST:
|
||||
//strcpy(t->proptext, "(Sphere)");
|
||||
strcpy(t->proptext, "(Constant)");
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user