Merging r50147 through r50148 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 23 Aug 2012 09:05:45 +0000 (09:05 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 23 Aug 2012 09:05:45 +0000 (09:05 +0000)
release/scripts/startup/bl_ui/space_sequencer.py
source/blender/editors/space_sequencer/sequencer_intern.h
source/blender/editors/space_sequencer/sequencer_modifier.c
source/blender/editors/space_sequencer/sequencer_ops.c

index a0121867199d8fdbcce62e876a2e857cef3e1850..2fcd5ef8a87ce4ed2e75c2f48c4e358ac9b64310 100644 (file)
@@ -904,10 +904,19 @@ class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel):
 
             row = box.row()
             row.prop(mod, "show_expanded", text="", emboss=False)
-            row.prop(mod, "name")
+            row.prop(mod, "name", text="")
 
             row.prop(mod, "mute", text="")
-            props = row.operator("sequencer.strip_modifier_remove", text="", icon='X')
+
+            sub = row.row(align=True)
+            props = sub.operator("sequencer.strip_modifier_move", text="", icon='TRIA_UP')
+            props.name = mod.name
+            props.direction = 'UP'
+            props = sub.operator("sequencer.strip_modifier_move", text="", icon='TRIA_DOWN')
+            props.name = mod.name
+            props.direction = 'DOWN'
+
+            props = row.operator("sequencer.strip_modifier_remove", text="", icon='X', emboss=False)
             props.name = mod.name
 
             if mod.show_expanded:
index b87c5c454c72e0a517900104c7604ef5736280be..4ee9c6710bcd88b1d8eefccda941c70ece857864 100644 (file)
@@ -179,6 +179,7 @@ void SEQUENCER_OT_properties(struct wmOperatorType *ot);
 /* sequencer_modifiers.c */
 void SEQUENCER_OT_strip_modifier_add(struct wmOperatorType *ot);
 void SEQUENCER_OT_strip_modifier_remove(struct wmOperatorType *ot);
+void SEQUENCER_OT_strip_modifier_move(struct wmOperatorType *ot);
 
 #endif /* __SEQUENCER_INTERN_H__ */
 
index b19d92d67a0382c8eee9df3f78fce8f16de3204e..a4a485b34c6ae87d60bcd6043dad216a0a7d25b9 100644 (file)
@@ -154,3 +154,69 @@ void SEQUENCER_OT_strip_modifier_remove(wmOperatorType *ot)
        /* properties */
        RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove");
 }
+
+/*********************** Move operator *************************/
+
+enum {
+       SEQ_MODIFIER_MOVE_UP = 0,
+       SEQ_MODIFIER_MOVE_DOWN
+};
+
+static int strip_modifier_move_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene = CTX_data_scene(C);
+       Sequence *seq = BKE_sequencer_active_get(scene);
+       char name[MAX_NAME];
+       int direction;
+       SequenceModifierData *smd;
+
+       RNA_string_get(op->ptr, "name", name);
+       direction = RNA_enum_get(op->ptr, "direction");
+
+       smd = BKE_sequence_modifier_find_by_name(seq, name);
+       if (!smd)
+               return OPERATOR_CANCELLED;
+
+       if (direction == SEQ_MODIFIER_MOVE_UP) {
+               if (smd->prev) {
+                       BLI_remlink(&seq->modifiers, smd);
+                       BLI_insertlink(&seq->modifiers, smd->prev->prev, smd);
+               }
+       }
+       else if (direction == SEQ_MODIFIER_MOVE_DOWN) {
+               if (smd->next) {
+                       BLI_remlink(&seq->modifiers, smd);
+                       BLI_insertlink(&seq->modifiers, smd->next, smd);
+               }
+       }
+
+       BKE_sequence_invalidate_cache(scene, seq);
+       WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
+
+       return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_strip_modifier_move(wmOperatorType *ot)
+{
+       static EnumPropertyItem direction_items[] = {
+               {SEQ_MODIFIER_MOVE_UP, "UP", 0, "Up", "Move modifier up in the stack"},
+               {SEQ_MODIFIER_MOVE_DOWN, "DOWN", 0, "Down", "Move modifier down in the stack"},
+               {0, NULL, 0, NULL, NULL}
+       };
+
+       /* identifiers */
+       ot->name = "Move Strip Modifier";
+       ot->idname = "SEQUENCER_OT_strip_modifier_move";
+       ot->description = "Move modifier up and down in the stack";
+
+       /* api callbacks */
+       ot->exec = strip_modifier_move_exec;
+       ot->poll = strip_modifier_active_poll;
+
+       /* flags */
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+       /* properties */
+       RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove");
+       RNA_def_enum(ot->srna, "direction", direction_items, SEQ_MODIFIER_MOVE_UP, "Type", "");
+}
index e434e6b94e79d19d5a701447bfc96454a33868fc..960ae50212667a8637a251121d00a3c1b6d38c2b 100644 (file)
@@ -117,6 +117,7 @@ void sequencer_operatortypes(void)
        /* sequencer_modifiers.c */
        WM_operatortype_append(SEQUENCER_OT_strip_modifier_add);
        WM_operatortype_append(SEQUENCER_OT_strip_modifier_remove);
+       WM_operatortype_append(SEQUENCER_OT_strip_modifier_move);
 }