diff options
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 8a5ad483ffd..c1233a5ea61 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1308,7 +1308,7 @@ bool test_time_fcurve(FCurve *fcu) /** \name F-Curve Calculations * \{ */ -/* The total length of the handles is not allowed to be more +/* The length of each handle is not allowed to be more * than the horizontal distance between (v1-v4). * This is to prevent curve loops. */ @@ -1337,15 +1337,17 @@ void correct_bezpart(const float v1[2], float v2[2], float v3[2], const float v4 return; } - /* the two handles cross over each other, so force them - * apart using the proportion they overlap + /* To prevent looping or rewinding, handles cannot + * exceed the adjacent's keyframe time position. */ - if ((len1 + len2) > len) { - fac = len / (len1 + len2); - + if (len1 > len) { + fac = len / len1; v2[0] = (v1[0] - fac * h1[0]); v2[1] = (v1[1] - fac * h1[1]); + } + if (len2 > len) { + fac = len / len2; v3[0] = (v4[0] - fac * h2[0]); v3[1] = (v4[1] - fac * h2[1]); } |