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 layout = self.layout
is_retiming = ( 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 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 strip = context.active_strip

View file

@ -45,17 +45,19 @@ def playback_controls(layout, context):
tool_settings = context.tool_settings tool_settings = context.tool_settings
screen = context.screen screen = context.screen
layout.popover( if scene:
panel="TIME_PT_playback", layout.popover(
text="Playback", panel="TIME_PT_playback",
) text="Playback",
)
icon_keytype = 'KEYTYPE_{:s}_VEC'.format(context.tool_settings.keyframe_type) if tool_settings:
layout.popover( icon_keytype = 'KEYTYPE_{:s}_VEC'.format(tool_settings.keyframe_type)
panel="TIME_PT_keyframing_settings", layout.popover(
text_ctxt=i18n_contexts.id_windowmanager, panel="TIME_PT_keyframing_settings",
icon=icon_keytype, text_ctxt=i18n_contexts.id_windowmanager,
) icon=icon_keytype,
)
if is_sequencer: if is_sequencer:
layout.prop(context.workspace, "use_scene_time_sync", text="Sync Scene Time") 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.keyframe_jump", text="", icon='NEXT_KEYFRAME').next = True
row.operator("screen.frame_jump", text="", icon='FF').end = True row.operator("screen.frame_jump", text="", icon='FF').end = True
row = layout.row(align=True) if tool_settings:
row.prop(tool_settings, "use_snap_playhead", text="") row = layout.row(align=True)
sub = row.row(align=True) row.prop(tool_settings, "use_snap_playhead", text="")
sub.popover(panel="TIME_PT_playhead_snapping", text="") sub = row.row(align=True)
sub.popover(panel="TIME_PT_playhead_snapping", text="")
layout.separator_spacer() layout.separator_spacer()