diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2021-04-08 16:51:08 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2021-04-08 16:52:33 +0300 |
commit | cf2baa585cc8788b29147d6e34fa8c46609e5bf9 (patch) | |
tree | e4386e1feea9e72e2994cfed3f67e201770ad91f /source/blender/blenkernel/intern/armature_update.c | |
parent | f0317911850f07c75aa2e10e371b69b135194ac6 (diff) |
Fix T81707: Spline IK Joints "Floating" above curve
The issue was that where_on_path uses a resampled curve to get the data
from the curve. This leads to disconnects between the curve the user
sees and the evaluated location data.
To fix this we simply use the actual curve data the user can see.
The older code needed a cleanup either way as there were hacks in other
parts of the code trying to work around some brokenness. This is now
fixed and we no longer need to clamp the evaluation range to 0-1 or make
helper functions to make it do what we actually want.
Reviewed By: Campbell, Sybren
Differential Revision: http://developer.blender.org/D10898
Diffstat (limited to 'source/blender/blenkernel/intern/armature_update.c')
-rw-r--r-- | source/blender/blenkernel/intern/armature_update.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index 8f74b8ff054..475b64cb9b3 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -229,7 +229,7 @@ static bool splineik_evaluate_init(tSplineIK_Tree *tree, tSplineIk_EvalState *st CurveCache *cache = ikData->tar->runtime.curve_cache; - if (ELEM(NULL, cache, cache->path, cache->path->data)) { + if (ELEM(NULL, cache, cache->anim_path_accum_length)) { return false; } @@ -242,7 +242,7 @@ static bool splineik_evaluate_init(tSplineIK_Tree *tree, tSplineIk_EvalState *st if ((ikData->yScaleMode != CONSTRAINT_SPLINEIK_YS_FIT_CURVE) && (tree->totlength != 0.0f)) { /* get the current length of the curve */ /* NOTE: this is assumed to be correct even after the curve was resized */ - float splineLen = cache->path->totdist; + const float splineLen = BKE_anim_path_get_length(cache); /* calculate the scale factor to multiply all the path values by so that the * bone chain retains its current length, such that @@ -297,7 +297,7 @@ static void splineik_evaluate_bone( } /* tail endpoint */ - if (where_on_path(ikData->tar, pointEnd, vec, dir, NULL, &rad, NULL)) { + if (BKE_where_on_path(ikData->tar, pointEnd, vec, dir, NULL, &rad, NULL)) { /* apply curve's object-mode transforms to the position * unless the option to allow curve to be positioned elsewhere is activated (i.e. no root) */ @@ -314,7 +314,7 @@ static void splineik_evaluate_bone( } /* head endpoint */ - if (where_on_path(ikData->tar, pointStart, vec, dir, NULL, &rad, NULL)) { + if (BKE_where_on_path(ikData->tar, pointStart, vec, dir, NULL, &rad, NULL)) { /* apply curve's object-mode transforms to the position * unless the option to allow curve to be positioned elsewhere is activated (i.e. no root) */ |