diff options
author | TonyG <TonyG> | 2020-09-15 11:41:08 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-09-15 14:08:18 +0300 |
commit | da95d1d851b41e3599310d88e6d03fe23cee455e (patch) | |
tree | 0f4cd954a68affa602818e89e0b40ccd0ed8bcba /source/blender/blenkernel/intern/fcurve.c | |
parent | fbdac74c405e2607b05b28fff8845c9f839590d6 (diff) |
Fix T75881: Animation, limitation of Bézier Handles
Relax limits of FCurve Bézier handles during evaluation. FCurve handles
can be scaled down to avoid the curve looping backward in time. This
scaling was done correctly but over-carefully, posing unnecessary
limitations on the possible slope of FCurves. This commit changes the
scaling approach such that the FCurve can become near-vertical.
Bump Blender's subversion from 291.0.1 to 291.0.2 to ensure that older
animation files are correctly updated.
Reviewed By: sybren
Differential Revision: https://developer.blender.org/D8752
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]); } |