Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-03-10 16:02:16 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-03-10 16:02:40 +0300
commita801487ef5049d9f4ecf947942761566bc64a176 (patch)
tree9089e5770eaea2e578cb5172cb70e9a92c4385ae /source/blender/editors/space_action/action_edit.c
parentca717f0489af6854f3f4bedb3c1e82ea0a8dff1c (diff)
Fix T65076: Missing EasingType implementation on the Dopesheet
EasingType was implemented rBdaccaa713b6e for the GraphEditor (but never made it to the Dopesheet). If you can select Easing Mode in the DopeSheet, then you should also be able to select the associated Easing Type. Thanks @lichtwerk for the initial implementation. Maniphest Tasks: T65076 Differential Revision: https://developer.blender.org/D6094
Diffstat (limited to 'source/blender/editors/space_action/action_edit.c')
-rw-r--r--source/blender/editors/space_action/action_edit.c82
1 files changed, 52 insertions, 30 deletions
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index e17bf00106a..d7ad2066561 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -1311,35 +1311,6 @@ void ACTION_OT_extrapolation_type(wmOperatorType *ot)
/* ******************** Set Interpolation-Type Operator *********************** */
-/* this function is responsible for setting interpolation mode for keyframes */
-static void setipo_action_keys(bAnimContext *ac, short mode)
-{
- ListBase anim_data = {NULL, NULL};
- bAnimListElem *ale;
- int filter;
- KeyframeEditFunc set_cb = ANIM_editkeyframes_ipo(mode);
-
- /* filter data */
- filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE |
- ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
- ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
-
- /* Loop through setting BezTriple interpolation
- * Note: we do not supply KeyframeEditData to the looper yet.
- * Currently that's not necessary here.
- */
- for (ale = anim_data.first; ale; ale = ale->next) {
- ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve);
-
- ale->update |= ANIM_UPDATE_DEFAULT;
- }
-
- ANIM_animdata_update(ac, &anim_data);
- ANIM_animdata_freelist(&anim_data);
-}
-
-/* ------------------- */
-
static int actkeys_ipo_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
@@ -1359,7 +1330,10 @@ static int actkeys_ipo_exec(bContext *C, wmOperator *op)
mode = RNA_enum_get(op->ptr, "type");
/* set handle type */
- setipo_action_keys(&ac, mode);
+ ANIM_animdata_keyframe_callback(&ac,
+ (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE |
+ ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS),
+ ANIM_editkeyframes_ipo(mode));
/* set notifier that keyframe properties have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
@@ -1388,6 +1362,54 @@ void ACTION_OT_interpolation_type(wmOperatorType *ot)
ot->srna, "type", rna_enum_beztriple_interpolation_mode_items, 0, "Type", "");
}
+/* ******************** Set Easing Operator *********************** */
+
+static int actkeys_easing_exec(bContext *C, wmOperator *op)
+{
+ bAnimContext ac;
+ short mode;
+
+ /* get editor data */
+ if (ANIM_animdata_get_context(C, &ac) == 0) {
+ return OPERATOR_CANCELLED;
+ }
+
+ /* get handle setting mode */
+ mode = RNA_enum_get(op->ptr, "type");
+
+ /* set handle type */
+ ANIM_animdata_keyframe_callback(&ac,
+ (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE |
+ ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS),
+ ANIM_editkeyframes_easing(mode));
+
+ /* set notifier that keyframe properties have changed */
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void ACTION_OT_easing_type(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Set Keyframe Easing Type";
+ ot->idname = "ACTION_OT_easing_type";
+ ot->description =
+ "Set easing type for the F-Curve segments starting from the selected keyframes";
+
+ /* api callbacks */
+ ot->invoke = WM_menu_invoke;
+ ot->exec = actkeys_easing_exec;
+ ot->poll = ED_operator_action_active;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* id-props */
+ ot->prop = RNA_def_enum(
+ ot->srna, "type", rna_enum_beztriple_interpolation_easing_items, 0, "Type", "");
+}
+
/* ******************** Set Handle-Type Operator *********************** */
/* this function is responsible for setting handle-type of selected keyframes */