Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2005-05-29 13:21:34 +0400
committerMartin Poirier <theeth@yahoo.com>2005-05-29 13:21:34 +0400
commit14a3166685b23f481b7feabbfe08bfeed64a5847 (patch)
tree9c14a6e1cbbb92487f935703f2c36a84acb2a3e0
parenteeb6adffd3a88613e48cf91274d08055e77a98cf (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.
-rwxr-xr-xsource/blender/include/transform.h2
-rwxr-xr-xsource/blender/src/transform.c9
-rwxr-xr-xsource/blender/src/transform_constraints.c15
3 files changed, 25 insertions, 1 deletions
diff --git a/source/blender/include/transform.h b/source/blender/include/transform.h
index cc3dccb6007..7777804dd76 100755
--- a/source/blender/include/transform.h
+++ b/source/blender/include/transform.h
@@ -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);
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);