Fix #123586: Sequencer: Box select in Preview doesn't work after selecting it in the menu

select_box operator needs different context in preview and sequencer
regions. It wasn't specified, so it defaulted to sequencer context and
wasn't working in preview.

This PR sets poll for region and sets correct context for preview. This
also means shortcut appears on menu item in preview now.

Pull Request: https://projects.blender.org/blender/blender/pulls/123757
This commit is contained in:
Nika Kutsniashvili
2024-06-26 05:54:28 +02:00
committed by Richard Antalik
parent 224307b9aa
commit b933d6e1c7

View File

@@ -573,7 +573,7 @@ class SEQUENCER_MT_select(Menu):
def draw(self, context):
layout = self.layout
st = context.space_data
has_sequencer, _has_preview = _space_view_types(st)
has_sequencer, has_preview = _space_view_types(st)
is_retiming = context.scene.sequence_editor.selected_retiming_keys
layout.operator("sequencer.select_all", text="All").action = 'SELECT'
@@ -582,12 +582,14 @@ class SEQUENCER_MT_select(Menu):
layout.separator()
layout.operator("sequencer.select_box", text="Box Select")
col = layout.column()
if has_sequencer:
col.operator("sequencer.select_box", text="Box Select")
props = col.operator("sequencer.select_box", text="Box Select (Include Handles)")
props.include_handles = True
elif has_preview:
col.operator_context = 'INVOKE_REGION_PREVIEW'
col.operator("sequencer.select_box", text="Box Select")
col.separator()