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
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')
-rw-r--r--source/blender/editors/space_nla/nla_channels.c54
-rw-r--r--source/blender/editors/space_nla/nla_draw.c5
-rw-r--r--source/blender/editors/space_nla/nla_intern.h1
-rw-r--r--source/blender/editors/space_nla/nla_ops.c5
4 files changed, 61 insertions, 4 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;
+}
+
/* *********************************************** */
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 5a22da2eb25..51c1960c4c6 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -391,9 +391,6 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
NlaStrip *strip;
int index;
- /* draw backdrop? */
- // TODO...
-
/* draw each strip in the track (if visible) */
for (strip=nlt->strips.first, index=1; strip; strip=strip->next, index++) {
if (BKE_nlastrip_within_bounds(strip, v2d->cur.xmin, v2d->cur.xmax)) {
@@ -420,7 +417,7 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
// TODO: if tweaking some action, use the same color as for the tweaked track (quick hack done for now)
if (adt && (adt->flag & ADT_NLA_EDIT_ON)) {
// greenish color (same as tweaking strip) - hardcoded for now
- glColor4f(0.3f, 0.95f, 0.1f, 0.3f); // FIXME: only draw the actual range of the action darker?
+ glColor4f(0.3f, 0.95f, 0.1f, 0.3f);
}
else {
if (ale->data)
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index 79ee5396f36..ef37185fd10 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -106,6 +106,7 @@ void NLAEDIT_OT_split(wmOperatorType *ot);
void NLA_OT_channels_click(wmOperatorType *ot);
void NLA_OT_add_tracks(wmOperatorType *ot);
+void NLA_OT_delete_tracks(wmOperatorType *ot);
/* **************************************** */
/* nla_ops.c */
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index df731e9d0fb..2a6a0c64ea9 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -132,6 +132,7 @@ void nla_operatortypes(void)
WM_operatortype_append(NLA_OT_channels_click);
WM_operatortype_append(NLA_OT_add_tracks);
+ WM_operatortype_append(NLA_OT_delete_tracks);
/* select */
WM_operatortype_append(NLAEDIT_OT_click_select);
@@ -166,6 +167,10 @@ static void nla_keymap_channels (wmWindowManager *wm, ListBase *keymap)
WM_keymap_add_item(keymap, "NLA_OT_add_tracks", AKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "NLA_OT_add_tracks", AKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "above_selected", 1);
+ /* delete tracks */
+ WM_keymap_add_item(keymap, "NLA_OT_delete_tracks", XKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "NLA_OT_delete_tracks", DELKEY, KM_PRESS, 0, 0);
+
/* General Animation Channels keymap (see anim_channels.c) ----------------------- */
/* selection */
/* borderselect - not in tweakmode */