diff options
Diffstat (limited to 'release/scripts/startup/bl_ui/space_sequencer.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_sequencer.py | 264 |
1 files changed, 174 insertions, 90 deletions
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 9b96cef9de4..120b2d7c13a 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -37,6 +37,14 @@ from bl_ui.space_toolsystem_common import ( from rna_prop_ui import PropertyPanel +def _space_view_types(st): + view_type = st.view_type + return ( + view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}, + view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}, + ) + + def selected_sequences_len(context): selected_sequences = getattr(context, "selected_sequences", None) if selected_sequences is None: @@ -228,15 +236,19 @@ class SEQUENCER_MT_editor_menus(Menu): def draw(self, context): layout = self.layout st = context.space_data + has_sequencer, _has_preview = _space_view_types(st) layout.menu("SEQUENCER_MT_view") + layout.menu("SEQUENCER_MT_select") - if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}: - layout.menu("SEQUENCER_MT_select") + if has_sequencer: if st.show_markers: layout.menu("SEQUENCER_MT_marker") layout.menu("SEQUENCER_MT_add") - layout.menu("SEQUENCER_MT_strip") + + layout.menu("SEQUENCER_MT_strip") + + layout.menu("SEQUENCER_MT_image") class SEQUENCER_PT_gizmo_display(Panel): @@ -559,8 +571,14 @@ class SEQUENCER_MT_select_linked(Menu): class SEQUENCER_MT_select(Menu): bl_label = "Select" - def draw(self, _context): + def draw(self, context): layout = self.layout + st = context.space_data + has_sequencer, has_preview = _space_view_types(st) + + # FIXME: this doesn't work for both preview + window region. + if has_preview: + layout.operator_context = 'INVOKE_REGION_PREVIEW' layout.operator("sequencer.select_all", text="All").action = 'SELECT' layout.operator("sequencer.select_all", text="None").action = 'DESELECT' @@ -569,17 +587,20 @@ class SEQUENCER_MT_select(Menu): layout.separator() layout.operator("sequencer.select_box", text="Box Select") - props = layout.operator("sequencer.select_box", text="Box Select (Include Handles)") - props.include_handles = True + if has_sequencer: + props = layout.operator("sequencer.select_box", text="Box Select (Include Handles)") + props.include_handles = True layout.separator() - layout.operator_menu_enum("sequencer.select_side_of_frame", "side", text="Side of Frame...") - layout.menu("SEQUENCER_MT_select_handle", text="Handle") - layout.menu("SEQUENCER_MT_select_channel", text="Channel") - layout.menu("SEQUENCER_MT_select_linked", text="Linked") + if has_sequencer: + layout.operator_menu_enum("sequencer.select_side_of_frame", "side", text="Side of Frame...") + layout.menu("SEQUENCER_MT_select_handle", text="Handle") + layout.menu("SEQUENCER_MT_select_channel", text="Channel") + layout.menu("SEQUENCER_MT_select_linked", text="Linked") + + layout.separator() - layout.separator() layout.operator_menu_enum("sequencer.select_grouped", "type", text="Grouped") @@ -787,43 +808,43 @@ class SEQUENCER_MT_add_effect(Menu): col.enabled = selected_sequences_len(context) != 0 -class SEQUENCER_MT_strip_image_transform(Menu): - bl_label = "Image Transform" - - def draw(self, _context): - layout = self.layout - - layout.operator("sequencer.strip_transform_fit", text="Scale To Fit").fit_method = 'FIT' - layout.operator("sequencer.strip_transform_fit", text="Scale to Fill").fit_method = 'FILL' - layout.operator("sequencer.strip_transform_fit", text="Stretch To Fill").fit_method = 'STRETCH' - layout.separator() - - layout.operator("sequencer.strip_transform_clear", text="Clear Position").property = 'POSITION' - layout.operator("sequencer.strip_transform_clear", text="Clear Scale").property = 'SCALE' - layout.operator("sequencer.strip_transform_clear", text="Clear Rotation").property = 'ROTATION' - layout.operator("sequencer.strip_transform_clear", text="Clear All").property = 'ALL' - - class SEQUENCER_MT_strip_transform(Menu): bl_label = "Transform" - def draw(self, _context): + def draw(self, context): layout = self.layout + st = context.space_data + has_sequencer, has_preview = _space_view_types(st) - layout.operator("transform.seq_slide", text="Move") - layout.operator("transform.transform", text="Move/Extend from Current Frame").mode = 'TIME_EXTEND' - layout.operator("sequencer.slip", text="Slip Strip Contents") + if has_preview: + layout.operator_context = 'INVOKE_REGION_PREVIEW' + else: + layout.operator_context = 'INVOKE_REGION_WIN' - layout.separator() - layout.operator("sequencer.snap") - layout.operator("sequencer.offset_clear") + # FIXME: mixed preview/sequencer views. + if has_preview: + layout.operator("transform.translate", text="Move") + layout.operator("transform.rotate", text="Rotate") + layout.operator("transform.resize", text="Scale") + else: + layout.operator("transform.seq_slide", text="Move") + layout.operator("transform.transform", text="Move/Extend from Current Frame").mode = 'TIME_EXTEND' + layout.operator("sequencer.slip", text="Slip Strip Contents") - layout.separator() - layout.operator_menu_enum("sequencer.swap", "side") + # TODO (for preview) + if has_sequencer: + layout.separator() + layout.operator("sequencer.snap") + layout.operator("sequencer.offset_clear") - layout.separator() - layout.operator("sequencer.gap_remove").all = False - layout.operator("sequencer.gap_insert") + layout.separator() + + if has_sequencer: + layout.operator_menu_enum("sequencer.swap", "side") + + layout.separator() + layout.operator("sequencer.gap_remove").all = False + layout.operator("sequencer.gap_insert") class SEQUENCER_MT_strip_input(Menu): @@ -893,69 +914,129 @@ class SEQUENCER_MT_strip(Menu): def draw(self, context): layout = self.layout + st = context.space_data + has_sequencer, has_preview = _space_view_types(st) - layout.operator_context = 'INVOKE_REGION_WIN' + # FIXME: this doesn't work for both preview + window region. + if has_preview: + layout.operator_context = 'INVOKE_REGION_PREVIEW' + else: + layout.operator_context = 'INVOKE_REGION_WIN' - layout.separator() layout.menu("SEQUENCER_MT_strip_transform") - layout.menu("SEQUENCER_MT_strip_image_transform") - layout.separator() - layout.operator("sequencer.split", text="Split").type = 'SOFT' - layout.operator("sequencer.split", text="Hold Split").type = 'HARD' - layout.separator() - layout.operator("sequencer.copy", text="Copy") - layout.operator("sequencer.paste", text="Paste") - layout.operator("sequencer.duplicate_move") + if has_sequencer: + + layout.operator("sequencer.split", text="Split").type = 'SOFT' + layout.operator("sequencer.split", text="Hold Split").type = 'HARD' + layout.separator() + + if has_sequencer: + layout.operator("sequencer.copy", text="Copy") + layout.operator("sequencer.paste", text="Paste") + layout.operator("sequencer.duplicate_move") + layout.operator("sequencer.delete", text="Delete") strip = context.active_sequence_strip - if strip: - strip_type = strip.type + if has_sequencer: + if strip: + strip_type = strip.type - if strip_type != 'SOUND': - layout.separator() - layout.operator_menu_enum("sequencer.strip_modifier_add", "type", text="Add Modifier") - layout.operator("sequencer.strip_modifier_copy", text="Copy Modifiers to Selection") + if strip_type != 'SOUND': + layout.separator() + layout.operator_menu_enum("sequencer.strip_modifier_add", "type", text="Add Modifier") + layout.operator("sequencer.strip_modifier_copy", text="Copy Modifiers to Selection") + + if strip_type in { + 'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', + 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'WIPE', 'GLOW', + 'TRANSFORM', 'COLOR', 'SPEED', 'MULTICAM', 'ADJUSTMENT', + 'GAUSSIAN_BLUR', + }: + layout.separator() + layout.menu("SEQUENCER_MT_strip_effect") + elif strip_type == 'MOVIE': + layout.separator() + layout.menu("SEQUENCER_MT_strip_movie") + elif strip_type == 'IMAGE': + layout.separator() + layout.operator("sequencer.rendersize") + layout.operator("sequencer.images_separate") + elif strip_type == 'TEXT': + layout.separator() + layout.menu("SEQUENCER_MT_strip_effect") + elif strip_type == 'META': + layout.separator() + layout.operator("sequencer.meta_make") + layout.operator("sequencer.meta_separate") + layout.operator("sequencer.meta_toggle", text="Toggle Meta") + if strip_type != 'META': + layout.separator() + layout.operator("sequencer.meta_make") + layout.operator("sequencer.meta_toggle", text="Toggle Meta") - if strip_type in { - 'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', - 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP', 'WIPE', 'GLOW', - 'TRANSFORM', 'COLOR', 'SPEED', 'MULTICAM', 'ADJUSTMENT', - 'GAUSSIAN_BLUR', - }: - layout.separator() - layout.menu("SEQUENCER_MT_strip_effect") - elif strip_type == 'MOVIE': - layout.separator() - layout.menu("SEQUENCER_MT_strip_movie") - elif strip_type == 'IMAGE': - layout.separator() - layout.operator("sequencer.rendersize") - layout.operator("sequencer.images_separate") - elif strip_type == 'TEXT': - layout.separator() - layout.menu("SEQUENCER_MT_strip_effect") - elif strip_type == 'META': - layout.separator() - layout.operator("sequencer.meta_make") - layout.operator("sequencer.meta_separate") - layout.operator("sequencer.meta_toggle", text="Toggle Meta") - if strip_type != 'META': - layout.separator() - layout.operator("sequencer.meta_make") - layout.operator("sequencer.meta_toggle", text="Toggle Meta") + if has_sequencer: + layout.separator() + layout.menu("SEQUENCER_MT_color_tag_picker") - layout.separator() - layout.menu("SEQUENCER_MT_color_tag_picker") + layout.separator() + layout.menu("SEQUENCER_MT_strip_lock_mute") - layout.separator() - layout.menu("SEQUENCER_MT_strip_lock_mute") + layout.separator() + layout.menu("SEQUENCER_MT_strip_input") - layout.separator() - layout.menu("SEQUENCER_MT_strip_input") + +class SEQUENCER_MT_image(Menu): + bl_label = "Image" + + def draw(self, context): + layout = self.layout + st = context.space_data + + if st.view_type == {'PREVIEW', 'SEQUENCER_PREVIEW'}: + layout.menu("SEQUENCER_MT_image_transform") + + layout.menu("SEQUENCER_MT_image_clear") + layout.menu("SEQUENCER_MT_image_apply") + + +class SEQUENCER_MT_image_transform(Menu): + bl_label = "Transfrom" + + def draw(self, _context): + layout = self.layout + + layout.operator_context = 'INVOKE_REGION_PREVIEW' + + layout.operator("transform.translate") + layout.operator("transform.rotate") + layout.operator("transform.resize", text="Scale") + + +class SEQUENCER_MT_image_clear(Menu): + bl_label = "Clear" + + def draw(self, _context): + layout = self.layout + + layout.operator("sequencer.strip_transform_clear", text="Position").property = 'POSITION' + layout.operator("sequencer.strip_transform_clear", text="Scale").property = 'SCALE' + layout.operator("sequencer.strip_transform_clear", text="Rotation").property = 'ROTATION' + layout.operator("sequencer.strip_transform_clear", text="All Transforms").property = 'ALL' + + +class SEQUENCER_MT_image_apply(Menu): + bl_label = "Apply" + + def draw(self, _context): + layout = self.layout + + layout.operator("sequencer.strip_transform_fit", text="Scale To Fit").fit_method = 'FIT' + layout.operator("sequencer.strip_transform_fit", text="Scale to Fill").fit_method = 'FILL' + layout.operator("sequencer.strip_transform_fit", text="Stretch To Fill").fit_method = 'STRETCH' class SEQUENCER_MT_context_menu(Menu): @@ -2523,10 +2604,13 @@ classes = ( SEQUENCER_MT_strip_effect, SEQUENCER_MT_strip_movie, SEQUENCER_MT_strip, - SEQUENCER_MT_strip_image_transform, SEQUENCER_MT_strip_transform, SEQUENCER_MT_strip_input, SEQUENCER_MT_strip_lock_mute, + SEQUENCER_MT_image, + SEQUENCER_MT_image_transform, + SEQUENCER_MT_image_clear, + SEQUENCER_MT_image_apply, SEQUENCER_MT_color_tag_picker, SEQUENCER_MT_context_menu, SEQUENCER_MT_preview_context_menu, |