From e43a948a2ca7aef365ac0e6808341215e35ee4ff Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 11 Jun 2020 16:05:40 +1000 Subject: Sequencer: view toggle no longer cycles over SEQUENCER_PREVIEW state - Remove the operator, use a generic operator instead. - Switch between PREVIEW/SEQUENCER as the mixed state isn't as useful. - Add menu item to make the shortcut discoverable. - Remove unused & broken "View Type" menu. --- release/scripts/startup/bl_ui/space_sequencer.py | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'release/scripts/startup/bl_ui/space_sequencer.py') diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 26a150f83ef..abe6f614f28 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -176,17 +176,6 @@ class SEQUENCER_MT_editor_menus(Menu): layout.menu("SEQUENCER_MT_strip") -class SEQUENCER_MT_view_toggle(Menu): - bl_label = "View Type" - - def draw(self, _context): - layout = self.layout - - layout.operator("sequencer.view_toggle").type = 'SEQUENCER' - layout.operator("sequencer.view_toggle").type = 'PREVIEW' - layout.operator("sequencer.view_toggle").type = 'SEQUENCER_PREVIEW' - - class SEQUENCER_MT_view_cache(Menu): bl_label = "Cache" @@ -357,6 +346,20 @@ class SEQUENCER_MT_view(Menu): layout.separator() + # Note that the context is needed for the shortcut to display properly. + layout.operator_context = 'INVOKE_REGION_PREVIEW' if is_preview else 'INVOKE_REGION_WIN' + props = layout.operator( + "wm.context_toggle_enum", + text="Toggle Sequencer/Preview", + icon='SEQ_SEQUENCER' if is_preview else 'SEQ_PREVIEW', + ) + props.data_path = "space_data.view_type" + props.value_1 = 'SEQUENCER' + props.value_2 = 'PREVIEW' + layout.operator_context = 'INVOKE_DEFAULT' + + layout.separator() + layout.menu("INFO_MT_area") @@ -2201,7 +2204,6 @@ classes = ( SEQUENCER_MT_range, SEQUENCER_MT_view, SEQUENCER_MT_view_cache, - SEQUENCER_MT_view_toggle, SEQUENCER_MT_preview_zoom, SEQUENCER_MT_proxy, SEQUENCER_MT_select_handle, -- cgit v1.2.3