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:
authorJoshua Leung <aligorith@gmail.com>2008-02-15 07:42:48 +0300
committerJoshua Leung <aligorith@gmail.com>2008-02-15 07:42:48 +0300
commitedd2ba38bd951691264e61f7737e405a3cefb3af (patch)
tree4054a30a1107c80e3a832879b72243de81c503bc /source/blender/blenkernel/intern/constraint.c
parentcd3d63a628aa98b1769687a9c039c7fa4c6e4db1 (diff)
Bugfix #8255: Negative Rotation Values with Transform Constraint go Crazy
This bug-report brought to light some problems with the transform constraint's handling of degrees+radians. Now, the input-range scaling is done in degrees (as the clamping factors ranges are in degrees) instead of having that done after this stage. The problems should now be fixed (and gears now seem to work ok), but I hope no other rigs have been broken.
Diffstat (limited to 'source/blender/blenkernel/intern/constraint.c')
-rw-r--r--source/blender/blenkernel/intern/constraint.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index ddf0a24f97c..572c91de7f3 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3062,8 +3062,10 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
case 2: /* scale */
Mat4ToSize(ct->matrix, dvec);
break;
- case 1: /* rotation */
+ case 1: /* rotation (convert to degrees first) */
Mat4ToEul(ct->matrix, dvec);
+ for (i=0; i<3; i++)
+ dvec[i] = dvec[i] / M_PI * 180;
break;
default: /* location */
VecCopyf(dvec, ct->matrix[3]);
@@ -3095,14 +3097,9 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
}
}
- /* convert radian<->degree */
- if (data->from==1 && data->to==0) {
- /* from radians to degrees */
- for (i=0; i<3; i++)
- sval[i] = sval[i] / M_PI * 180;
- }
- else if (data->from==0 && data->to==1) {
- /* from degrees to radians */
+ /* convert radians<->degrees */
+ if (data->to == 1) {
+ /* if output is rotation, convert to radians from degrees */
for (i=0; i<3; i++)
sval[i] = sval[i] / 180 * M_PI;
}