Merge branch 'main' of https://gitlab.com/autour-de-minuit/blender/vse_toolbox into main
commit
f5284d18b1
|
@ -36,6 +36,9 @@ if 'bpy' in locals():
|
|||
import bpy
|
||||
|
||||
def register():
|
||||
print('Register update script handler')
|
||||
bpy.app.handlers.frame_change_post.append(update_text_strips)
|
||||
|
||||
if bpy.app.background:
|
||||
return
|
||||
|
||||
|
@ -43,10 +46,12 @@ def register():
|
|||
module.register()
|
||||
|
||||
bpy.app.handlers.frame_change_post.append(set_active_strip)
|
||||
bpy.app.handlers.frame_change_post.append(update_text_strips)
|
||||
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.app.handlers.frame_change_post.remove(update_text_strips)
|
||||
|
||||
try:
|
||||
bpy.utils.previews.remove(ASSET_PREVIEWS)
|
||||
except Exception as e:
|
||||
|
@ -58,8 +63,6 @@ def unregister():
|
|||
return
|
||||
|
||||
bpy.app.handlers.frame_change_post.remove(set_active_strip)
|
||||
bpy.app.handlers.frame_change_post.remove(update_text_strips)
|
||||
|
||||
for module in reversed(modules):
|
||||
module.unregister()
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ from bpy.types import Operator
|
|||
from bpy.props import (BoolProperty, StringProperty)
|
||||
|
||||
from vse_toolbox.sequencer_utils import (get_strips, rename_strips, set_channels,
|
||||
get_channel_index, new_text_strip)
|
||||
get_channel_index, new_text_strip, get_strip_at)
|
||||
|
||||
from vse_toolbox.bl_utils import get_scene_settings
|
||||
|
||||
|
@ -212,17 +212,105 @@ class VSETB_OT_set_stamps(Operator):
|
|||
return {"FINISHED"}
|
||||
|
||||
|
||||
class VSETB_OT_previous_shot(Operator):
|
||||
bl_idname = "vse_toolbox.previous_shot"
|
||||
bl_label = "Jump to Previous Shot"
|
||||
bl_description = "Jump to Previous Shot"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def execute(self, context):
|
||||
strips = get_strips('Shots')
|
||||
if not strips:
|
||||
return {"CANCELLED"}
|
||||
|
||||
active_strip = get_strip_at('Shots')
|
||||
if active_strip is strips[0]:
|
||||
return {"CANCELLED"}
|
||||
|
||||
active_strip_index = strips.index(active_strip)
|
||||
next_shot = strips[active_strip_index - 1]
|
||||
context.scene.frame_set(next_shot.frame_final_start)
|
||||
|
||||
bpy.ops.sequencer.select_all(action="DESELECT")
|
||||
next_shot.select = True
|
||||
context.scene.sequence_editor.active_strip = next_shot
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class VSETB_OT_next_shot(Operator):
|
||||
bl_idname = "vse_toolbox.next_shot"
|
||||
bl_label = "Jump to Next Shot"
|
||||
bl_description = "Jump to Next Shot"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
strips = get_strips('Shots')
|
||||
if not strips:
|
||||
return {"CANCELLED"}
|
||||
|
||||
active_strip = get_strip_at('Shots')
|
||||
if active_strip is strips[-1]:
|
||||
return {"CANCELLED"}
|
||||
|
||||
active_strip_index = strips.index(active_strip)
|
||||
next_shot = strips[active_strip_index + 1]
|
||||
context.scene.frame_set(next_shot.frame_final_start)
|
||||
|
||||
bpy.ops.sequencer.select_all(action="DESELECT")
|
||||
next_shot.select = True
|
||||
context.scene.sequence_editor.active_strip = next_shot
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
addon_keymaps = []
|
||||
def register_keymaps():
|
||||
addon = bpy.context.window_manager.keyconfigs.addon
|
||||
|
||||
if not addon:
|
||||
return
|
||||
|
||||
#print('VSE Toolbox Keymaps Register')
|
||||
|
||||
km = addon.keymaps.new(name="Sequencer", space_type="SEQUENCE_EDITOR")
|
||||
|
||||
kmi = km.keymap_items.new('vse_toolbox.previous_shot', type='LEFT_ARROW', value='PRESS', ctrl=True)
|
||||
addon_keymaps.append((km, kmi))
|
||||
|
||||
kmi = km.keymap_items.new('vse_toolbox.next_shot', type='RIGHT_ARROW', value='PRESS', ctrl=True)
|
||||
addon_keymaps.append((km, kmi))
|
||||
|
||||
|
||||
def unregister_keymaps():
|
||||
#print('unregister_keymaps', addon_keymaps)
|
||||
for km, kmi in addon_keymaps:
|
||||
if kmi in list(km.keymap_items):
|
||||
km.keymap_items.remove(kmi)
|
||||
|
||||
addon_keymaps.clear()
|
||||
|
||||
|
||||
|
||||
classes = (
|
||||
VSETB_OT_rename,
|
||||
VSETB_OT_set_sequencer,
|
||||
VSETB_OT_set_stamps,
|
||||
VSETB_OT_show_waveform,
|
||||
VSETB_OT_previous_shot,
|
||||
VSETB_OT_next_shot
|
||||
)
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
|
||||
register_keymaps()
|
||||
|
||||
|
||||
def unregister():
|
||||
for cls in reversed(classes):
|
||||
bpy.utils.unregister_class(cls)
|
||||
|
||||
unregister_keymaps()
|
||||
|
|
|
@ -286,6 +286,7 @@ class VSETB_OT_upload_to_tracker(Operator):
|
|||
col.separator()
|
||||
col.prop(self, 'casting', text='Casting')
|
||||
col.prop(self, 'custom_data', text='Custom Data')
|
||||
col.prop(self, 'set_main_preview', text='Set Main Preview')
|
||||
|
||||
def execute(self, context):
|
||||
#self.report({'ERROR'}, f'Export not implemented yet.')
|
||||
|
@ -345,6 +346,7 @@ class VSETB_OT_upload_to_tracker(Operator):
|
|||
if status or preview:
|
||||
tracker.new_comment(task, comment=self.comment, status=status, preview=preview, set_main_preview=self.set_main_preview)
|
||||
|
||||
|
||||
if self.custom_data:
|
||||
metadata = strip.vsetb_strip_settings.metadata.to_dict()
|
||||
description = strip.vsetb_strip_settings.description
|
||||
|
|
|
@ -406,6 +406,9 @@ def set_active_strip(scene):
|
|||
|
||||
@persistent
|
||||
def update_text_strips(scene):
|
||||
|
||||
print("update_text_strips")
|
||||
|
||||
scn = bpy.context.scene
|
||||
if not scn.sequence_editor:
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue