UI: VSE strip menu reorganization
authorAaron Carlisle <carlisle.b3d@gmail.com>
Mon, 9 Oct 2017 02:47:05 +0000 (13:47 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 9 Oct 2017 02:59:49 +0000 (13:59 +1100)
Add Inputs and Transform submenus.

release/scripts/startup/bl_ui/space_sequencer.py
source/blender/editors/space_sequencer/sequencer_edit.c

index 06dd90685b768afe04ec6faba29dcdacebeed2b8..82f83c2ddc9e92cd89decd2d9fb6996cc883862f 100644 (file)
@@ -21,10 +21,10 @@ import bpy
 from bpy.types import Header, Menu, Panel
 from rna_prop_ui import PropertyPanel
 from bl_ui.properties_grease_pencil_common import (
-        GreasePencilDataPanel,
-        GreasePencilPaletteColorPanel,
-        GreasePencilToolsPanel,
-        )
+    GreasePencilDataPanel,
+    GreasePencilPaletteColorPanel,
+    GreasePencilToolsPanel,
+)
 from bpy.app.translations import pgettext_iface as iface_
 
 
@@ -44,7 +44,7 @@ def draw_color_balance(layout, color_balance):
     col.separator()
     col.prop(color_balance, "lift", text="")
     col.prop(color_balance, "invert_lift", text="Invert", icon='ARROW_LEFTRIGHT')
-    split.template_color_picker(color_balance, "lift", value_slider=True,  cubic=True)
+    split.template_color_picker(color_balance, "lift", value_slider=True, cubic=True)
 
     box = layout.box()
     split = box.split(percentage=0.35)
@@ -197,14 +197,18 @@ class SEQUENCER_MT_view(Menu):
             layout.operator_context = 'INVOKE_DEFAULT'
         if is_preview:
             layout.operator_context = 'INVOKE_REGION_PREVIEW'
-            layout.operator("sequencer.view_all_preview", text="Fit Preview in Window")
+            layout.operator("sequencer.view_all_preview", text="Fit Preview in window")
 
             layout.separator()
 
             ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
 
             for a, b in ratios:
-                layout.operator("sequencer.view_zoom_ratio", text=iface_("Zoom %d:%d") % (a, b), translate=False).ratio = a / b
+                layout.operator(
+                    "sequencer.view_zoom_ratio",
+                    text=iface_("Zoom %d:%d") % (a, b),
+                    translate=False,
+                ).ratio = a / b
 
             layout.separator()
 
@@ -276,30 +280,6 @@ class SEQUENCER_MT_marker(Menu):
         marker_menu_generic(layout)
 
 
-class SEQUENCER_MT_change(Menu):
-    bl_label = "Change"
-
-    def draw(self, context):
-        layout = self.layout
-        strip = act_strip(context)
-
-        layout.operator_context = 'INVOKE_REGION_WIN'
-
-        layout.operator_menu_enum("sequencer.change_effect_input", "swap")
-        layout.operator_menu_enum("sequencer.change_effect_type", "type")
-        prop = layout.operator("sequencer.change_path", text="Path/Files")
-
-        if strip:
-            stype = strip.type
-
-            if stype == 'IMAGE':
-                prop.filter_image = True
-            elif stype == 'MOVIE':
-                prop.filter_movie = True
-            elif stype == 'SOUND':
-                prop.filter_sound = True
-
-
 class SEQUENCER_MT_frame(Menu):
     bl_label = "Frame"
 
@@ -388,87 +368,124 @@ class SEQUENCER_MT_add_effect(Menu):
         layout.operator("sequencer.effect_strip_add", text="Adjustment Layer").type = 'ADJUSTMENT'
 
 
-class SEQUENCER_MT_strip(Menu):
-    bl_label = "Strip"
+class SEQUENCER_MT_strip_transform(Menu):
+    bl_label = "Transform"
 
     def draw(self, context):
         layout = self.layout
 
-        layout.operator_context = 'INVOKE_REGION_WIN'
-
         layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
         layout.operator("transform.transform", text="Grab/Extend from Frame").mode = 'TIME_EXTEND'
-        layout.operator("sequencer.gap_remove").all = False
-        layout.operator("sequencer.gap_insert")
+        layout.operator("sequencer.slip", text="Slip Strip Contents")
 
-        #  uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
         layout.separator()
+        layout.operator_menu_enum("sequencer.swap", "side")
 
