[Bf-blender-cvs] [c84d1ad3dbf] master: Cleanup: use new active_sequence_strip context attribute
Campbell Barton
noreply at git.blender.org
Mon Aug 30 23:41:43 CEST 2021
Commit: c84d1ad3dbf4551b55f7b2630ef4ba7f6512b775
Author: Campbell Barton
Date: Tue Aug 31 07:27:55 2021 +1000
Branches: master
https://developer.blender.org/rBc84d1ad3dbf4551b55f7b2630ef4ba7f6512b775
Cleanup: use new active_sequence_strip context attribute
===================================================================
M release/scripts/startup/bl_operators/sequencer.py
M release/scripts/startup/bl_ui/space_sequencer.py
M release/scripts/startup/bl_ui/space_topbar.py
===================================================================
diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py
index 8f678896e61..5c82d3edcb7 100644
--- a/release/scripts/startup/bl_operators/sequencer.py
+++ b/release/scripts/startup/bl_operators/sequencer.py
@@ -37,10 +37,8 @@ class SequencerCrossfadeSounds(Operator):
@classmethod
def poll(cls, context):
- if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
- return context.scene.sequence_editor.active_strip.type == 'SOUND'
- else:
- return False
+ strip = context.active_sequence_strip
+ return strip and (strip.type == 'SOUND')
def execute(self, context):
seq1 = None
@@ -95,15 +93,13 @@ class SequencerSplitMulticam(Operator):
@classmethod
def poll(cls, context):
- if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
- return context.scene.sequence_editor.active_strip.type == 'MULTICAM'
- else:
- return False
+ strip = context.active_sequence_strip
+ return strip and (strip.type == 'MULTICAM')
def execute(self, context):
camera = self.camera
- s = context.scene.sequence_editor.active_strip
+ s = context.active_sequence_strip
if s.multicam_source == camera or camera >= s.channel:
return {'FINISHED'}
@@ -116,7 +112,7 @@ class SequencerSplitMulticam(Operator):
right_strip.select = True
context.scene.sequence_editor.active_strip = right_strip
- context.scene.sequence_editor.active_strip.multicam_source = camera
+ context.active_sequence_strip.multicam_source = camera
return {'FINISHED'}
@@ -147,7 +143,8 @@ class SequencerFadesClear(Operator):
@classmethod
def poll(cls, context):
- return context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip
+ strip = context.active_sequence_strip
+ return strip is not None
def execute(self, context):
animation_data = context.scene.animation_data
@@ -202,7 +199,8 @@ class SequencerFadesAdd(Operator):
@classmethod
def poll(cls, context):
# Can't use context.selected_sequences as it can have an impact on performances
- return context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip
+ strip = context.active_sequence_strip
+ return strip is not None
def execute(self, context):
from math import floor
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 79c1cb973ca..30115618f3d 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -37,13 +37,6 @@ from bl_ui.space_toolsystem_common import (
from rna_prop_ui import PropertyPanel
-def act_strip(context):
- try:
- return context.scene.sequence_editor.active_strip
- except AttributeError:
- return None
-
-
def selected_sequences_len(context):
selected_sequences = getattr(context, "selected_sequences", None)
if selected_sequences is None:
@@ -533,7 +526,7 @@ class SEQUENCER_MT_change(Menu):
def draw(self, context):
layout = self.layout
- strip = act_strip(context)
+ strip = context.active_sequence_strip
layout.operator_context = 'INVOKE_REGION_WIN'
@@ -760,7 +753,7 @@ class SEQUENCER_MT_strip_input(Menu):
def draw(self, context):
layout = self.layout
- strip = act_strip(context)
+ strip = context.active_sequence_strip
layout.operator("sequencer.reload", text="Reload Strips")
layout.operator("sequencer.reload", text="Reload Strips and Adjust Length").adjust_length = True
@@ -839,7 +832,7 @@ class SEQUENCER_MT_strip(Menu):
layout.operator("sequencer.duplicate_move")
layout.operator("sequencer.delete", text="Delete")
- strip = act_strip(context)
+ strip = context.active_sequence_strip
if strip:
strip_type = strip.type
@@ -920,7 +913,7 @@ class SEQUENCER_MT_context_menu(Menu):
layout.separator()
- strip = act_strip(context)
+ strip = context.active_sequence_strip
if strip:
strip_type = strip.type
@@ -988,7 +981,7 @@ class SequencerButtonsPanel:
@classmethod
def poll(cls, context):
- return cls.has_sequencer(context) and (act_strip(context) is not None)
+ return cls.has_sequencer(context) and (context.active_sequence_strip is not None)
class SequencerButtonsPanel_Output:
@@ -1012,7 +1005,7 @@ class SEQUENCER_PT_strip(SequencerButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
- strip = act_strip(context)
+ strip = context.active_sequence_strip
strip_type = strip.type
if strip_type in {
@@ -1064,15 +1057,14 @@ class SEQUENCER_PT_adjust_crop(SequencerButtonsPanel, Panel):
if not cls.has_sequencer(context):
return False
- strip = act_strip(context)
+ strip = context.active_sequence_strip
if not strip:
return False
- strip = act_strip(context)
return strip.type != 'SOUND'
def draw(self, context):
- strip = act_strip(context)
+ strip = context.active_sequence_strip
layout = self.layout
layout.use_property_split = True
layout.active = not strip.mute
@@ -1093,7 +1085,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
if not cls.has_sequencer(context):
return False
- strip = act_strip(context)
+ strip = context.active_sequence_strip
if not strip:
return False
@@ -1108,7 +1100,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
layout = self.layout
layout.use_property_split = True
- strip = act_strip(context)
+ strip = context.active_sequence_strip
layout.active = not strip.mute
@@ -1253,11 +1245,11 @@ class SEQUENCER_PT_effect_text_layout(SequencerButtonsPanel, Panel):
@classmethod
def poll(cls, context):
- strip = act_strip(context)
+ strip = context.active_sequence_strip
return strip.type == 'TEXT'
def draw(self, context):
- strip = act_strip(context)
+ strip = context.active_sequence_strip
layout = self.layout
layout.use_property_split = True
col = layout.column()
@@ -1273,11 +1265,11 @@ class SEQUENCER_PT_effect_text_style(SequencerButtonsPanel, Panel):
@classmethod
def poll(cls, context):
- strip = act_strip(context)
+ strip = context.active_sequence_strip
return strip.type == 'TEXT'
def draw(self, context):
- strip = act_strip(context)
+ strip = context.active_sequence_strip
layout = self.layout
layout.use_property_split = True
col = layout.column()
@@ -1325,7 +1317,7 @@ class SEQUENCER_PT_source(SequencerButtonsPanel, Panel):
if not cls.has_sequencer(context):
return False
- strip = act_strip(context)
+ strip = context.active_sequence_strip
if not strip:
return False
@@ -1337,7 +1329,7 @@ class SEQUENCER_PT_source(SequencerButtonsPanel, Panel):
layout.use_property_decorate = False
scene = context.scene
- strip = act_strip(context)
+ strip = context.active_sequence_strip
strip_type = strip.type
layout.active = not strip.mute
@@ -1429,14 +1421,14 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
if not cls.has_sequencer(context):
return False
- strip = act_strip(context)
+ strip = context.active_sequence_strip
if not strip:
return False
return (strip.type == 'SCENE')
def draw(self, context):
- strip = act_strip(context)
+ strip = context.active_sequence_strip
scene = strip.scene
layout = self.layout
@@ -1478,7 +1470,7 @@ class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
if not cls.has_sequencer(context):
return False
- strip = act_strip(context)
+ strip = context.active_sequence_strip
if not strip:
return False
@@ -1488,7 +1480,7 @@ class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
layout = self.layout
layout.use_property_split = True
- strip = act_strip(context)
+ strip = context.active_sequence_strip
layout.active = not strip.mute
@@ -1512,7 +1504,7 @@ class SEQUENCER_PT_time(SequencerButtonsPanel, Panel):
if not cls.has_sequencer(context):
return False
- strip = act_strip(context)
+ strip = context.active_sequence_strip
if not strip:
return False
@@ -1521,7 +1513,7 @@ class SEQUENCER_PT_time(SequencerButtonsPanel, Panel):
def draw_header_preset(self, context):
layout = self.layout
layout.alignment = 'RIGHT'
- strip = act_strip(context)
+ strip = context.active_sequence_strip
layout.prop(strip, "lock", text="", icon_only=True, emboss=False)
@@ -1534,7 +1526,7 @@ class SEQUENCER_PT_time(SequencerButtonsPanel, Panel):
scene = context.scene
frame_current = scene.frame_current
- strip = act_strip(context)
+ strip = context.active_sequence_strip
is_effect = isinstance(strip, bpy.types.EffectSequence)
@@ -1659,11 +1651,10 @@ class SEQUENCER_PT_adjust_sound(SequencerButtonsPanel, Panel):
if not cls.has_sequencer(context):
return False
- strip = act_strip(context)
+ strip = context.active_sequence_strip
if not strip:
return False
- strip = act_strip(context)
return strip.type == 'SOUND'
def draw(self, context):
@@ -1671,7 +1662,7 @@ class SEQUENCER_PT_adjust
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list