[Bf-blender-cvs] [6a18b0f] master: Regression Bugfix T40332: Bad driver behaviour on small distances.

Joshua Leung noreply at git.blender.org
Wed Jun 11 05:50:24 CEST 2014


Commit: 6a18b0f6bf4625bb074996f9f4fb588a16b8adad
Author: Joshua Leung
Date:   Wed Jun 11 15:48:43 2014 +1200
https://developer.blender.org/rB6a18b0f6bf4625bb074996f9f4fb588a16b8adad

Regression Bugfix T40332: Bad driver behaviour on small distances.

!!! ANIMATORS/RIGGERS PLEASE TEST !!!

I've reduced the size of the threshold for the keyframe lookup here. This threshold
determines the minimum time in frames between keyframes (i.e. "how close" to each
other they can get). Making this too small causes problems like T39207, but it seems
that the threshold we've been using makes it impossible to get accurate behaviour on
driver curves with keyframes, when the driver target only moves 2cm (i.e. 0.02 BU).

So far, all of the test cases from T39207 seem to work fine, as well as Caminandes 2
files, and Kenny the Caterpillar. The Kiribati rigs/shots (thanks jpbouza for helping
to check on these!) also seem to be fine.

===================================================================

M	source/blender/blenkernel/intern/fcurve.c

===================================================================

diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 65b9d21..d7d4642 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -2050,8 +2050,14 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 		/* evaltime occurs somewhere in the middle of the curve */
 		bool exact = false;
 		
-		/* - use binary search to find appropriate keyframes */
-		a = binarysearch_bezt_index_ex(bezts, evaltime, fcu->totvert, 0.001, &exact);
+		/* Use binary search to find appropriate keyframes...
+		 * 
+		 * The threshold here has the following constraints:
+		 *    - 0.001   is too coarse   -> We get artifacts with 2cm driver movements at 1BU = 1m (see T40332)
+		 *    - 0.00001 is too fine     -> Weird errors, like selecting the wrong keyframe range (see T39207), occur.
+		 *                                 This lower bound was established in b888a32eee8147b028464336ad2404d8155c64dd
+		 */
+		a = binarysearch_bezt_index_ex(bezts, evaltime, fcu->totvert, 0.0001, &exact);
 		if (G.debug & G_DEBUG) printf("eval fcurve '%s' - %f => %d/%d, %d\n", fcu->rna_path, evaltime, a, fcu->totvert, exact);
 		
 		if (exact) {




More information about the Bf-blender-cvs mailing list