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]);
|
VECCOPY(td->center, ob->obmat[3]);
|
||||||
|
|
||||||
Mat3CpyMat4(td->axismtx, ob->obmat);
|
Mat3CpyMat4(td->axismtx, ob->obmat);
|
||||||
Normalise(td->axismtx[0]);
|
Mat3Ortho(td->axismtx);
|
||||||
Normalise(td->axismtx[1]);
|
|
||||||
Normalise(td->axismtx[2]);
|
|
||||||
|
|
||||||
if (ob->parent)
|
if (ob->parent)
|
||||||
{
|
{
|
||||||
@@ -1403,12 +1401,22 @@ void Transform(int mode)
|
|||||||
ret_val = TRANS_CONFIRM;
|
ret_val = TRANS_CONFIRM;
|
||||||
break;
|
break;
|
||||||
case GKEY:
|
case GKEY:
|
||||||
|
restoreTransObjects(&Trans);
|
||||||
|
initTransModeFlags(&Trans, TFM_TRANSLATION);
|
||||||
|
initTranslation(&Trans);
|
||||||
|
Trans.redraw = 1;
|
||||||
|
break;
|
||||||
case SKEY:
|
case SKEY:
|
||||||
|
restoreTransObjects(&Trans);
|
||||||
|
initTransModeFlags(&Trans, TFM_RESIZE);
|
||||||
|
initResize(&Trans);
|
||||||
|
Trans.redraw = 1;
|
||||||
|
break;
|
||||||
case RKEY:
|
case RKEY:
|
||||||
if (G.qual == LR_CTRLKEY)
|
restoreTransObjects(&Trans);
|
||||||
applyTransObjects(&Trans);
|
initTransModeFlags(&Trans, TFM_ROTATION);
|
||||||
else
|
initRotation(&Trans);
|
||||||
restoreTransObjects(&Trans);
|
Trans.redraw = 1;
|
||||||
break;
|
break;
|
||||||
case XKEY:
|
case XKEY:
|
||||||
if (cmode == 'X') {
|
if (cmode == 'X') {
|
||||||
@@ -1994,6 +2002,10 @@ int Resize(TransInfo *t, short mval[2])
|
|||||||
t->con.applySize(t, td, tmat);
|
t->con.applySize(t, td, tmat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (G.vd->around == V3D_LOCAL) {
|
||||||
|
VECCOPY(t->center, td->center);
|
||||||
|
}
|
||||||
|
|
||||||
if (td->ext) {
|
if (td->ext) {
|
||||||
float fsize[3];
|
float fsize[3];
|
||||||
|
|
||||||
@@ -2249,6 +2261,10 @@ int Rotation(TransInfo *t, short mval[2])
|
|||||||
VecRotToMat3(axis, final * td->factor, mat);
|
VecRotToMat3(axis, final * td->factor, mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (G.vd->around == V3D_LOCAL) {
|
||||||
|
VECCOPY(t->center, td->center);
|
||||||
|
}
|
||||||
|
|
||||||
if (t->flag & T_EDIT) {
|
if (t->flag & T_EDIT) {
|
||||||
Mat3MulMat3(totmat, mat, td->mtx);
|
Mat3MulMat3(totmat, mat, td->mtx);
|
||||||
Mat3MulMat3(smat, td->smtx, totmat);
|
Mat3MulMat3(smat, td->smtx, totmat);
|
||||||
|
|||||||
@@ -590,10 +590,14 @@ void BIF_setSingleAxisConstraint(float vec[3]) {
|
|||||||
Crossf(space[1], vec, v);
|
Crossf(space[1], vec, v);
|
||||||
Crossf(space[2], vec, space[1]);
|
Crossf(space[2], vec, space[1]);
|
||||||
|
|
||||||
|
Mat3Ortho(space);
|
||||||
|
|
||||||
Mat3CpyMat3(t->con.mtx, space);
|
Mat3CpyMat3(t->con.mtx, space);
|
||||||
t->con.mode = (CON_AXIS0|CON_APPLY);
|
t->con.mode = (CON_AXIS0|CON_APPLY);
|
||||||
getConstraintMatrix(t);
|
getConstraintMatrix(t);
|
||||||
|
|
||||||
|
startConstraint(t);
|
||||||
|
|
||||||
t->con.drawExtra = NULL;
|
t->con.drawExtra = NULL;
|
||||||
t->con.applyVec = applyAxisConstraintVec;
|
t->con.applyVec = applyAxisConstraintVec;
|
||||||
t->con.applySize = applyAxisConstraintSize;
|
t->con.applySize = applyAxisConstraintSize;
|
||||||
@@ -608,10 +612,14 @@ void BIF_setDualAxisConstraint(float vec1[3], float vec2[3]) {
|
|||||||
VECCOPY(space[0], vec1);
|
VECCOPY(space[0], vec1);
|
||||||
VECCOPY(space[1], vec2);
|
VECCOPY(space[1], vec2);
|
||||||
Crossf(space[2], space[0], space[1]);
|
Crossf(space[2], space[0], space[1]);
|
||||||
|
|
||||||
|
Mat3Ortho(space);
|
||||||
|
|
||||||
Mat3CpyMat3(t->con.mtx, space);
|
Mat3CpyMat3(t->con.mtx, space);
|
||||||
t->con.mode = (CON_AXIS0|CON_AXIS1|CON_APPLY);
|
t->con.mode = (CON_AXIS0|CON_AXIS1|CON_APPLY);
|
||||||
getConstraintMatrix(t);
|
getConstraintMatrix(t);
|
||||||
|
|
||||||
|
startConstraint(t);
|
||||||
|
|
||||||
t->con.drawExtra = NULL;
|
t->con.drawExtra = NULL;
|
||||||
t->con.applyVec = applyAxisConstraintVec;
|
t->con.applyVec = applyAxisConstraintVec;
|
||||||
|
|||||||
@@ -336,10 +336,12 @@ void drawLine(float *center, float *dir, char axis, short options)
|
|||||||
glColor3ubv(col2);
|
glColor3ubv(col2);
|
||||||
|
|
||||||
setlinestyle(0);
|
setlinestyle(0);
|
||||||
|
glLineWidth(3.0);
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
glVertex3fv(v1);
|
glVertex3fv(v1);
|
||||||
glVertex3fv(v2);
|
glVertex3fv(v2);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
glLineWidth(1.0);
|
||||||
|
|
||||||
myloadmatrix(G.vd->viewmat);
|
myloadmatrix(G.vd->viewmat);
|
||||||
}
|
}
|
||||||
@@ -474,44 +476,47 @@ static void restore_ipokey(float *poin, float *old)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void restoreElement(TransData *td) {
|
||||||
|
VECCOPY(td->loc, td->iloc);
|
||||||
|
if (td->val) {
|
||||||
|
*td->val = td->ival;
|
||||||
|
}
|
||||||
|
if (td->ext) {
|
||||||
|
if (td->ext->rot) {
|
||||||
|
VECCOPY(td->ext->rot, td->ext->irot);
|
||||||
|
}
|
||||||
|
if (td->ext->size) {
|
||||||
|
VECCOPY(td->ext->size, td->ext->isize);
|
||||||
|
}
|
||||||
|
if(td->flag & TD_USEQUAT) {
|
||||||
|
if (td->ext->quat) {
|
||||||
|
QUATCOPY(td->ext->quat, td->ext->iquat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(td->tdi) {
|
||||||
|
TransDataIpokey *tdi= td->tdi;
|
||||||
|
|
||||||
|
restore_ipokey(tdi->locx, tdi->oldloc);
|
||||||
|
restore_ipokey(tdi->locy, tdi->oldloc+1);
|
||||||
|
restore_ipokey(tdi->locz, tdi->oldloc+2);
|
||||||
|
|
||||||
|
restore_ipokey(tdi->rotx, tdi->oldrot);
|
||||||
|
restore_ipokey(tdi->roty, tdi->oldrot+1);
|
||||||
|
restore_ipokey(tdi->rotz, tdi->oldrot+2);
|
||||||
|
|
||||||
|
restore_ipokey(tdi->sizex, tdi->oldsize);
|
||||||
|
restore_ipokey(tdi->sizey, tdi->oldsize+1);
|
||||||
|
restore_ipokey(tdi->sizez, tdi->oldsize+2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void restoreTransObjects(TransInfo *t)
|
void restoreTransObjects(TransInfo *t)
|
||||||
{
|
{
|
||||||
TransData *td;
|
TransData *td;
|
||||||
|
|
||||||
for (td = t->data; td < t->data + t->total; td++) {
|
for (td = t->data; td < t->data + t->total; td++) {
|
||||||
VECCOPY(td->loc, td->iloc);
|
restoreElement(td);
|
||||||
if (td->val) {
|
|
||||||
*td->val = td->ival;
|
|
||||||
}
|
|
||||||
if (td->ext) {
|
|
||||||
if (td->ext->rot) {
|
|
||||||
VECCOPY(td->ext->rot, td->ext->irot);
|
|
||||||
}
|
|
||||||
if (td->ext->size) {
|
|
||||||
VECCOPY(td->ext->size, td->ext->isize);
|
|
||||||
}
|
|
||||||
if(td->flag & TD_USEQUAT) {
|
|
||||||
if (td->ext->quat) {
|
|
||||||
QUATCOPY(td->ext->quat, td->ext->iquat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(td->tdi) {
|
|
||||||
TransDataIpokey *tdi= td->tdi;
|
|
||||||
|
|
||||||
restore_ipokey(tdi->locx, tdi->oldloc);
|
|
||||||
restore_ipokey(tdi->locy, tdi->oldloc+1);
|
|
||||||
restore_ipokey(tdi->locz, tdi->oldloc+2);
|
|
||||||
|
|
||||||
restore_ipokey(tdi->rotx, tdi->oldrot);
|
|
||||||
restore_ipokey(tdi->roty, tdi->oldrot+1);
|
|
||||||
restore_ipokey(tdi->rotz, tdi->oldrot+2);
|
|
||||||
|
|
||||||
restore_ipokey(tdi->sizex, tdi->oldsize);
|
|
||||||
restore_ipokey(tdi->sizey, tdi->oldsize+1);
|
|
||||||
restore_ipokey(tdi->sizez, tdi->oldsize+2);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
recalcData(t);
|
recalcData(t);
|
||||||
}
|
}
|
||||||
@@ -673,7 +678,7 @@ void calculatePropRatio(TransInfo *t)
|
|||||||
*/
|
*/
|
||||||
td->flag |= TD_NOACTION;
|
td->flag |= TD_NOACTION;
|
||||||
td->factor = 0.0f;
|
td->factor = 0.0f;
|
||||||
break;
|
restoreElement(td);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
td->flag &= ~TD_NOACTION;
|
td->flag &= ~TD_NOACTION;
|
||||||
@@ -693,6 +698,7 @@ void calculatePropRatio(TransInfo *t)
|
|||||||
break;
|
break;
|
||||||
case PROP_CONST:
|
case PROP_CONST:
|
||||||
td->factor = 1;
|
td->factor = 1;
|
||||||
|
//td->factor = (float)sqrt(2*dist - dist * dist);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
td->factor = 1;
|
td->factor = 1;
|
||||||
@@ -713,6 +719,7 @@ void calculatePropRatio(TransInfo *t)
|
|||||||
strcpy(t->proptext, "(Linear)");
|
strcpy(t->proptext, "(Linear)");
|
||||||
break;
|
break;
|
||||||
case PROP_CONST:
|
case PROP_CONST:
|
||||||
|
//strcpy(t->proptext, "(Sphere)");
|
||||||
strcpy(t->proptext, "(Constant)");
|
strcpy(t->proptext, "(Constant)");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user