void getConstraintMatrix(TransInfo *t);
-void initSelectConstraint(TransInfo *t);
+void initSelectConstraint(TransInfo *t, float mtx[3][3]);
void selectConstraint(TransInfo *t);
void postSelectConstraint(TransInfo *t);
short pmval[2] = {0, 0}, mval[2], val;
float mati[3][3];
unsigned short event;
+ /* constraint mode THIS IS A HACK will have to use con.mode eventually */
char cmode = '\0';
+ /* If MMB is pressed or not */
+ char mmb_press = 0;
/*joeedh -> hopefully may be what makes the old transform() constant*/
/* ton: I doubt, but it doesnt harm for now. shouldnt be needed though */
getmouseco_areawin(mval);
if (mval[0] != pmval[0] || mval[1] != pmval[1]) {
+ if (mmb_press) {
+ initSelectConstraint(&Trans, mati);
+ }
Trans.redraw = 1;
}
if (Trans.redraw) {
initTrackball(&Trans);
}
}
- else
- initSelectConstraint(&Trans);
+ else {
+ mmb_press = 1;
+ if (Trans.con.mode & CON_APPLY) {
+ stopConstraint(&Trans);
+ }
+ else {
+ initSelectConstraint(&Trans, mati);
+ postSelectConstraint(&Trans);
+ }
+ }
+ Trans.redraw = 1;
}
- Trans.redraw = 1;
break;
case ESCKEY:
case RIGHTMOUSE:
after releasing modifer key */
case MIDDLEMOUSE:
if ((Trans.flag & T_NO_CONSTRAINT)==0) {
+ mmb_press = 0;
postSelectConstraint(&Trans);
Trans.redraw = 1;
}
}
void stopConstraint(TransInfo *t) {
- t->con.mode &= ~CON_APPLY;
+ t->con.mode &= ~(CON_APPLY|CON_SELECT);
*t->con.text = '\0';
t->num.idx_max = t->idx_max;
}
Mat3MulMat3(t->con.pmtx, t->con.mtx, mat);
}
-void initSelectConstraint(TransInfo *t)
+void initSelectConstraint(TransInfo *t, float mtx[3][3])
{
- Mat3One(t->con.mtx);
- Mat3One(t->con.pmtx);
+ Mat3CpyMat3(t->con.mtx, mtx);
t->con.mode |= CON_APPLY;
t->con.mode |= CON_SELECT;