new operator to merge shots

pull/6/head
florentin.luce 2024-05-23 10:07:43 +02:00
parent a53ceaf134
commit b68b43e3e1
2 changed files with 27 additions and 9 deletions

View File

@ -563,19 +563,32 @@ class WM_OT_split_view(Operator):
return {"FINISHED"}
'''
class VSETB_OT_set_review_workspace(Operator):
"""Set Review Workspace"""
bl_idname = "vse_toolbox.set_workspace"
bl_label = "Set Review Workspace"
class VSETB_OT_merge_shot_strips(Operator):
"""Merge selected shots strips (required at least two strips)."""
bl_idname = "vse_toolbox.merge_shot_strips"
bl_label = "Merge Shot Strips"
@classmethod
def poll(cls, context):
selected_strips = bpy.context.selected_sequences
if len(selected_strips) <= 1:
return False
return all(get_channel_name(strip) == 'Shots' for strip in selected_strips)
def execute(self, context):
bpy.ops.workspace.append_activate(idname='Review', filepath=str(REVIEW_TEMPLATE_BLEND))
selected_strips = bpy.context.selected_sequences
last_frame = selected_strips[-1].frame_final_end
for i in range(1, len(selected_strips)):
context.scene.sequence_editor.sequences.remove(selected_strips[i])
selected_strips[0].frame_final_end = last_frame
return {"FINISHED"}
'''
addon_keymaps = []
@ -595,6 +608,9 @@ def register_keymaps():
kmi = km.keymap_items.new('vse_toolbox.next_shot', type='RIGHT_ARROW', value='PRESS', ctrl=True)
addon_keymaps.append((km, kmi))
kmi = km.keymap_items.new('vse_toolbox.merge_shot_strips', type='J', value='PRESS', ctrl=True)
addon_keymaps.append((km, kmi))
def unregister_keymaps():
#print('unregister_keymaps', addon_keymaps)
@ -617,7 +633,8 @@ classes = (
VSETB_OT_collect_files,
VSETB_OT_insert_channel,
VSETB_OT_remove_channel,
WM_OT_split_view
VSETB_OT_merge_shot_strips,
WM_OT_split_view,
)
def register():

View File

@ -451,7 +451,8 @@ class VSETB_MT_main_menu(Menu):
layout.separator()
layout.operator('vse_toolbox.insert_channel', text='Insert Channel', icon='TRIA_UP_BAR')
layout.operator('vse_toolbox.remove_channel', text='Remove Channel', icon='TRIA_DOWN_BAR')
layout.separator()
layout.operator('vse_toolbox.merge_shot_strips', text='Merge Shots')
def draw_vse_toolbox_menu(self, context):
self.layout.menu("VSETB_MT_main_menu")