"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"
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) */
|
||||
|
||||
@@ -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"},
|
||||
|
||||
Reference in New Issue
Block a user