diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-03-22 12:54:13 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-03-22 12:54:13 +0300 |
commit | 7c86a10aba535dd68c79244487760e5b87c2eed8 (patch) | |
tree | 3bef26aadd0cea04aa8ec3b83f373b38a763a0d1 /source/blender/blenkernel/intern/fcurve.c | |
parent | b995f4329a65278a229a32674ed2083ee04310a3 (diff) |
F-Curve Modifiers - Envelope: Bugfixes
* Envelope modifier now works correctly. Previously, the mapping was being done in the wrong order.
* Extra controls for modifiers now only draw when the F-Curve is the active one, so the view will be less cluttered in other cases.
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index f58616cdf92..f087727dd9c 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1464,10 +1464,11 @@ static void fcm_envelope_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, f } /* adjust *cvalue - * NOTE: env->min/max are relative to env->midval, and can be either +ve OR -ve, so we add... + * - fac is the ratio of how the current y-value corresponds to the reference range + * - thus, the new value is found by mapping the old range to the new! */ - fac= (*cvalue - min) / (max - min); - *cvalue= (env->midval + env->min) + (fac * (env->max - env->min)); + fac= (*cvalue - (env->midval + env->min)) / (env->max - env->min); + *cvalue= min + fac*(max - min); } static FModifierTypeInfo FMI_ENVELOPE = { |