From c81ddc97ef7e6aed227f8893d387849ee8390404 Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Thu, 8 Nov 2018 16:01:02 +0100 Subject: UI: Tweaks to Add menu in Video Sequencer Editor. Mainly organization and bringing it closer to the Add menu in the 3D Viewport. * Icons for most top-level items when available. * New Transitions menu for Cross, Gamma Cross and Wipe. * Move Color and Text to top level. These options are used way too often to be in a submenu. Having a menu with 2 entries defeats the purpose, so I've removed it for now. I checked if add-ons used it and apparently not. It can be brought back if needed. * Avoid empty dropdown in Scene/Mask/Clip. Solution is ugly for now and should be improved in C. * Some effects couldn't be used without 1 or 2 strips selected, now the menu entry is grayed out accordingly. * Some more icons for other menus. --- release/scripts/startup/bl_ui/space_sequencer.py | 125 ++++++++++++++++------- 1 file changed, 90 insertions(+), 35 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index d5d4fa51bf9..c00875d8624 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -278,6 +278,7 @@ class SEQUENCER_MT_marker(Menu): if is_sequencer_view: layout.prop(st, "use_marker_sync") + class SEQUENCER_MT_frame(Menu): bl_label = "Frame" @@ -310,71 +311,121 @@ class SEQUENCER_MT_add(Menu): bl_label = "Add" def draw(self, context): - layout = self.layout + selected_seq = len(bpy.context.selected_sequences) + layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' if len(bpy.data.scenes) > 10: layout.operator_context = 'INVOKE_DEFAULT' - layout.operator("sequencer.scene_strip_add", text="Scene...") + layout.operator("sequencer.scene_strip_add", text="Scene...", icon='SCENE_DATA') + elif len(bpy.data.scenes) > 1: + layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene", icon='SCENE_DATA') else: - layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene") + layout.menu("SEQUENCER_MT_add_empty", text="Scene", icon='SCENE_DATA') if len(bpy.data.movieclips) > 10: layout.operator_context = 'INVOKE_DEFAULT' - layout.operator("sequencer.movieclip_strip_add", text="Clips...") + layout.operator("sequencer.movieclip_strip_add", text="Clip...", icon='CLIP') + elif len(bpy.data.movieclips) > 1: + layout.operator_menu_enum("sequencer.movieclip_strip_add", "clip", text="Clip", icon='CLIP') else: - layout.operator_menu_enum("sequencer.movieclip_strip_add", "clip", text="Clip") + layout.menu("SEQUENCER_MT_add_empty", text="Clip", icon='CLIP') if len(bpy.data.masks) > 10: layout.operator_context = 'INVOKE_DEFAULT' - layout.operator("sequencer.mask_strip_add", text="Masks...") + layout.operator("sequencer.mask_strip_add", text="Mask...", icon='MOD_MASK') + elif len(bpy.data.masks) > 1: + layout.operator_menu_enum("sequencer.mask_strip_add", "mask", text="Mask", icon='MOD_MASK') else: - layout.operator_menu_enum("sequencer.mask_strip_add", "mask", text="Mask") + layout.menu("SEQUENCER_MT_add_empty", text="Mask", icon='MOD_MASK') + + layout.separator() + + layout.operator("sequencer.movie_strip_add", text="Movie", icon='FILE_MOVIE') + layout.operator("sequencer.sound_strip_add", text="Sound", icon='FILE_SOUND') + layout.operator("sequencer.image_strip_add", text="Image/Sequence", icon='FILE_IMAGE') + + layout.separator() + + layout.operator_context = 'INVOKE_REGION_WIN' + layout.operator("sequencer.effect_strip_add", text="Color", icon='COLOR').type = 'COLOR' + layout.operator("sequencer.effect_strip_add", text="Text", icon='FONT_DATA').type = 'TEXT' + + layout.separator() - layout.operator("sequencer.movie_strip_add", text="Movie") - layout.operator("sequencer.image_strip_add", text="Image") - layout.operator("sequencer.sound_strip_add", text="Sound") + layout.operator("sequencer.effect_strip_add", text="Adjustment Layer", icon='COLOR').type = 'ADJUSTMENT' - layout.menu("SEQUENCER_MT_add_generate") + layout.operator_context = 'INVOKE_DEFAULT' layout.menu("SEQUENCER_MT_add_effect") + col = layout.column() + col.menu("SEQUENCER_MT_add_transitions") + col.enabled = selected_seq >= 2 + -class SEQUENCER_MT_add_generate(Menu): - bl_label = "Generate" +class SEQUENCER_MT_add_empty(Menu): + bl_label = "Empty" def draw(self, context): layout = self.layout - layout.operator_context = 'INVOKE_REGION_WIN' - layout.operator("sequencer.effect_strip_add", text="Color").type = 'COLOR' - layout.operator("sequencer.effect_strip_add", text="Text").type = 'TEXT' + layout.label(text="No Items Available") + + +class SEQUENCER_MT_add_transitions(Menu): + bl_label = "Transitions" + + def draw(self, context): + selected_seq = len(bpy.context.selected_sequences) + + layout = self.layout + + col = layout.column() + col.operator("sequencer.effect_strip_add", text="Cross").type = 'CROSS' + col.operator("sequencer.effect_strip_add", text="Gamma Cross").type = 'GAMMA_CROSS' + + col.separator() + + col.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE' + col.enabled = selected_seq >= 2 class SEQUENCER_MT_add_effect(Menu): bl_label = "Effect Strip" def draw(self, context): - layout = self.layout + selected_seq = len(bpy.context.selected_sequences) + + layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - layout.operator("sequencer.effect_strip_add", text="Add").type = 'ADD' - layout.operator("sequencer.effect_strip_add", text="Subtract").type = 'SUBTRACT' - layout.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER' - layout.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER' - layout.operator("sequencer.effect_strip_add", text="Cross").type = 'CROSS' - layout.operator("sequencer.effect_strip_add", text="Gamma Cross").type = 'GAMMA_CROSS' - layout.operator("sequencer.effect_strip_add", text="Gaussian Blur").type = 'GAUSSIAN_BLUR' - layout.operator("sequencer.effect_strip_add", text="Multiply").type = 'MULTIPLY' - layout.operator("sequencer.effect_strip_add", text="Over Drop").type = 'OVER_DROP' - layout.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE' - layout.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW' - layout.operator("sequencer.effect_strip_add", text="Color Mix").type = 'COLORMIX' - layout.operator("sequencer.effect_strip_add", text="Transform").type = 'TRANSFORM' - layout.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED' + col = layout.column() + col.operator("sequencer.effect_strip_add", text="Add").type = 'ADD' + col.operator("sequencer.effect_strip_add", text="Subtract").type = 'SUBTRACT' + col.operator("sequencer.effect_strip_add", text="Multiply").type = 'MULTIPLY' + col.operator("sequencer.effect_strip_add", text="Over Drop").type = 'OVER_DROP' + col.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER' + col.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER' + col.operator("sequencer.effect_strip_add", text="Color Mix").type = 'COLORMIX' + col.enabled = selected_seq >=2 + + layout.separator() + layout.operator("sequencer.effect_strip_add", text="Multicam Selector").type = 'MULTICAM' - layout.operator("sequencer.effect_strip_add", text="Adjustment Layer").type = 'ADJUSTMENT' + + layout.separator() + + col = layout.column() + col.operator("sequencer.effect_strip_add", text="Transform").type = 'TRANSFORM' + col.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED' + + col.separator() + + col.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW' + col.operator("sequencer.effect_strip_add", text="Gaussian Blur").type = 'GAUSSIAN_BLUR' + col.enabled = selected_seq != 0 class SEQUENCER_MT_strip_transform(Menu): @@ -424,8 +475,11 @@ class SEQUENCER_MT_strip_lock_mute(Menu): def draw(self, context): layout = self.layout - layout.operator("sequencer.lock") + layout.operator("sequencer.lock", icon='LOCK') layout.operator("sequencer.unlock") + + layout.separator() + layout.operator("sequencer.mute").unselected = False layout.operator("sequencer.unmute").unselected = False layout.operator("sequencer.mute", text="Mute Deselected Strips").unselected = True @@ -746,7 +800,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel): row = col.row(align=True) row.prop(strip, "location", text="") col.prop(strip, "wrap_width") - layout.operator("sequencer.export_subtitles") + layout.operator("sequencer.export_subtitles", icon='EXPORT') col = layout.column(align=True) if strip.type == 'SPEED': @@ -1301,8 +1355,9 @@ classes = ( SEQUENCER_MT_marker, SEQUENCER_MT_frame, SEQUENCER_MT_add, - SEQUENCER_MT_add_generate, SEQUENCER_MT_add_effect, + SEQUENCER_MT_add_transitions, + SEQUENCER_MT_add_empty, SEQUENCER_MT_strip, SEQUENCER_MT_strip_transform, SEQUENCER_MT_strip_input, -- cgit v1.2.3