diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-03-10 16:02:16 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-03-10 16:02:40 +0300 |
commit | a801487ef5049d9f4ecf947942761566bc64a176 (patch) | |
tree | 9089e5770eaea2e578cb5172cb70e9a92c4385ae /source/blender/editors/space_action | |
parent | ca717f0489af6854f3f4bedb3c1e82ea0a8dff1c (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')
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 82 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_ops.c | 1 |
3 files changed, 54 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 */ diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index 006ba86a50a..bf1b90bbe98 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -99,6 +99,7 @@ void ACTION_OT_keyframe_type(struct wmOperatorType *ot); void ACTION_OT_handle_type(struct wmOperatorType *ot); void ACTION_OT_interpolation_type(struct wmOperatorType *ot); void ACTION_OT_extrapolation_type(struct wmOperatorType *ot); +void ACTION_OT_easing_type(struct wmOperatorType *ot); void ACTION_OT_frame_jump(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c index cba86ac5131..744c6c75463 100644 --- a/source/blender/editors/space_action/action_ops.c +++ b/source/blender/editors/space_action/action_ops.c @@ -63,6 +63,7 @@ void action_operatortypes(void) WM_operatortype_append(ACTION_OT_handle_type); WM_operatortype_append(ACTION_OT_interpolation_type); WM_operatortype_append(ACTION_OT_extrapolation_type); + WM_operatortype_append(ACTION_OT_easing_type); WM_operatortype_append(ACTION_OT_keyframe_type); WM_operatortype_append(ACTION_OT_sample); WM_operatortype_append(ACTION_OT_clean); |