-        layout.operator("sequencer.cut", text="Cut (Hard) at Frame").type = 'HARD'
-        layout.operator("sequencer.cut", text="Cut (Soft) at Frame").type = 'SOFT'
-        layout.operator("sequencer.slip", text="Slip Strip Contents")
-        layout.operator("sequencer.images_separate")
-        layout.operator("sequencer.offset_clear")
-        layout.operator("sequencer.deinterlace_selected_movies")
-        layout.operator("sequencer.rebuild_proxy")
         layout.separator()
+        layout.operator("sequencer.gap_remove").all = False
+        layout.operator("sequencer.gap_insert")
 
-        layout.operator("sequencer.duplicate_move")
-        layout.operator("sequencer.delete")
 
+class SEQUENCER_MT_strip_input(Menu):
+    bl_label = "Inputs"
+
+    def draw(self, context):
+        layout = self.layout
         strip = act_strip(context)
 
+        layout.operator("sequencer.reload", text="Reload Strips")
+        layout.operator("sequencer.reload", text="Reload Strips and Adjust Length").adjust_length = True
+        prop = layout.operator("sequencer.change_path", text="Change Path/Files")
+        layout.operator("sequencer.swap_data", text="Swap Data")
+
         if strip:
             stype = strip.type
 
-            # XXX note strip.type is never equal to 'EFFECT', look at seq_type_items within rna_sequencer.c
-            if stype == 'EFFECT':
-                pass
-                # layout.separator()
-                # layout.operator("sequencer.effect_change")
-                # layout.operator("sequencer.effect_reassign_inputs")
-            elif stype == 'IMAGE':
-                layout.separator()
-                # layout.operator("sequencer.image_change")
-                layout.operator("sequencer.rendersize")
-            elif stype == 'SCENE':
-                pass
-                # layout.separator()
-                # layout.operator("sequencer.scene_change", text="Change Scene")
+            if stype == 'IMAGE':
+                prop.filter_image = True
             elif stype == 'MOVIE':
-                layout.separator()
-                # layout.operator("sequencer.movie_change")
-                layout.operator("sequencer.rendersize")
+                prop.filter_movie = True
             elif stype == 'SOUND':
-                layout.separator()
-                layout.operator("sequencer.crossfade_sounds")
+                prop.filter_sound = True
 
-        layout.separator()
-        layout.operator("sequencer.meta_make")
-        layout.operator("sequencer.meta_separate")
 
-        layout.separator()
-        layout.operator("sequencer.reload", text="Reload Strips")
-        layout.operator("sequencer.reload", text="Reload Strips and Adjust Length").adjust_length = True
-        layout.operator("sequencer.reassign_inputs")
-        layout.operator("sequencer.swap_inputs")
+class SEQUENCER_MT_strip_lock_mute(Menu):
+    bl_label = "Lock/Mute"
+
+    def draw(self, context):
+        layout = self.layout
 
-        layout.separator()
         layout.operator("sequencer.lock")
         layout.operator("sequencer.unlock")
         layout.operator("sequencer.mute").unselected = False
         layout.operator("sequencer.unmute").unselected = False
-
         layout.operator("sequencer.mute", text="Mute Deselected Strips").unselected = True
 
+
+class SEQUENCER_MT_strip(Menu):
+    bl_label = "Strip"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator_context = 'INVOKE_REGION_WIN'
+
+        layout.operator("ed.undo")
+        layout.operator("ed.redo")
+        layout.operator("ed.undo_history")
+
+        layout.separator()
+        layout.menu("SEQUENCER_MT_strip_transform")
         layout.operator("sequencer.snap")
+        layout.operator("sequencer.offset_clear")
 
-        layout.operator_menu_enum("sequencer.swap", "side")
+        layout.separator()
+        layout.operator("sequencer.duplicate_move")
+        layout.operator("sequencer.delete", text="Delete...")
 
         layout.separator()
+        layout.operator("sequencer.cut", text="Cut (Hard) at frame").type = 'HARD'
+        layout.operator("sequencer.cut", text="Cut (Soft) at frame").type = 'SOFT'
 
