forked from bartvdbraak/blender
Toying a bit with MMB behavior:
MMB click with no constraint selects a constraint right away (the axis selector doesn't flash on screen) MMB click with a constraint removes the constraint MMB click-drag in both case (with and without a constraint) uses the axis selector. stopConstraint didn't remove the CON_SELECT flag, so cancelling transform while selecting a constraint and then reentering transform was funny. Fixed
This commit is contained in:
parent
3c7617de52
commit
6379ff9b70
@ -266,7 +266,7 @@ void stopConstraint(TransInfo *t);
|
|||||||
|
|
||||||
void getConstraintMatrix(TransInfo *t);
|
void getConstraintMatrix(TransInfo *t);
|
||||||
|
|
||||||
void initSelectConstraint(TransInfo *t);
|
void initSelectConstraint(TransInfo *t, float mtx[3][3]);
|
||||||
void selectConstraint(TransInfo *t);
|
void selectConstraint(TransInfo *t);
|
||||||
void postSelectConstraint(TransInfo *t);
|
void postSelectConstraint(TransInfo *t);
|
||||||
|
|
||||||
|
@ -134,7 +134,10 @@ void Transform(int mode, int context)
|
|||||||
short pmval[2] = {0, 0}, mval[2], val;
|
short pmval[2] = {0, 0}, mval[2], val;
|
||||||
float mati[3][3];
|
float mati[3][3];
|
||||||
unsigned short event;
|
unsigned short event;
|
||||||
|
/* constraint mode THIS IS A HACK will have to use con.mode eventually */
|
||||||
char cmode = '\0';
|
char cmode = '\0';
|
||||||
|
/* If MMB is pressed or not */
|
||||||
|
char mmb_press = 0;
|
||||||
|
|
||||||
/*joeedh -> hopefully may be what makes the old transform() constant*/
|
/*joeedh -> hopefully may be what makes the old transform() constant*/
|
||||||
/* ton: I doubt, but it doesnt harm for now. shouldnt be needed though */
|
/* ton: I doubt, but it doesnt harm for now. shouldnt be needed though */
|
||||||
@ -226,6 +229,9 @@ void Transform(int mode, int context)
|
|||||||
getmouseco_areawin(mval);
|
getmouseco_areawin(mval);
|
||||||
|
|
||||||
if (mval[0] != pmval[0] || mval[1] != pmval[1]) {
|
if (mval[0] != pmval[0] || mval[1] != pmval[1]) {
|
||||||
|
if (mmb_press) {
|
||||||
|
initSelectConstraint(&Trans, mati);
|
||||||
|
}
|
||||||
Trans.redraw = 1;
|
Trans.redraw = 1;
|
||||||
}
|
}
|
||||||
if (Trans.redraw) {
|
if (Trans.redraw) {
|
||||||
@ -272,10 +278,18 @@ void Transform(int mode, int context)
|
|||||||
initTrackball(&Trans);
|
initTrackball(&Trans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
initSelectConstraint(&Trans);
|
mmb_press = 1;
|
||||||
|
if (Trans.con.mode & CON_APPLY) {
|
||||||
|
stopConstraint(&Trans);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
initSelectConstraint(&Trans, mati);
|
||||||
|
postSelectConstraint(&Trans);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Trans.redraw = 1;
|
||||||
}
|
}
|
||||||
Trans.redraw = 1;
|
|
||||||
break;
|
break;
|
||||||
case ESCKEY:
|
case ESCKEY:
|
||||||
case RIGHTMOUSE:
|
case RIGHTMOUSE:
|
||||||
@ -433,6 +447,7 @@ void Transform(int mode, int context)
|
|||||||
after releasing modifer key */
|
after releasing modifer key */
|
||||||
case MIDDLEMOUSE:
|
case MIDDLEMOUSE:
|
||||||
if ((Trans.flag & T_NO_CONSTRAINT)==0) {
|
if ((Trans.flag & T_NO_CONSTRAINT)==0) {
|
||||||
|
mmb_press = 0;
|
||||||
postSelectConstraint(&Trans);
|
postSelectConstraint(&Trans);
|
||||||
Trans.redraw = 1;
|
Trans.redraw = 1;
|
||||||
}
|
}
|
||||||
|
@ -718,7 +718,7 @@ void startConstraint(TransInfo *t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void stopConstraint(TransInfo *t) {
|
void stopConstraint(TransInfo *t) {
|
||||||
t->con.mode &= ~CON_APPLY;
|
t->con.mode &= ~(CON_APPLY|CON_SELECT);
|
||||||
*t->con.text = '\0';
|
*t->con.text = '\0';
|
||||||
t->num.idx_max = t->idx_max;
|
t->num.idx_max = t->idx_max;
|
||||||
}
|
}
|
||||||
@ -751,10 +751,9 @@ void getConstraintMatrix(TransInfo *t)
|
|||||||
Mat3MulMat3(t->con.pmtx, t->con.mtx, mat);
|
Mat3MulMat3(t->con.pmtx, t->con.mtx, mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSelectConstraint(TransInfo *t)
|
void initSelectConstraint(TransInfo *t, float mtx[3][3])
|
||||||
{
|
{
|
||||||
Mat3One(t->con.mtx);
|
Mat3CpyMat3(t->con.mtx, mtx);
|
||||||
Mat3One(t->con.pmtx);
|
|
||||||
t->con.mode |= CON_APPLY;
|
t->con.mode |= CON_APPLY;
|
||||||
t->con.mode |= CON_SELECT;
|
t->con.mode |= CON_SELECT;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user