Fix T42367: Spline-ik offset evaluating curve

This commit is contained in:
Campbell Barton 2014-10-23 16:29:40 +02:00
parent 557d4370d9
commit f651a470bf
Notes: blender-bot 2023-02-14 09:54:11 +01:00
Referenced by issue #42367, Spline IK leaves a gap at the start of the bone chain
2 changed files with 6 additions and 0 deletions

View File

@ -627,6 +627,9 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
if (!bl->nr) return 0;
if (bl->poly > -1) cycl = 1;
/* values below zero for non-cyclic curves give strange results */
BLI_assert(cycl || ctime >= 0.0f);
ctime *= (path->len - 1);
s1 = (int)floor(ctime);

View File

@ -1940,6 +1940,9 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
}
}
/* disallow negative values (happens with float precision) */
CLAMP_MIN(ikData->points[segcount], 0.0f);
/* spline has now been bound */
ikData->flag |= CONSTRAINT_SPLINEIK_BOUND;
}