diff options
author | Pablo Vazquez <venomgfx@gmail.com> | 2018-11-09 13:53:09 +0300 |
---|---|---|
committer | Pablo Vazquez <venomgfx@gmail.com> | 2018-11-09 13:53:20 +0300 |
commit | 395f0fdd4893e1e164a4cab10fc12bc8878ef0da (patch) | |
tree | 7f9df35231b5f5f3b3a5db0cb667bd276122766b /release | |
parent | ab73935dbba34b2cf78c310af1c78a8396ac0c6e (diff) |
UI: Fix bug when no sequencer strips were selected on a new scene.
Reported by Tintwotin on DevTalk. Thanks!
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/space_sequencer.py | 21 |
1 files changed, 11 insertions, 10 deletions
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): |