Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-06-24 16:12:11 +0400
committerJoshua Leung <aligorith@gmail.com>2009-06-24 16:12:11 +0400
commit3533cda80c7b52f8ffca3e3928bedb5bfa96b320 (patch)
treecd28e8b31fd30b8a52efb9f15a1cd4be615fb704 /source/blender/editors/space_nla/nla_channels.c
parente5119ee2c0d5b9510d89364600e08e40a4407f40 (diff)
NLA SoC: Delete Tracks Operator (XKEY / DELKEY) over the channel list
This deletes all the strips in the relevant (selected) tracks too.
Diffstat (limited to 'source/blender/editors/space_nla/nla_channels.c')
-rw-r--r--source/blender/editors/space_nla/nla_channels.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index a1c0de1e552..0a2c32b5f52 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -423,4 +423,58 @@ void NLA_OT_add_tracks (wmOperatorType *ot)
RNA_def_boolean(ot->srna, "above_selected", 0, "Above Selected", "Add a new NLA Track above every existing selected one.");
}
+/* ******************** Delete Tracks Operator ***************************** */
+/* Delete selected NLA Tracks */
+
+static int nlaedit_delete_tracks_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_SEL);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ /* delete tracks */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ NlaTrack *nlt= (NlaTrack *)ale->data;
+ AnimData *adt= BKE_animdata_from_id(ale->id);
+
+ /* call delete on this track - deletes all strips too */
+ free_nlatrack(&adt->nla_tracks, nlt);
+ }
+
+ /* 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 NLA_OT_delete_tracks (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Delete Tracks";
+ ot->idname= "NLA_OT_delete_tracks";
+ ot->description= "Delete selected NLA-Tracks and the strips they contain.";
+
+ /* api callbacks */
+ ot->exec= nlaedit_delete_tracks_exec;
+ ot->poll= nlaop_poll_tweakmode_off;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
/* *********************************************** */