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)
This commit is contained in:
2015-01-13 19:30:31 +13:00
parent 8787532184
commit 00ef77c1a2
2 changed files with 8 additions and 5 deletions

View File

@@ -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;
}
}

View File

@@ -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)