[Bf-blender-cvs] [6feec25] master: "Auto" option for Keyframe.easing

Joshua Leung noreply at git.blender.org
Mon Apr 28 16:24:25 CEST 2014


Commit: 6feec25bddfb96f979c89611840f1f558b7cd92c
Author: Joshua Leung
Date:   Mon Apr 28 01:42:51 2014 +1200
https://developer.blender.org/rB6feec25bddfb96f979c89611840f1f558b7cd92c

"Auto" option for Keyframe.easing

This option (alongside the Ease In/Out/InOut options already available) aims to make it
easier to get an initial curve that looks closer to the one you were expecting, by
automatically picking whether Ease In or Ease Out should be used based on the type of
interpolation being used for the curve segment in question.

Notes:
* The types chosen may need some adjustments (e.g. using ease in-out instead of just ease in)
* This does break compatability with files saved in previous dev builds, but only
  if you were using Bounce/Elastic/Back with "Ease In"

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

M	source/blender/blenkernel/intern/fcurve.c
M	source/blender/editors/animation/keyframes_edit.c
M	source/blender/makesdna/DNA_curve_types.h
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 d4fa9de..281b4f5 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -2139,6 +2139,10 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 							case BEZT_IPO_EASE_IN_OUT:
 								cvalue = BLI_easing_back_ease_in_out(time, begin, change, duration, prevbezt->back);
 								break;
+								
+							default: /* default/auto: same as ease out */
+								cvalue = BLI_easing_back_ease_out(time, begin, change, duration, prevbezt->back);
+								break;
 						}
 						break;
 					
@@ -2153,6 +2157,10 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 							case BEZT_IPO_EASE_IN_OUT:
 								cvalue = BLI_easing_bounce_ease_in_out(time, begin, change, duration);
 								break;
+								
+							default: /* default/auto: same as ease out */
+								cvalue = BLI_easing_bounce_ease_out(time, begin, change, duration);
+								break;
 						}
 						break;
 					
@@ -2167,6 +2175,10 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 							case BEZT_IPO_EASE_IN_OUT:
 								cvalue = BLI_easing_circ_ease_in_out(time, begin, change, duration);
 								break;
+								
+							default: /* default/auto: same as ease in */
+								cvalue = BLI_easing_circ_ease_in(time, begin, change, duration);
+								break;
 						}
 						break;
 
@@ -2181,6 +2193,10 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 							case BEZT_IPO_EASE_IN_OUT:
 								cvalue = BLI_easing_cubic_ease_in_out(time, begin, change, duration);
 								break;
+								
+							default: /* default/auto: same as ease in */
+								cvalue = BLI_easing_cubic_ease_in(time, begin, change, duration);
+								break;
 						}
 						break;
 					
@@ -2195,6 +2211,10 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 							case BEZT_IPO_EASE_IN_OUT:
 								cvalue = BLI_easing_elastic_ease_in_out(time, begin, change, duration, amplitude, period);
 								break;
+								
+							default: /* default/auto: same as ease out */
+								cvalue = BLI_easing_elastic_ease_out(time, begin, change, duration, amplitude, period);
+								break;
 						}
 						break;
 					
@@ -2209,6 +2229,10 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 							case BEZT_IPO_EASE_IN_OUT:
 								cvalue = BLI_easing_expo_ease_in_out(time, begin, change, duration);
 								break;
+								
+							default: /* default/auto: same as ease in */
+								cvalue = BLI_easing_expo_ease_in(time, begin, change, duration);
+								break;
 						}
 						break;
 					
@@ -2223,6 +2247,10 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 							case BEZT_IPO_EASE_IN_OUT:
 								cvalue = BLI_easing_quad_ease_in_out(time, begin, change, duration);
 								break;
+							
+							default: /* default/auto: same as ease in */
+								cvalue = BLI_easing_quad_ease_in(time, begin, change, duration);
+								break;
 						}
 						break;
 					
@@ -2237,6 +2265,10 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 							case BEZT_IPO_EASE_IN_OUT:
 								cvalue = BLI_easing_quart_ease_in_out(time, begin, change, duration);
 								break;
