UI: move playhead snapping to footer

This patch moves the playhead snapping UI element to the
new footer introduced with 35bcbad7e9
This is in preparation for removing the timeline editor, see #131102

Pull Request: https://projects.blender.org/blender/blender/pulls/144922
This commit is contained in:
Christoph Lendenfeld
2025-09-02 12:22:29 +02:00
committed by Christoph Lendenfeld
parent 469f54f484
commit 49d3d29355
6 changed files with 34 additions and 79 deletions

View File

@@ -16,10 +16,6 @@ from bl_ui.properties_data_grease_pencil import (
GreasePencil_LayerAdjustmentsPanel,
GreasePencil_LayerDisplayPanel,
)
from bl_ui.utils import (
PlayheadSnappingPanel,
)
from bl_ui.space_time import playback_controls
from rna_prop_ui import PropertyPanel
@@ -220,10 +216,6 @@ class DOPESHEET_HT_header(Header):
DOPESHEET_HT_editor_buttons.draw_header(context, layout)
class DOPESHEET_PT_playhead_snapping(PlayheadSnappingPanel, Panel):
bl_space_type = 'DOPESHEET_EDITOR'
# Header for "normal" dopesheet editor modes (e.g. Dope Sheet, Action, Shape Keys, etc.)
class DOPESHEET_HT_editor_buttons:
@@ -285,11 +277,6 @@ class DOPESHEET_HT_editor_buttons:
text="",
)
row = layout.row(align=True)
row.prop(tool_settings, "use_snap_playhead", text="")
sub = row.row(align=True)
sub.popover(panel="DOPESHEET_PT_playhead_snapping", text="")
row = layout.row(align=True)
row.prop(tool_settings, "use_proportional_action", text="", icon_only=True)
sub = row.row(align=True)
@@ -1056,7 +1043,6 @@ classes = (
DOPESHEET_PT_grease_pencil_layer_adjustments,
DOPESHEET_PT_grease_pencil_layer_relations,
DOPESHEET_PT_grease_pencil_layer_display,
DOPESHEET_PT_playhead_snapping,
)
if __name__ == "__main__": # only for live edit.

View File

@@ -9,13 +9,6 @@ from bl_ui.space_dopesheet import (
dopesheet_filter,
)
from bl_ui.space_time import playback_controls
from bl_ui.utils import (
PlayheadSnappingPanel,
)
class GRAPH_PT_playhead_snapping(PlayheadSnappingPanel, Panel):
bl_space_type = 'GRAPH_EDITOR'
def drivers_editor_footer(layout, context):
@@ -95,11 +88,6 @@ class GRAPH_HT_header(Header):
text="",
)
row = layout.row(align=True)
row.prop(tool_settings, "use_snap_playhead", text="")
sub = row.row(align=True)
sub.popover(panel="GRAPH_PT_playhead_snapping", text="")
row = layout.row(align=True)
row.prop(tool_settings, "use_proportional_fcurve", text="", icon_only=True)
sub = row.row(align=True)
@@ -611,7 +599,6 @@ classes = (
GRAPH_PT_filters,
GRAPH_PT_snapping,
GRAPH_PT_driver_snapping,
GRAPH_PT_playhead_snapping,
)
if __name__ == "__main__": # only for live edit.

View File

@@ -10,13 +10,6 @@ from bl_ui.space_dopesheet import (
dopesheet_filter,
)
from bl_ui.space_time import playback_controls
from bl_ui.utils import (
PlayheadSnappingPanel,
)
class NLA_PT_playhead_snapping(PlayheadSnappingPanel, Panel):
bl_space_type = 'NLA_EDITOR'
class NLA_HT_header(Header):
@@ -48,11 +41,6 @@ class NLA_HT_header(Header):
text="",
)
row = layout.row(align=True)
row.prop(tool_settings, "use_snap_playhead", text="")
sub = row.row(align=True)
sub.popover(panel="NLA_PT_playhead_snapping", text="")
class NLA_HT_playback_controls(Header):
bl_space_type = 'NLA_EDITOR'
@@ -433,7 +421,6 @@ classes = (
NLA_PT_filters,
NLA_PT_action,
NLA_PT_snapping,
NLA_PT_playhead_snapping,
)
if __name__ == "__main__": # only for live edit.

