diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-06-09 16:28:49 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-06-09 16:28:49 +0400 |
commit | abdb8fd94d90a1b9fb262c94dac1ccb52cfee36f (patch) | |
tree | fb7d82ed5c30c25e2ce07945b1938872ad96f96f /source/blender/editors/space_nla/nla_edit.c | |
parent | ca5ff43b1f3efa555b1e52d190c5a97332e01e85 (diff) |
NLA SoC: Added simple delete-strips operator (XKEY/DELKEY)
Diffstat (limited to 'source/blender/editors/space_nla/nla_edit.c')
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 49d43f29c5f..ce62d36e667 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -68,7 +68,7 @@ #include "nla_intern.h" // own include /* *********************************************** */ -/* General Editing */ +/* 'Special' Editing */ /* ******************** Tweak-Mode Operators ***************************** */ /* 'Tweak mode' allows the action referenced by the active NLA-strip to be edited @@ -211,5 +211,66 @@ void NLAEDIT_OT_tweakmode_exit (wmOperatorType *ot) } /* *********************************************** */ +/* NLA Editing Operations */ + +/* ******************** Delete Operator ***************************** */ +/* Deletes the selected NLA-Strips */ + +static int nlaedit_delete_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; + + /* get a list of the AnimData blocks being shown in the NLA */ + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NLATRACKS | ANIMFILTER_FOREDIT); + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + /* for each NLA-Track, delete all selected strips */ + // FIXME: need to double-check that we've got tracks + for (ale= anim_data.first; ale; ale= ale->next) { + NlaTrack *nlt= (NlaTrack *)ale->data; + NlaStrip *strip, *nstrip; + + for (strip= nlt->strips.first; strip; strip= nstrip) { + nstrip= strip->next; + + /* if selected, delete */ + if (strip->flag & NLASTRIP_FLAG_SELECT) + free_nlastrip(&nlt->strips, strip); + } + } + + /* free temp data */ + BLI_freelistN(&anim_data); + + /* set notifier that things have changed */ + ANIM_animdata_send_notifiers(C, &ac, ANIM_CHANGED_BOTH); + WM_event_add_notifier(C, NC_SCENE, NULL); + + /* done */ + return OPERATOR_FINISHED; +} + +void NLAEDIT_OT_delete (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Delete Strips"; + ot->idname= "NLAEDIT_OT_delete"; + ot->description= "Delete selected strips."; + + /* api callbacks */ + ot->exec= nlaedit_delete_exec; + ot->poll= nlaop_poll_tweakmode_off; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} /* *********************************************** */ |