2023-03-14 13:38:04 +01:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
import bpy
|
|
|
|
from bpy.types import Panel
|
2023-03-17 20:03:38 +01:00
|
|
|
from pathlib import Path
|
2023-03-14 13:38:04 +01:00
|
|
|
from vse_toolbox.bl_utils import get_addon_prefs, get_settings
|
2023-03-17 20:03:38 +01:00
|
|
|
from vse_toolbox.sequencer_utils import get_active_strip
|
2023-03-14 13:38:04 +01:00
|
|
|
|
|
|
|
class VSETB_main:
|
|
|
|
bl_space_type = "SEQUENCE_EDITOR"
|
|
|
|
bl_region_type = "UI"
|
|
|
|
bl_category = "VSE ToolBox"
|
|
|
|
bl_label = "VSE ToolBox"
|
|
|
|
|
|
|
|
|
|
|
|
class VSETB_PT_main(VSETB_main, Panel):
|
|
|
|
|
|
|
|
def draw_header(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
row = layout.row()
|
|
|
|
row.operator('vse_toolbox.load_projects', icon='FILE_REFRESH', text='')
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
wm = context.window_manager
|
|
|
|
scn = context.scene
|
|
|
|
|
|
|
|
settings = get_settings()
|
|
|
|
prefs = get_addon_prefs()
|
|
|
|
|
|
|
|
project = settings.active_project
|
|
|
|
|
|
|
|
layout = self.layout
|
|
|
|
col = layout.column()
|
|
|
|
row = col.row(align=True)
|
|
|
|
|
2023-03-17 20:03:38 +01:00
|
|
|
row.operator('vse_toolbox.set_scene', text='Set Scene', icon='SCENE_DATA')
|
2023-03-14 13:38:04 +01:00
|
|
|
row.prop(settings, 'toogle_prefs', text='', icon='PREFERENCES', toggle=True)
|
|
|
|
|
|
|
|
if settings.toogle_prefs:
|
|
|
|
box = col.box()
|
2023-03-16 18:39:15 +01:00
|
|
|
col = box.column(align=True)
|
|
|
|
col.use_property_split = True
|
|
|
|
col.use_property_decorate = False
|
2023-03-14 13:38:04 +01:00
|
|
|
|
2023-03-16 18:39:15 +01:00
|
|
|
col.prop(settings, 'project_name', text='Projects')
|
2023-03-14 13:38:04 +01:00
|
|
|
|
|
|
|
if project:
|
|
|
|
if project.episodes:
|
2023-03-16 18:39:15 +01:00
|
|
|
col.prop(project, 'episode_name', text='Episodes')
|
2023-03-14 13:38:04 +01:00
|
|
|
|
2023-03-16 18:39:15 +01:00
|
|
|
col.prop(project, 'shot_template')
|
|
|
|
col.separator()
|
|
|
|
col.operator('vse_toolbox.new_episode', text='Add Episode', icon='IMPORT')
|
2023-03-14 13:38:04 +01:00
|
|
|
|
2023-03-16 18:39:15 +01:00
|
|
|
col = layout.column()
|
2023-03-14 13:38:04 +01:00
|
|
|
row = col.row(align=True)
|
2023-03-17 22:55:06 +01:00
|
|
|
row.operator('sequencer.import_files', text='Import', icon='IMPORT')
|
|
|
|
# TODO FAIRE DES VRAIS OPS
|
2023-03-14 13:38:04 +01:00
|
|
|
row.operator('sequencer.export_csv', text='Export', icon='EXPORT')
|
|
|
|
|
|
|
|
op = col.operator('sequencer.strips_render', text='Render Strips', icon='RENDER_ANIMATION')
|
|
|
|
|
|
|
|
|
|
|
|
class VSETB_PT_rename(VSETB_main, Panel):
|
|
|
|
bl_label = "Rename Strips"
|
|
|
|
bl_parent_id = "VSETB_PT_main"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
prefs = get_addon_prefs()
|
|
|
|
settings = get_settings()
|
|
|
|
project = settings.active_project
|
|
|
|
|
|
|
|
if not project:
|
|
|
|
return
|
|
|
|
|
|
|
|
episode = project.episode_name
|
|
|
|
|
|
|
|
layout = self.layout
|
|
|
|
col = layout.column()
|
|
|
|
|
|
|
|
col.use_property_split = True
|
|
|
|
|
|
|
|
row = col.row()
|
|
|
|
shot_increment = project.shot_increment
|
|
|
|
shot_template = project.shot_template.format(
|
|
|
|
episode=episode, index=0 * shot_increment)
|
|
|
|
|
|
|
|
row.separator()
|
|
|
|
|
2023-03-17 20:03:38 +01:00
|
|
|
op = row.operator('sequencer.strips_rename', text='Rename Shots', icon='SORTALPHA')
|
2023-03-14 13:38:04 +01:00
|
|
|
op.channel_name = 'Shots'
|
|
|
|
op.template = project.shot_template
|
|
|
|
op.increment = project.shot_increment
|
|
|
|
op.start_number = 10
|
|
|
|
row.label(text=f'{shot_template}')
|
|
|
|
|
|
|
|
|
2023-03-17 20:03:38 +01:00
|
|
|
class VSETB_PT_casting(VSETB_main, Panel):
|
|
|
|
bl_label = "Shot Casting"
|
|
|
|
bl_parent_id = "VSETB_PT_main"
|
|
|
|
|
|
|
|
# def draw_header(self, context):
|
|
|
|
# settings = get_settings()
|
|
|
|
# project = settings.active_project
|
|
|
|
|
|
|
|
# if not project or not project.assets:
|
|
|
|
# ico = 'ERROR'
|
|
|
|
# else:
|
|
|
|
# ico = 'REFRESH'
|
|
|
|
|
|
|
|
# layout = self.layout
|
|
|
|
# row = layout.row()
|
|
|
|
# row.operator('vse_toolbox.load_assets', icon=ico, text='')
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
scn = context.scene
|
|
|
|
active_strip = scn.sequence_editor.active_strip
|
|
|
|
if not active_strip:
|
|
|
|
return
|
|
|
|
|
|
|
|
settings = get_settings()
|
|
|
|
project = settings.active_project
|
|
|
|
|
|
|
|
if not project:
|
|
|
|
return
|
|
|
|
|
|
|
|
if not project.assets:
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.label(text='No Assets found. Load Assets first.')
|
|
|
|
row.operator('vse_toolbox.load_assets', icon='FILE_REFRESH', text='')
|
|
|
|
else:
|
|
|
|
row = layout.row(align=True)
|
|
|
|
row.label(text=f'Assets for {project.name} successfully loaded.')
|
|
|
|
|
|
|
|
row = layout.row()
|
|
|
|
ico = ("RESTRICT_SELECT_OFF" if settings.auto_select_strip else "RESTRICT_SELECT_ON")
|
|
|
|
row.prop(settings, "auto_select_strip", icon=ico)
|
|
|
|
|
|
|
|
row = layout.row()
|
|
|
|
row.label(text=f"Current Shot: {Path(active_strip.name).stem}")
|
|
|
|
row = layout.row()
|
|
|
|
row.template_list(
|
|
|
|
"VSETB_UL_casting", "shot_casting",
|
|
|
|
active_strip, "casting",
|
|
|
|
active_strip, "casting_index"
|
|
|
|
)
|
|
|
|
|
|
|
|
col = row.column(align=True)
|
|
|
|
|
|
|
|
col.operator('vse_toolbox.casting_add', icon='ADD', text="")
|
|
|
|
col.operator('vse_toolbox.casting_actions', icon='REMOVE', text="").action = 'REMOVE'
|
|
|
|
col.separator()
|
|
|
|
col.operator('vse_toolbox.casting_actions', icon='TRIA_UP', text="").action = 'UP'
|
|
|
|
col.operator('vse_toolbox.casting_actions', icon='TRIA_DOWN', text="").action = 'DOWN'
|
|
|
|
|
|
|
|
|
2023-03-14 13:38:04 +01:00
|
|
|
classes=(
|
|
|
|
VSETB_PT_main,
|
|
|
|
VSETB_PT_rename,
|
2023-03-17 20:03:38 +01:00
|
|
|
VSETB_PT_casting,
|
2023-03-14 13:38:04 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
def register():
|
|
|
|
for cls in classes:
|
|
|
|
bpy.utils.register_class(cls)
|
|
|
|
|
|
|
|
def unregister():
|
|
|
|
for cls in reversed(classes):
|
|
|
|
bpy.utils.unregister_class(cls)
|