View File

@@ -20,9 +20,6 @@ from bl_ui.properties_grease_pencil_common import (
from bl_ui.space_toolsystem_common import (
ToolActivePanelHelper,
)
from bl_ui.utils import (
PlayheadSnappingPanel,
)
from rna_prop_ui import PropertyPanel
from bl_ui.space_time import playback_controls
@@ -196,11 +193,7 @@ class SEQUENCER_HT_header(Header):
row.prop(tool_settings, "use_snap_sequencer", text="")
sub = row.row(align=True)
sub.popover(panel="SEQUENCER_PT_snapping")
if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
row = layout.row(align=True)
row.prop(tool_settings, "use_snap_playhead", text="")
sub = row.row(align=True)
sub.popover(panel="SEQUENCER_PT_playhead_snapping", text="")
layout.separator_spacer()
if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
@@ -3156,10 +3149,6 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel):
bl_category = "Strip"
class SEQUENCER_PT_playhead_snapping(PlayheadSnappingPanel, Panel):
bl_space_type = 'SEQUENCE_EDITOR'
class SEQUENCER_PT_snapping(Panel):
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'HEADER'
@@ -3325,7 +3314,6 @@ classes = (
SEQUENCER_PT_snapping,
SEQUENCER_PT_preview_snapping,
SEQUENCER_PT_sequencer_snapping,
SEQUENCER_PT_playhead_snapping,
)
if __name__ == "__main__": # only for live edit.

View File

@@ -7,6 +7,33 @@ from bpy.types import Menu, Panel
from bpy.app.translations import contexts as i18n_contexts
class TIME_PT_playhead_snapping(Panel):
bl_space_type = 'DOPESHEET_EDITOR'
bl_region_type = 'HEADER'
bl_label = "Playhead"
@classmethod
def poll(cls, context):
del context
return True
def draw(self, context):
tool_settings = context.tool_settings
layout = self.layout
col = layout.column()
col.prop(tool_settings, "playhead_snap_distance")
col.separator()
col.label(text="Snap Target")
col.prop(tool_settings, "snap_playhead_element", expand=True)
col.separator()
if 'FRAME' in tool_settings.snap_playhead_element:
col.prop(tool_settings, "snap_playhead_frame_step")
if 'SECOND' in tool_settings.snap_playhead_element:
col.prop(tool_settings, "snap_playhead_second_step")
def playback_controls(layout, context):
st = context.space_data
is_sequencer = st.type == 'SEQUENCE_EDITOR' and st.view_type == 'SEQUENCER'
@@ -64,6 +91,11 @@ def playback_controls(layout, context):
row.operator("screen.keyframe_jump", text="", icon='NEXT_KEYFRAME').next = True
row.operator("screen.frame_jump", text="", icon='FF').end = True
row = layout.row(align=True)
row.prop(tool_settings, "use_snap_playhead", text="")
sub = row.row(align=True)
sub.popover(panel="TIME_PT_playhead_snapping", text="")
layout.separator_spacer()
if scene:
@@ -306,6 +338,7 @@ classes = (
TIME_PT_playback,
TIME_PT_keyframing_settings,
TIME_PT_auto_keyframing,
TIME_PT_playhead_snapping,
)
if __name__ == "__main__": # only for live edit.

View File

@@ -38,29 +38,3 @@ class PresetPanel:
layout.operator_context = 'EXEC_DEFAULT'
Menu.draw_preset(self, context)
class PlayheadSnappingPanel:
bl_region_type = 'HEADER'
bl_label = "Playhead"
@classmethod
def poll(cls, context):
del context
return True
def draw(self, context):
tool_settings = context.tool_settings
layout = self.layout
col = layout.column()
col.prop(tool_settings, "playhead_snap_distance")
col.separator()
col.label(text="Snap Target")
col.prop(tool_settings, "snap_playhead_element", expand=True)
col.separator()
if 'FRAME' in tool_settings.snap_playhead_element:
col.prop(tool_settings, "snap_playhead_frame_step")
if 'SECOND' in tool_settings.snap_playhead_element:
col.prop(tool_settings, "snap_playhead_second_step")