diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-01-13 09:30:31 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-01-13 09:30:31 +0300 |
commit | 00ef77c1a241aaf3d7c6307411e97938b87c3096 (patch) | |
tree | 479d37ff8722303545f8569d01e322275b09265d /source/blender/blenkernel/intern | |
parent | 8787532184e648e38b4ecee0709dcf87b95862b1 (diff) |
Fixes for SplineIK:
* Ensure that when new constraints are created, the new settings have sensible
default values.
TODO: we need to version-patch old files
* Fix problem with variable shadowing (which wasn't causing problems AFAIK)
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 9232cd6b64b..03372b97049 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2192,7 +2192,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o case CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC: { /* improved volume preservation based on the Stretch To constraint */ - float scale; + float final_scale; /* as the basis for volume preservation, we use the inverse scale factor... */ if (fabsf(scaleFac) != 0.0f) { @@ -2225,16 +2225,16 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o } /* compute scale factor for xz axes from this value */ - scale = sqrt(bulge); + final_scale = sqrt(bulge); } else { /* no scaling, so scale factor is simple */ - scale = 1.0f; + final_scale = 1.0f; } /* apply the scaling (assuming normalised scale) */ - mul_v3_fl(poseMat[0], scale); - mul_v3_fl(poseMat[2], scale); + mul_v3_fl(poseMat[0], final_scale); + mul_v3_fl(poseMat[2], final_scale); break; } } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 5f97abbaac1..f591fe857f8 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3698,6 +3698,9 @@ static void splineik_new_data(void *cdata) bSplineIKConstraint *data = (bSplineIKConstraint *)cdata; data->chainlen = 1; + data->bulge = 1.0; + data->bulge_max = 1.0f; + data->bulge_min = 1.0f; } static void splineik_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) |