[Bf-blender-cvs] [f0d20198b29] blender-v3.0-release: Sequencer: support basic selection & delete from previews

Campbell Barton noreply at git.blender.org
Thu Oct 28 07:55:43 CEST 2021


Commit: f0d20198b290338a9f58392f98ee43957b0bad61
Author: Campbell Barton
Date:   Thu Oct 28 14:31:17 2021 +1100
Branches: blender-v3.0-release
https://developer.blender.org/rBf0d20198b290338a9f58392f98ee43957b0bad61

Sequencer: support basic selection & delete from previews

Expose select & strip menus and shortcuts for sequencer preview.

===================================================================

M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	release/scripts/startup/bl_ui/space_sequencer.py
M	source/blender/editors/space_sequencer/sequencer_edit.c
M	source/blender/editors/space_sequencer/sequencer_select.c
M	source/blender/makesdna/DNA_sequence_types.h
M	source/blender/sequencer/SEQ_iterator.h
M	source/blender/sequencer/intern/iterator.c

===================================================================

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index fbc85b2164b..3a1ba3e22ff 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2868,7 +2868,10 @@ def km_sequencerpreview(params):
             value=params.select_mouse_value_fallback,
             legacy=params.legacy,
         ),
+        *_template_items_select_actions(params, "sequencer.select_all"),
+        ("sequencer.select_box", {"type": 'B', "value": 'PRESS'}, None),
 
+        # View.
         ("sequencer.view_all_preview", {"type": 'HOME', "value": 'PRESS'}, None),
         ("sequencer.view_all_preview", {"type": 'NDOF_BUTTON_FIT', "value": 'PRESS'}, None),
         ("sequencer.view_ghost_border", {"type": 'O', "value": 'PRESS'}, None),
@@ -2886,6 +2889,8 @@ def km_sequencerpreview(params):
          {"properties": [("ratio", 0.25)]}),
         ("sequencer.view_zoom_ratio", {"type": 'NUMPAD_8', "value": 'PRESS'},
          {"properties": [("ratio", 0.125)]}),
+
+        # Edit.
         ("transform.translate", {"type": params.select_tweak, "value": 'ANY'}, None),
         op_tool_optional(
             ("transform.translate", {"type": 'G', "value": 'PRESS'}, None),
@@ -2902,6 +2907,10 @@ def km_sequencerpreview(params):
          {"properties": [("property", 'SCALE')]}),
         ("sequencer.strip_transform_clear", {"type": 'R', "alt": True, "value": 'PRESS'},
          {"properties": [("property", 'ROTATION')]}),
+
+        ("sequencer.delete", {"type": 'X', "value": 'PRESS'}, None),
+        ("sequencer.delete", {"type": 'DEL', "value": 'PRESS'}, None),
+
         *_template_items_context_menu("SEQUENCER_MT_preview_context_menu", params.context_menu_event),
     ])
 
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index cdfe4f4068f..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,17 @@ 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")
 
@@ -561,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'
@@ -571,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")
 
 
@@ -792,23 +811,40 @@ class SEQUENCER_MT_add_effect(Menu):
 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):
@@ -878,68 +914,79 @@ 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.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 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 has_sequencer:
+            if strip:
+                strip_type = strip.type
 
-            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

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list