Push/Pull didn't do Lock Constraint correctly. Fixed.
Also added an isLockConstraint function that tells if the current constraint is a locking constraint or not.
This commit is contained in:
@@ -275,6 +275,8 @@ void drawConstraint();
|
||||
//void drawPropCircle(TransInfo *t);
|
||||
void drawPropCircle();
|
||||
|
||||
int isLockConstraint(TransInfo *t);
|
||||
|
||||
void initConstraint(TransInfo *t);
|
||||
void startConstraint(TransInfo *t);
|
||||
void stopConstraint(TransInfo *t);
|
||||
|
||||
@@ -1988,7 +1988,14 @@ int PushPull(TransInfo *t, short mval[2])
|
||||
VecSubf(vec, t->center, td->center);
|
||||
if (t->con.applyRot && t->con.mode & CON_APPLY) {
|
||||
t->con.applyRot(t, td, axis);
|
||||
Projf(vec, vec, axis);
|
||||
if (isLockConstraint(t)) {
|
||||
float dvec[3];
|
||||
Projf(dvec, vec, axis);
|
||||
VecSubf(vec, vec, dvec);
|
||||
}
|
||||
else {
|
||||
Projf(vec, vec, axis);
|
||||
}
|
||||
}
|
||||
Normalise(vec);
|
||||
VecMulf(vec, distance);
|
||||
|
||||
@@ -739,6 +739,21 @@ void BIF_drawPropCircle()
|
||||
}
|
||||
}
|
||||
|
||||
int isLockConstraint(TransInfo *t) {
|
||||
int mode = t->con.mode;
|
||||
|
||||
if (mode & (CON_AXIS0|CON_AXIS1) == (CON_AXIS0|CON_AXIS1))
|
||||
return 1;
|
||||
|
||||
if (mode & (CON_AXIS1|CON_AXIS2) == (CON_AXIS1|CON_AXIS2))
|
||||
return 1;
|
||||
|
||||
if (mode & (CON_AXIS0|CON_AXIS2) == (CON_AXIS0|CON_AXIS2))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void initConstraint(TransInfo *t) {
|
||||
if (t->con.mode & CON_APPLY) {
|
||||
startConstraint(t);
|
||||
|
||||
Reference in New Issue
Block a user