[Bf-blender-cvs] [ed775ed] master: Fix T39405: Make "amplitude" for elastic easing more intuitive to use

Joshua Leung noreply at git.blender.org
Mon Mar 31 13:25:52 CEST 2014


Commit: ed775edeeb489e4710bb685a5fd47b16102eb87a
Author: Joshua Leung
Date:   Tue Apr 1 00:24:34 2014 +1300
https://developer.blender.org/rBed775edeeb489e4710bb685a5fd47b16102eb87a

Fix T39405: Make "amplitude" for elastic easing more intuitive to use

Previously, amplitude was more of an "absolute" value in the sense that whatever value
you set it to became a sort of "maximum bounce" height. However, it turns out that this
approach isn't so nice when dealing with large gaps between the values of two keyframes,
as the elastic easing equations expect that "amplitude > |change|" (where change is the
difference in values from key1 to key2).

Now, the "amplitude" value we pass to the easing functions are "|change| + amplitude".
This is easier to control, as now, as soon as you start changing that value, there are
immediately visible effects.

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

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

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

diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 7079525..6c4162c 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -2085,7 +2085,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 			const float change = bezt->vec[1][1] - prevbezt->vec[1][1];
 			const float duration = bezt->vec[1][0] - prevbezt->vec[1][0];
 			const float time = evaltime - prevbezt->vec[1][0];
-			const float amplitude = prevbezt->amplitude;
+			const float amplitude = prevbezt->amplitude + fabsf(change);  /* see T39405 */
 			const float period = prevbezt->period;
 			
 			/* value depends on interpolation mode */
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 43f60c4..eca50b8 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -1676,7 +1676,8 @@ static void rna_def_fkeyframe(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "amplitude");
-	RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of bounces for elastic easing");
+	RNA_def_property_range(prop, 0.0f, FLT_MAX); /* only positive values... */
+	RNA_def_property_ui_text(prop, "Amplitude", "Amount to boost elastic bounces for 'elastic' easing");
 	RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
 
 	prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);




More information about the Bf-blender-cvs mailing list