Fix #147437: VSE: Some python operators are broken

Since the introduction of the sequencer scene,
some of the sequencer python operators have
been using `context.scene` when they should be using
`context.workspace.sequencer_scene`.

This fixes `SequencerFadesAdd`, `SequencerFadesClear`,
`SequencerDeinterlaceSelectedMovies`,
`SequencerSplitMulticam`, and `SequencerCrossfadeSounds`.

Pull Request: https://projects.blender.org/blender/blender/pulls/147560
This commit is contained in:
Falk David
2025-10-09 15:46:05 +02:00
committed by Falk David
parent 6bf69766aa
commit f9a76822a8

View File

@@ -34,11 +34,14 @@ class SequencerCrossfadeSounds(Operator):
@classmethod
def poll(cls, context):
sequencer_scene = context.sequencer_scene
if not sequencer_scene:
return False
strip = context.active_strip
return strip and (strip.type == 'SOUND')
def execute(self, context):
scene = context.scene
scene = context.sequencer_scene
strip1 = None
strip2 = None
for strip in scene.sequence_editor.strips_all:
@@ -89,11 +92,14 @@ class SequencerSplitMulticam(Operator):
@classmethod
def poll(cls, context):
sequencer_scene = context.sequencer_scene
if not sequencer_scene:
return False
strip = context.active_strip
return strip and (strip.type == 'MULTICAM')
def execute(self, context):
scene = context.scene
scene = context.sequencer_scene
camera = self.camera
strip = context.active_strip
@@ -126,7 +132,8 @@ class SequencerDeinterlaceSelectedMovies(Operator):
return (scene and scene.sequence_editor)
def execute(self, context):
for strip in context.scene.sequence_editor.strips_all:
scene = context.sequencer_scene
for strip in scene.sequence_editor.strips_all:
if strip.select and strip.type == 'MOVIE':
strip.use_deinterlace = True
@@ -141,13 +148,16 @@ class SequencerFadesClear(Operator):
@classmethod
def poll(cls, context):
sequencer_scene = context.sequencer_scene
if not sequencer_scene:
return False
strip = context.active_strip
return strip is not None
def execute(self, context):
from bpy_extras import anim_utils
scene = context.scene
scene = context.sequencer_scene
animation_data = scene.animation_data
if animation_data is None:
return {'CANCELLED'}
@@ -201,6 +211,9 @@ class SequencerFadesAdd(Operator):
@classmethod
def poll(cls, context):
sequencer_scene = context.sequencer_scene
if not sequencer_scene:
return False
# Can't use context.selected_strips as it can have an impact on performances
strip = context.active_strip
return strip is not None
@@ -209,7 +222,7 @@ class SequencerFadesAdd(Operator):
from math import floor
# We must create a scene action first if there's none
scene = context.scene
scene = context.sequencer_scene
if not scene.animation_data:
scene.animation_data_create()
if not scene.animation_data.action:
@@ -254,7 +267,7 @@ class SequencerFadesAdd(Operator):
return {'FINISHED'}
def calculate_fade_duration(self, context, strip):
scene = context.scene
scene = context.sequencer_scene
frame_current = scene.frame_current
duration = 0.0
if self.type == 'CURSOR_TO':
@@ -288,7 +301,7 @@ class SequencerFadesAdd(Operator):
that corresponds to the strip.
Returns the matching FCurve or creates a new one if the function can't find a match.
"""
scene = context.scene
scene = context.sequencer_scene
action = scene.animation_data.action
searched_data_path = strip.path_from_id(animated_property)
return action.fcurve_ensure_for_datablock(scene, searched_data_path)