diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-18 22:43:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-18 22:43:13 +0300 |
commit | f50962a6892e20e2525947d7bfcfd58a2265898e (patch) | |
tree | c371917bf9b29abf4ef994ea0b730430617260ec /source/blender | |
parent | 3085edf2af65c243e1a02f574ca404b86d056a6b (diff) |
in rare cases fcurves with no handle length can result in 0.0. check if the point matches the frame.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index d93a9820886..552c7d0767d 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1714,9 +1714,13 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim { /* evaltime occurs somewhere in the middle of the curve */ for (a=0; prevbezt && bezt && (a < fcu->totvert-1); a++, prevbezt=bezt, bezt++) - { + { + /* use if the key is directly on the frame, rare cases this is needed else we get 0.0 instead. */ + if(fabs(bezt->vec[1][0] - evaltime) < SMALL_NUMBER) { + cvalue= bezt->vec[1][1]; + } /* evaltime occurs within the interval defined by these two keyframes */ - if ((prevbezt->vec[1][0] <= evaltime) && (bezt->vec[1][0] >= evaltime)) + else if ((prevbezt->vec[1][0] <= evaltime) && (bezt->vec[1][0] >= evaltime)) { /* value depends on interpolation mode */ if ((prevbezt->ipo == BEZT_IPO_CONST) || (fcu->flag & FCURVE_DISCRETE_VALUES)) |