-        layout.operator("sequencer.swap_data")
-        layout.menu("SEQUENCER_MT_change")
+        layout.separator()
+        layout.operator("sequencer.deinterlace_selected_movies")
+        layout.operator("sequencer.rebuild_proxy")
+
+        strip = act_strip(context)
+
+        if strip:
+            stype = strip.type
+
+            if stype in {
+                    'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
+                    'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'WIPE', 'GLOW',
+                    'TRANSFORM', 'COLOR', 'SPEED', 'MULTICAM', 'ADJUSTMENT',
+                    'GAUSSIAN_BLUR', 'TEXT',
+            }:
+                layout.separator()
+                layout.operator_menu_enum("sequencer.change_effect_input", "swap")
+                layout.operator_menu_enum("sequencer.change_effect_type", "type")
+                layout.operator("sequencer.reassign_inputs")
+                layout.operator("sequencer.swap_inputs")
+            elif stype in {'IMAGE', 'MOVIE'}:
+                layout.separator()
+                layout.operator("sequencer.rendersize")
+                layout.operator("sequencer.images_separate")
+            elif stype == 'SOUND':
+                layout.separator()
+                layout.operator("sequencer.crossfade_sounds")
+            elif stype == 'META':
+                layout.separator()
+                layout.operator("sequencer.meta_separate")
+
+        layout.separator()
+        layout.operator("sequencer.meta_make")
+
+        layout.separator()
+        layout.menu("SEQUENCER_MT_strip_input")
+
+        layout.separator()
+        layout.menu("SEQUENCER_MT_strip_lock_mute")
 
 
 class SequencerButtonsPanel:
@@ -532,7 +549,6 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
             row = layout.row()
             row.prop(strip, "mute", toggle=True, icon_only=True, icon='MUTE_IPO_OFF')
 
-
         col = layout.column(align=True)
         row = col.row(align=True)
 
@@ -582,10 +598,12 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
         if not strip:
             return False
 
-        return strip.type in {'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
-                              'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
-                              'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
-                              'MULTICAM', 'GAUSSIAN_BLUR', 'TEXT'}
+        return strip.type in {
+            'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
+            'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
+            'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
+            'MULTICAM', 'GAUSSIAN_BLUR', 'TEXT',
+        }
 
     def draw(self, context):
         layout = self.layout
@@ -700,7 +718,6 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
                 col.separator()
                 col.label(text="Two or more channels are needed below this strip", icon='INFO')
 
-
         elif strip.type == 'TEXT':
             col = layout.column()
             col.prop(strip, "text")
@@ -748,11 +765,13 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
         if not strip:
             return False
 
-        return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'META',
-                              'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
-                              'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
-                              'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
-                              'MULTICAM', 'SPEED', 'ADJUSTMENT'}
+        return strip.type in {
+            'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'META',
+            'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
+            'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
+            'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
+            'MULTICAM', 'SPEED', 'ADJUSTMENT',
+        }
 
     def draw(self, context):
         layout = self.layout
@@ -985,11 +1004,13 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
         if not strip:
             return False
 
-        return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'MASK',
-                              'META', 'ADD', 'SUBTRACT', 'ALPHA_OVER',
-                              'ALPHA_UNDER', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY',
-                              'OVER_DROP', 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
-                              'MULTICAM', 'SPEED', 'ADJUSTMENT'}
+        return strip.type in {
+            'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'MASK',
+            'META', 'ADD', 'SUBTRACT', 'ALPHA_OVER',
+            'ALPHA_UNDER', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY',
+            'OVER_DROP', 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
+            'MULTICAM', 'SPEED', 'ADJUSTMENT',
+        }
 
     def draw(self, context):
         layout = self.layout
@@ -1269,11 +1290,13 @@ classes = (
     SEQUENCER_MT_view_toggle,
     SEQUENCER_MT_select,
     SEQUENCER_MT_marker,
-    SEQUENCER_MT_change,
     SEQUENCER_MT_frame,
     SEQUENCER_MT_add,
     SEQUENCER_MT_add_effect,
     SEQUENCER_MT_strip,
+    SEQUENCER_MT_strip_transform,
+    SEQUENCER_MT_strip_input,
+    SEQUENCER_MT_strip_lock_mute,
     SEQUENCER_PT_edit,
     SEQUENCER_PT_effect,
     SEQUENCER_PT_input,
index b22a158e15176aa93339cf28a85c454eb2367c4e..196527dcc60c056d1dd45d81ce32a1a5b97d742a 100644 (file)
@@ -1232,7 +1232,7 @@ static int sequencer_snap_invoke(bContext *C, wmOperator *op, const wmEvent *UNU
 void SEQUENCER_OT_snap(struct wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name = "Snap Strips";
+       ot->name = "Snap Strips to Frame";
        ot->idname = "SEQUENCER_OT_snap";
        ot->description = "Frame where selected strips will be snapped";