diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_sequencer.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 171e4c38d01..c328efc11d1 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -36,10 +36,7 @@ def act_strip(context): def sel_sequences(context): - try: - return len(context.selected_sequences) if context.selected_sequences else 0 - except AttributeError: - return 0 + return len(getattr(context, "selected_sequences", ())) def draw_color_balance(layout, color_balance): @@ -318,29 +315,35 @@ class SEQUENCER_MT_add(Menu): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - if len(bpy.data.scenes) > 10: + bpy_data_scenes_len = len(bpy.data.scenes) + if bpy_data_scenes_len > 10: layout.operator_context = 'INVOKE_DEFAULT' layout.operator("sequencer.scene_strip_add", text="Scene...", icon='SCENE_DATA') - elif len(bpy.data.scenes) > 1: + elif bpy_data_scenes_len > 1: layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene", icon='SCENE_DATA') else: layout.menu("SEQUENCER_MT_add_empty", text="Scene", icon='SCENE_DATA') + del bpy_data_scenes_len - if len(bpy.data.movieclips) > 10: + bpy_data_movieclips_len = len(bpy.data.movieclips) + if bpy_data_movieclips_len > 10: layout.operator_context = 'INVOKE_DEFAULT' layout.operator("sequencer.movieclip_strip_add", text="Clip...", icon='CLIP') - elif len(bpy.data.movieclips) > 0: + elif bpy_data_movieclips_len > 0: layout.operator_menu_enum("sequencer.movieclip_strip_add", "clip", text="Clip", icon='CLIP') else: layout.menu("SEQUENCER_MT_add_empty", text="Clip", icon='CLIP') + del bpy_data_movieclips_len - if len(bpy.data.masks) > 10: + bpy_data_masks_len = len(bpy.data.masks) + if bpy_data_masks_len > 10: layout.operator_context = 'INVOKE_DEFAULT' layout.operator("sequencer.mask_strip_add", text="Mask...", icon='MOD_MASK') - elif len(bpy.data.masks) > 0: + elif bpy_data_masks_len > 0: layout.operator_menu_enum("sequencer.mask_strip_add", "mask", text="Mask", icon='MOD_MASK') else: layout.menu("SEQUENCER_MT_add_empty", text="Mask", icon='MOD_MASK') + del bpy_data_masks_len layout.separator() |