diff options
author | Martin Poirier <theeth@yahoo.com> | 2005-05-29 13:21:34 +0400 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2005-05-29 13:21:34 +0400 |
commit | 14a3166685b23f481b7feabbfe08bfeed64a5847 (patch) | |
tree | 9c14a6e1cbbb92487f935703f2c36a84acb2a3e0 /source/blender/src | |
parent | eeb6adffd3a88613e48cf91274d08055e77a98cf (diff) |
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.
Diffstat (limited to 'source/blender/src')
-rwxr-xr-x | source/blender/src/transform.c | 9 | ||||
-rwxr-xr-x | source/blender/src/transform_constraints.c | 15 |
2 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c index e83e55c6bc4..886607e16f2 100755 --- a/source/blender/src/transform.c +++ b/source/blender/src/transform.c @@ -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); diff --git a/source/blender/src/transform_constraints.c b/source/blender/src/transform_constraints.c index edb43aeb883..f231813efd8 100755 --- a/source/blender/src/transform_constraints.c +++ b/source/blender/src/transform_constraints.c @@ -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); |