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-07-09 05:32:13 +0400
committerJoshua Leung <aligorith@gmail.com>2009-07-09 05:32:13 +0400
commit27d80365fa3abf5db3ebf509d712d947564d8447 (patch)
tree2b59965b1626b8c76c6e46589a7e0ffde1e024b9 /source/blender/editors/space_nla
parent518911e78c2ae4511cbb9261c5cca410c0a77d73 (diff)
NLA SoC: Toggle muting operator - HKEY
This operator provides a quick way of toggling the muted-status of several strips at the same time.
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r--source/blender/editors/space_nla/nla_edit.c60
-rw-r--r--source/blender/editors/space_nla/nla_header.c4
-rw-r--r--source/blender/editors/space_nla/nla_intern.h2
-rw-r--r--source/blender/editors/space_nla/nla_ops.c5
4 files changed, 71 insertions, 0 deletions
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 0198a66949e..262255524db 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -857,6 +857,66 @@ void NLA_OT_split (wmOperatorType *ot)
/* *********************************************** */
/* NLA Editing Operations (Modifying) */
+/* ******************** Toggle Muting Operator ************************** */
+/* Toggles whether strips are muted or not */
+
+static int nlaedit_toggle_mute_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 editable tracks being shown in the NLA */
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NLATRACKS | ANIMFILTER_FOREDIT);
+ ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+
+ /* go over all selected strips */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ NlaTrack *nlt= (NlaTrack *)ale->data;
+ NlaStrip *strip;
+
+ /* for every selected strip, toggle muting */
+ for (strip= nlt->strips.first; strip; strip= strip->next) {
+ if (strip->flag & NLASTRIP_FLAG_SELECT) {
+ /* just flip the mute flag for now */
+ // TODO: have a pre-pass to check if mute all or unmute all?
+ strip->flag ^= NLASTRIP_FLAG_MUTED;
+ }
+ }
+ }
+
+ /* 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_mute_toggle (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Toggle Muting";
+ ot->idname= "NLA_OT_mute_toggle";
+ ot->description= "Mute or un-muted selected strips.";
+
+ /* api callbacks */
+ ot->exec= nlaedit_toggle_mute_exec;
+ ot->poll= nlaop_poll_tweakmode_off;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
/* ******************** Move Strips Up Operator ************************** */
/* Tries to move the selected strips into the track above if possible. */
diff --git a/source/blender/editors/space_nla/nla_header.c b/source/blender/editors/space_nla/nla_header.c
index 9a2806ed9c1..a82056d6efb 100644
--- a/source/blender/editors/space_nla/nla_header.c
+++ b/source/blender/editors/space_nla/nla_header.c
@@ -168,6 +168,10 @@ static void nla_editmenu(bContext *C, uiLayout *layout, void *arg_unused)
uiItemS(layout);
+ uiItemO(layout, NULL, 0, "NLA_OT_mute_toggle");
+
+ uiItemS(layout);
+
uiItemO(layout, NULL, 0, "NLA_OT_apply_scale");
uiItemO(layout, NULL, 0, "NLA_OT_clear_scale");
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index 3d8bfcd0546..7cc09707ba7 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -98,6 +98,8 @@ void NLA_OT_duplicate(wmOperatorType *ot);
void NLA_OT_delete(wmOperatorType *ot);
void NLA_OT_split(wmOperatorType *ot);
+void NLA_OT_mute_toggle(wmOperatorType *ot);
+
void NLA_OT_move_up(wmOperatorType *ot);
void NLA_OT_move_down(wmOperatorType *ot);
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 25fd8db668c..431768c4e02 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -153,6 +153,8 @@ void nla_operatortypes(void)
WM_operatortype_append(NLA_OT_delete);
WM_operatortype_append(NLA_OT_split);
+ WM_operatortype_append(NLA_OT_mute_toggle);
+
WM_operatortype_append(NLA_OT_move_up);
WM_operatortype_append(NLA_OT_move_down);
@@ -256,6 +258,9 @@ static void nla_keymap_main (wmWindowManager *wm, ListBase *keymap)
/* split */
WM_keymap_add_item(keymap, "NLA_OT_split", YKEY, KM_PRESS, 0, 0);
+ /* toggles */
+ WM_keymap_add_item(keymap, "NLA_OT_mute_toggle", HKEY, KM_PRESS, 0, 0);
+
/* move up */
WM_keymap_add_item(keymap, "NLA_OT_move_up", PAGEUPKEY, KM_PRESS, 0, 0);
/* move down */