diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2022-05-16 20:46:20 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2022-05-16 20:46:20 +0300 |
commit | be84fe4ce1d8521ec91aa8bd6f56e9cdf4f7d8fe (patch) | |
tree | c8c1197f173c35441f500f89e330ae439422e969 /release/scripts/startup/bl_ui/space_sequencer.py | |
parent | 205c6d8d0853ada1c3d087b31bb2bec42d5597f1 (diff) |
VSE: Add new Scene and Strip
This operator allows to add a new scene at the same time that the strip. This is very handy for storyboarding.
Reviewed By: ISS
Maniphest Tasks: T97678
Differential Revision: https://developer.blender.org/D14790
Diffstat (limited to 'release/scripts/startup/bl_ui/space_sequencer.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_sequencer.py | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 9aeac14ef4b..b3d2cbf914a 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -676,15 +676,7 @@ class SEQUENCER_MT_add(Menu): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - 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 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 + layout.menu("SEQUENCER_MT_add_scene", text="Scene", icon='SCENE_DATA') bpy_data_movieclips_len = len(bpy.data.movieclips) if bpy_data_movieclips_len > 10: @@ -734,6 +726,34 @@ class SEQUENCER_MT_add(Menu): col.enabled = selected_sequences_len(context) >= 1 +class SEQUENCER_MT_add_scene(Menu): + bl_label = "Scene" + bl_translation_context = i18n_contexts.operator_default + + def draw(self, context): + + layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' + layout.operator("sequencer.scene_strip_add_new", text="New Scene", icon="ADD").type='NEW' + + bpy_data_scenes_len = len(bpy.data.scenes) + if bpy_data_scenes_len > 10: + layout.separator() + layout.operator_context = 'INVOKE_DEFAULT' + layout.operator("sequencer.scene_strip_add", text="Scene...", icon='SCENE_DATA') + elif bpy_data_scenes_len > 1: + layout.separator() + scene = context.scene + for sc_item in bpy.data.scenes: + if sc_item == scene: + continue + + layout.operator_context = 'INVOKE_REGION_WIN' + layout.operator("sequencer.scene_strip_add", text=sc_item.name).scene = sc_item.name + + del bpy_data_scenes_len + + class SEQUENCER_MT_add_empty(Menu): bl_label = "Empty" @@ -2609,6 +2629,7 @@ classes = ( SEQUENCER_MT_marker, SEQUENCER_MT_navigation, SEQUENCER_MT_add, + SEQUENCER_MT_add_scene, SEQUENCER_MT_add_effect, SEQUENCER_MT_add_transitions, SEQUENCER_MT_add_empty, |