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!).
This commit is contained in:
parent
c07acfb4fd
commit
4cf9fa3e59
@ -420,13 +420,20 @@ short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data)
|
|||||||
/* clear buffer first */
|
/* clear buffer first */
|
||||||
free_anim_copybuf();
|
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) {
|
for (ale= anim_data->first; ale; ale= ale->next) {
|
||||||
FCurve *fcu= (FCurve *)ale->key_data;
|
FCurve *fcu= (FCurve *)ale->key_data;
|
||||||
tAnimCopybufItem *aci;
|
tAnimCopybufItem *aci;
|
||||||
BezTriple *bezt, *newbuf;
|
BezTriple *bezt, *newbuf;
|
||||||
int i;
|
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 */
|
/* init copybuf item info */
|
||||||
aci= MEM_callocN(sizeof(tAnimCopybufItem), "AnimCopybufItem");
|
aci= MEM_callocN(sizeof(tAnimCopybufItem), "AnimCopybufItem");
|
||||||
aci->id= ale->id;
|
aci->id= ale->id;
|
||||||
@ -436,7 +443,6 @@ short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data)
|
|||||||
BLI_addtail(&animcopybuf, aci);
|
BLI_addtail(&animcopybuf, aci);
|
||||||
|
|
||||||
/* add selected keyframes to buffer */
|
/* 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
|
// 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++) {
|
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
||||||
if (BEZSELECTED(bezt)) {
|
if (BEZSELECTED(bezt)) {
|
||||||
|
@ -248,7 +248,7 @@ static short copy_action_keys (bAnimContext *ac)
|
|||||||
free_anim_copybuf();
|
free_anim_copybuf();
|
||||||
|
|
||||||
/* filter data */
|
/* 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);
|
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||||
|
|
||||||
/* copy keyframes */
|
/* copy keyframes */
|
||||||
|
@ -256,7 +256,7 @@ static short copy_graph_keys (bAnimContext *ac)
|
|||||||
free_anim_copybuf();
|
free_anim_copybuf();
|
||||||
|
|
||||||
/* filter data */
|
/* 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);
|
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||||
|
|
||||||
/* copy keyframes */
|
/* copy keyframes */
|
||||||
@ -1011,6 +1011,50 @@ void GRAPHEDIT_OT_keyframes_handletype (wmOperatorType *ot)
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* TRANSFORM STUFF */
|
/* 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 *********************** */
|
/* ***************** Snap Current Frame Operator *********************** */
|
||||||
|
|
||||||
/* helper callback for graphkeys_cfrasnap_exec() -> used to help get the average time of all selected beztriples */
|
/* helper callback for graphkeys_cfrasnap_exec() -> used to help get the average time of all selected beztriples */
|
||||||
|
Loading…
Reference in New Issue
Block a user