From 4cf9fa3e59ce216e5f2489936a369f8e7b27b3db Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 7 Mar 2009 04:24:28 +0000 Subject: Animation Editors: Copy/Paste Keyframe changes As was discussed by the team the other day, copying keyframes (to copy/paste buffer) in DopeSheet/Graph Editor no longer relies on the selection status of the F-Curves, but rather on the selected keyframes only. This should be less confusing... However, pasting keyframes still relies on having F-Curves selected to aid in the channel-matching process. There is still a lot of room for improvement in this area though (as noted in the code!). --- .../blender/editors/animation/keyframes_general.c | 10 ++++- source/blender/editors/space_action/action_edit.c | 2 +- source/blender/editors/space_graph/graph_edit.c | 46 +++++++++++++++++++++- 3 files changed, 54 insertions(+), 4 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index fc6ed9b00bb..48ca06fb73d 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -420,13 +420,20 @@ short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data) /* clear buffer first */ free_anim_copybuf(); - /* assume that each of these is an ipo-block */ + /* assume that each of these is an F-Curve */ for (ale= anim_data->first; ale; ale= ale->next) { FCurve *fcu= (FCurve *)ale->key_data; tAnimCopybufItem *aci; BezTriple *bezt, *newbuf; int i; + /* firstly, check if F-Curve has any selected keyframes + * - skip if no selected keyframes found (so no need to create unnecessary copy-buffer data) + * - this check should also eliminate any problems associated with using sample-data + */ + if (ANIM_fcurve_keys_bezier_loop(NULL, fcu, NULL, ANIM_editkeyframes_ok(BEZT_OK_SELECTED), NULL) == 0) + continue; + /* init copybuf item info */ aci= MEM_callocN(sizeof(tAnimCopybufItem), "AnimCopybufItem"); aci->id= ale->id; @@ -436,7 +443,6 @@ short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data) BLI_addtail(&animcopybuf, aci); /* add selected keyframes to buffer */ - // XXX we don't cope with sample-data yet // TODO: currently, we resize array everytime we add a new vert - this works ok as long as it is assumed only a few keys are copied for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { if (BEZSELECTED(bezt)) { diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 53403a4e699..fcfddf80330 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -248,7 +248,7 @@ static short copy_action_keys (bAnimContext *ac) free_anim_copybuf(); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* copy keyframes */ diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 932b22c0a6e..d98ed38da9c 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -256,7 +256,7 @@ static short copy_graph_keys (bAnimContext *ac) free_anim_copybuf(); /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* copy keyframes */ @@ -1011,6 +1011,50 @@ void GRAPHEDIT_OT_keyframes_handletype (wmOperatorType *ot) /* ************************************************************************** */ /* TRANSFORM STUFF */ +/* ***************** 'Euler Filter' Operator **************************** */ +/* Euler filter tools (as seen in Maya), are necessary for working with 'baked' + * rotation curves (with Euler rotations). The main purpose of such tools is to + * resolve any discontinuities that may arise in the curves due to the clamping + * of values to -180 degrees to 180 degrees. + */ + +static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op) +{ + bAnimContext ac; + //ListBase anim_data= {NULL, NULL}; + //bAnimListElem *ale; + //int filter; + + /* get editor data */ + if (ANIM_animdata_get_context(C, &ac) == 0) + return OPERATOR_CANCELLED; + + /* The process is done in two passes: + * 1) Sets of three related rotation curves are identified from the selected channels, + * and are stored as a single 'operation unit' for the next step + * 2) Each set of three F-Curves is processed for each keyframe, with the values being + * processed according to one of several ways. + */ + + + // XXX for now + return OPERATOR_CANCELLED; +} + +void GRAPHEDIT_OT_keyframes_euler_filter (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Euler Filter"; + ot->idname= "GRAPHEDIT_OT_keyframes_euler_filter"; + + /* api callbacks */ + ot->exec= graphkeys_euler_filter_exec; + ot->poll= ED_operator_areaactive; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /* ***************** Snap Current Frame Operator *********************** */ /* helper callback for graphkeys_cfrasnap_exec() -> used to help get the average time of all selected beztriples */ -- cgit v1.2.3