Fix: VSE: Python errors when no sequencer scene is present

There were multiple places in the UI code that assumed
that the sequencer scene and tool settings exist, when
they might not.
This commit is contained in:
Falk David
2025-09-23 11:51:54 +02:00
parent 8d6b935466
commit 2b53ed9add
2 changed files with 19 additions and 16 deletions

View File

@@ -1123,9 +1123,9 @@ class SEQUENCER_MT_strip_retiming(Menu):
layout = self.layout
is_retiming = (
context.sequencer_scene and
context.sequencer_scene is not None and
context.sequencer_scene.sequence_editor is not None and
context.sequencer_scene.sequence_editor.selected_retiming_keys
context.sequencer_scene.sequence_editor.selected_retiming_keys is not None
)
strip = context.active_strip

View File

@@ -45,17 +45,19 @@ def playback_controls(layout, context):
tool_settings = context.tool_settings
screen = context.screen
layout.popover(
panel="TIME_PT_playback",
text="Playback",
)
if scene:
layout.popover(
panel="TIME_PT_playback",
text="Playback",
)
icon_keytype = 'KEYTYPE_{:s}_VEC'.format(context.tool_settings.keyframe_type)
layout.popover(
panel="TIME_PT_keyframing_settings",
text_ctxt=i18n_contexts.id_windowmanager,
icon=icon_keytype,
)
if tool_settings:
icon_keytype = 'KEYTYPE_{:s}_VEC'.format(tool_settings.keyframe_type)
layout.popover(
panel="TIME_PT_keyframing_settings",
text_ctxt=i18n_contexts.id_windowmanager,
icon=icon_keytype,
)
if is_sequencer:
layout.prop(context.workspace, "use_scene_time_sync", text="Sync Scene Time")
@@ -95,10 +97,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="")
if tool_settings:
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()