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
This commit is contained in:
2021-04-08 15:51:08 +02:00
parent f031791185
commit cf2baa585c
16 changed files with 319 additions and 359 deletions

View File

@@ -39,6 +39,7 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "BKE_anim_path.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
@@ -471,9 +472,9 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
if (amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob != NULL) {
Object *curve_ob = amd->curve_ob;
CurveCache *curve_cache = curve_ob->runtime.curve_cache;
if (curve_cache != NULL && curve_cache->path != NULL) {
if (curve_cache != NULL && curve_cache->anim_path_accum_length != NULL) {
float scale_fac = mat4_to_scale(curve_ob->obmat);
length = scale_fac * curve_cache->path->totdist;
length = scale_fac * BKE_anim_path_get_length(curve_cache);
}
}