Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_action/action_edit.c
| Show First 20 Lines • Show All 1,305 Lines • ▼ Show 20 Lines | void ACTION_OT_extrapolation_type(wmOperatorType *ot) | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| /* id-props */ | /* id-props */ | ||||
| ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_expo_types, 0, "Type", ""); | ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_expo_types, 0, "Type", ""); | ||||
| } | } | ||||
| /* ******************** Set Interpolation-Type Operator *********************** */ | /* ******************** 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) | static int actkeys_ipo_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| bAnimContext ac; | bAnimContext ac; | ||||
| short mode; | short mode; | ||||
| /* get editor data */ | /* get editor data */ | ||||
| if (ANIM_animdata_get_context(C, &ac) == 0) { | if (ANIM_animdata_get_context(C, &ac) == 0) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { | if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { | ||||
| BKE_report(op->reports, RPT_ERROR, "Not implemented"); | BKE_report(op->reports, RPT_ERROR, "Not implemented"); | ||||
| return OPERATOR_PASS_THROUGH; | return OPERATOR_PASS_THROUGH; | ||||
| } | } | ||||
| /* get handle setting mode */ | /* get handle setting mode */ | ||||
| mode = RNA_enum_get(op->ptr, "type"); | mode = RNA_enum_get(op->ptr, "type"); | ||||
| /* set handle 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 */ | /* set notifier that keyframe properties have changed */ | ||||
| WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL); | WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void ACTION_OT_interpolation_type(wmOperatorType *ot) | void ACTION_OT_interpolation_type(wmOperatorType *ot) | ||||
| Show All 12 Lines | void ACTION_OT_interpolation_type(wmOperatorType *ot) | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| /* id-props */ | /* id-props */ | ||||
| ot->prop = RNA_def_enum( | ot->prop = RNA_def_enum( | ||||
| ot->srna, "type", rna_enum_beztriple_interpolation_mode_items, 0, "Type", ""); | 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 *********************** */ | /* ******************** Set Handle-Type Operator *********************** */ | ||||
| /* this function is responsible for setting handle-type of selected keyframes */ | /* this function is responsible for setting handle-type of selected keyframes */ | ||||
| static void sethandles_action_keys(bAnimContext *ac, short mode) | static void sethandles_action_keys(bAnimContext *ac, short mode) | ||||
| { | { | ||||
| ListBase anim_data = {NULL, NULL}; | ListBase anim_data = {NULL, NULL}; | ||||
| bAnimListElem *ale; | bAnimListElem *ale; | ||||
| int filter; | int filter; | ||||
| ▲ Show 20 Lines • Show All 517 Lines • Show Last 20 Lines | |||||