[Bf-blender-cvs] [395f0fdd489] blender2.8: UI: Fix bug when no sequencer strips were selected on a new scene.

Pablo Vazquez noreply at git.blender.org
Fri Nov 9 11:53:22 CET 2018


Commit: 395f0fdd4893e1e164a4cab10fc12bc8878ef0da
Author: Pablo Vazquez
Date:   Fri Nov 9 11:53:09 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB395f0fdd4893e1e164a4cab10fc12bc8878ef0da

UI: Fix bug when no sequencer strips were selected on a new scene.

Reported by Tintwotin on DevTalk. Thanks!

===================================================================

M	release/scripts/startup/bl_ui/space_sequencer.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index c00875d8624..7c11c090439 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -34,6 +34,13 @@ def act_strip(context):
         return None
 
 
+def sel_sequences(context):
+    try:
+        return context.selected_sequences
+    except AttributeError:
+        return 0
+
+
 def draw_color_balance(layout, color_balance):
     box = layout.box()
     split = box.split(factor=0.35)
@@ -123,8 +130,6 @@ class SEQUENCER_HT_header(Header):
                     row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
 
 
-
-
 class SEQUENCER_MT_editor_menus(Menu):
     bl_idname = "SEQUENCER_MT_editor_menus"
     bl_label = ""
@@ -311,7 +316,6 @@ class SEQUENCER_MT_add(Menu):
     bl_label = "Add"
 
     def draw(self, context):
-        selected_seq = len(bpy.context.selected_sequences)
 
         layout = self.layout
         layout.operator_context = 'INVOKE_REGION_WIN'
@@ -361,7 +365,7 @@ class SEQUENCER_MT_add(Menu):
 
         col = layout.column()
         col.menu("SEQUENCER_MT_add_transitions")
-        col.enabled = selected_seq >= 2
+        col.enabled = sel_sequences(context) >= 2
 
 
 class SEQUENCER_MT_add_empty(Menu):
@@ -377,7 +381,6 @@ class SEQUENCER_MT_add_transitions(Menu):
     bl_label = "Transitions"
 
     def draw(self, context):
-        selected_seq = len(bpy.context.selected_sequences)
 
         layout = self.layout
 
@@ -388,7 +391,7 @@ class SEQUENCER_MT_add_transitions(Menu):
         col.separator()
 
         col.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE'
-        col.enabled = selected_seq >= 2
+        col.enabled = sel_sequences(context) >= 2
 
 
 class SEQUENCER_MT_add_effect(Menu):
@@ -396,8 +399,6 @@ class SEQUENCER_MT_add_effect(Menu):
 
     def draw(self, context):
 
-        selected_seq = len(bpy.context.selected_sequences)
-
         layout = self.layout
         layout.operator_context = 'INVOKE_REGION_WIN'
 
@@ -409,7 +410,7 @@ class SEQUENCER_MT_add_effect(Menu):
         col.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER'
         col.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER'
         col.operator("sequencer.effect_strip_add", text="Color Mix").type = 'COLORMIX'
-        col.enabled = selected_seq >=2
+        col.enabled = sel_sequences(context) >=2
 
         layout.separator()
 
@@ -425,7 +426,7 @@ class SEQUENCER_MT_add_effect(Menu):
 
         col.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW'
         col.operator("sequencer.effect_strip_add", text="Gaussian Blur").type = 'GAUSSIAN_BLUR'
-        col.enabled = selected_seq != 0
+        col.enabled = sel_sequences(context) != 0
 
 
 class SEQUENCER_MT_strip_transform(Menu):



More information about the Bf-blender-cvs mailing list