+								
+							default: /* default/auto: same as ease in */
+								cvalue = BLI_easing_quart_ease_in(time, begin, change, duration);
+								break;
 						}
 						break;
 					
@@ -2251,6 +2283,10 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 							case BEZT_IPO_EASE_IN_OUT:
 								cvalue = BLI_easing_quint_ease_in_out(time, begin, change, duration);
 								break;
+								
+							default: /* default/auto: same as ease in */
+								cvalue = BLI_easing_quint_ease_in(time, begin, change, duration);
+								break;
 						}
 						break;
 					
@@ -2265,6 +2301,10 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime
 							case BEZT_IPO_EASE_IN_OUT:
 								cvalue = BLI_easing_sine_ease_in_out(time, begin, change, duration);
 								break;
+								
+							default: /* default/auto: same as ease in */
+								cvalue = BLI_easing_sine_ease_in(time, begin, change, duration);
+								break;
 						}
 						break;
 					
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 808ed75..320aa0a 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -1103,6 +1103,13 @@ static short set_easingtype_easeinout(KeyframeEditData *UNUSED(ked), BezTriple *
 	return 0;
 }
 
+static short set_easingtype_easeauto(KeyframeEditData *UNUSED(ked), BezTriple *bezt)
+{
+	if (bezt->f2 & SELECT)
+		bezt->easing = BEZT_IPO_EASE_AUTO;
+	return 0;
+}
+
 /* Set the easing type of the selected BezTriples in each F-Curve to the specified one */
 KeyframeEditFunc ANIM_editkeyframes_easing(short mode)
 {
@@ -1114,8 +1121,10 @@ KeyframeEditFunc ANIM_editkeyframes_easing(short mode)
 			return set_easingtype_easeout;
 		
 		case BEZT_IPO_EASE_IN_OUT: /* both */
-		default:
 			return set_easingtype_easeinout;
+			
+		default: /* auto */
+			return set_easingtype_easeauto;
 	}
 }
 
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index 82ec02e..0321c1c 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -380,9 +380,11 @@ typedef enum eBezTriple_Interpolation {
 
 /* easing modes (used only for Keyframes - BezTriple->easing) */
 typedef enum eBezTriple_Easing {
-	BEZT_IPO_EASE_IN = 0,
-	BEZT_IPO_EASE_OUT = 1,
-	BEZT_IPO_EASE_IN_OUT = 2
+	BEZT_IPO_EASE_AUTO = 0,
+	
+	BEZT_IPO_EASE_IN = 1,
+	BEZT_IPO_EASE_OUT = 2,
+	BEZT_IPO_EASE_IN_OUT = 3
 } eBezTriple_Easing;
 
 /* types of keyframe (used only for BezTriple->hide when BezTriple is used in F-Curves) */
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index c135ee2..bf07aae 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -78,6 +78,11 @@ EnumPropertyItem beztriple_keyframe_type_items[] = {
 };
 
 EnumPropertyItem beztriple_interpolation_easing_items[] =  {
+	/* XXX: auto-easing is currently using a placeholder icon... */
+	{BEZT_IPO_EASE_AUTO, "AUTO", ICON_IPO_EASE_IN_OUT, "Automatic Easing",
+	                     "Easing type is chosen automatically based on what the type of interpolation used "
+	                     "(e.g. 'Ease In' for transitional types, and 'Ease Out' for dynamic effects)"},
+						 
 	{BEZT_IPO_EASE_IN, "EASE_IN", ICON_IPO_EASE_IN, "Ease In", "Only on the end closest to the next keyframe"},
 	{BEZT_IPO_EASE_OUT, "EASE_OUT", ICON_IPO_EASE_OUT, "Ease Out", "Only on the end closest to the first keyframe"},
 	{BEZT_IPO_EASE_IN_OUT, "EASE_IN_OUT", ICON_IPO_EASE_IN_OUT, "Ease In and Out", "Segment between both keyframes"},




More information about the Bf-blender-cvs mailing list