/* this function is responsible for setting handle-type of selected keyframes */ static void sethandles_action_keys(bAnimContext *ac, short mode) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; KeyframeEditFunc edit_cb = ANIM_editkeyframes_handles(mode); KeyframeEditFunc sel_cb = ANIM_editkeyframes_ok(BEZT_OK_SELECTED); /* 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 flags for handles * 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) { FCurve *fcu = (FCurve *)ale->key_data; /* any selected keyframes for editing? */ if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, sel_cb, NULL)) { /* change type of selected handles */ ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, edit_cb, calchandles_fcurve); } } /* cleanup */ BLI_freelistN(&anim_data); }
/* this function is responsible for setting handle-type of selected keyframes */ static void sethandles_action_keys(bAnimContext *ac, short mode) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; BeztEditFunc set_cb= ANIM_editkeyframes_handles(mode); /* filter data */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting flags for handles * Note: we do not supply BeztEditData to the looper yet. Currently that's not necessary here... */ for (ale= anim_data.first; ale; ale= ale->next) { if (mode == -1) { BeztEditFunc toggle_cb; /* check which type of handle to set (free or aligned) * - check here checks for handles with free alignment already */ if (ANIM_fcurve_keys_bezier_loop(NULL, ale->key_data, NULL, set_cb, NULL)) toggle_cb= ANIM_editkeyframes_handles(HD_FREE); else toggle_cb= ANIM_editkeyframes_handles(HD_ALIGN); /* set handle-type */ ANIM_fcurve_keys_bezier_loop(NULL, ale->key_data, NULL, toggle_cb, calchandles_fcurve); } else { /* directly set handle-type */ ANIM_fcurve_keys_bezier_loop(NULL, ale->key_data, NULL, set_cb, calchandles_fcurve); } } /* cleanup */ BLI_freelistN(&anim_data); }