VSE: Tool system integration
Add toolbar to sequencer regions. A bit of refactoring has to be done in RNA space. Currently there is only cut tool implemented to serve as template for anybody who would like to add more.
This commit is contained in:
@@ -30,6 +30,9 @@ from bpy.app.translations import (
|
||||
from bl_ui.properties_grease_pencil_common import (
|
||||
AnnotationDataPanel,
|
||||
)
|
||||
from bl_ui.space_toolsystem_common import (
|
||||
ToolActivePanelHelper,
|
||||
)
|
||||
from rna_prop_ui import PropertyPanel
|
||||
|
||||
|
||||
@@ -89,6 +92,35 @@ def draw_color_balance(layout, color_balance):
|
||||
split.template_color_picker(color_balance, "gain", value_slider=True, lock_luminosity=True, cubic=True)
|
||||
|
||||
|
||||
class SEQUENCER_PT_active_tool(ToolActivePanelHelper, Panel):
|
||||
bl_space_type = 'SEQUENCE_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = "Tool"
|
||||
|
||||
|
||||
class SEQUENCER_HT_tool_header(Header):
|
||||
bl_space_type = 'SEQUENCE_EDITOR'
|
||||
bl_region_type = 'TOOL_HEADER'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.template_header()
|
||||
|
||||
self.draw_tool_settings(context)
|
||||
|
||||
# TODO: options popover.
|
||||
|
||||
def draw_tool_settings(self, context):
|
||||
layout = self.layout
|
||||
|
||||
# Active Tool
|
||||
# -----------
|
||||
from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
|
||||
tool = ToolSelectPanelHelper.draw_active_tool_header(context, layout)
|
||||
tool_mode = context.mode if tool is None else tool.mode
|
||||
|
||||
|
||||
class SEQUENCER_HT_header(Header):
|
||||
bl_space_type = 'SEQUENCE_EDITOR'
|
||||
|
||||
@@ -97,7 +129,10 @@ class SEQUENCER_HT_header(Header):
|
||||
|
||||
st = context.space_data
|
||||
|
||||
layout.template_header()
|
||||
show_region_tool_header = st.show_region_tool_header
|
||||
|
||||
if not show_region_tool_header:
|
||||
layout.template_header()
|
||||
|
||||
layout.prop(st, "view_type", text="")
|
||||
|
||||
@@ -226,6 +261,7 @@ class SEQUENCER_MT_view(Menu):
|
||||
# wm_keymap_item_find_props() (see #32595).
|
||||
layout.operator_context = 'INVOKE_REGION_PREVIEW'
|
||||
layout.prop(st, "show_region_ui")
|
||||
layout.prop(st, "show_region_toolbar")
|
||||
layout.operator_context = 'INVOKE_DEFAULT'
|
||||
|
||||
if is_sequencer_view:
|
||||
@@ -2131,6 +2167,7 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel):
|
||||
|
||||
classes = (
|
||||
SEQUENCER_MT_change,
|
||||
SEQUENCER_HT_tool_header,
|
||||
SEQUENCER_HT_header,
|
||||
SEQUENCER_MT_editor_menus,
|
||||
SEQUENCER_MT_range,
|
||||
@@ -2156,7 +2193,7 @@ classes = (
|
||||
SEQUENCER_MT_strip_input,
|
||||
SEQUENCER_MT_strip_lock_mute,
|
||||
SEQUENCER_MT_context_menu,
|
||||
|
||||
SEQUENCER_PT_active_tool,
|
||||
SEQUENCER_PT_strip,
|
||||
|
||||
SEQUENCER_PT_effect,
|
||||
|
Reference in New Issue
Block a user