refactor and fixes for episode handling gav
This commit is contained in:
+210
-123
@@ -6,9 +6,9 @@ import bpy
|
||||
from bpy.types import Panel, Menu
|
||||
from bl_ui.utils import PresetPanel
|
||||
|
||||
from vse_toolbox.bl_utils import (get_addon_prefs, get_scene_settings, get_strip_settings)
|
||||
from vse_toolbox.bl_utils import get_addon_prefs, get_scene_settings, get_strip_settings
|
||||
from vse_toolbox.constants import ASSET_PREVIEWS, REVIEW_TEMPLATE_BLEND
|
||||
from vse_toolbox.sequencer_utils import (set_active_strip, get_channel_name, get_strips)
|
||||
from vse_toolbox.sequencer_utils import set_active_strip, get_channel_name, get_strips
|
||||
from vse_toolbox.file_utils import norm_str
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class VSETB_PT_main(VSETB_main, Panel):
|
||||
# row.label('VSE Toolbox')
|
||||
|
||||
# row.prop(settings, 'project_name', text='')
|
||||
|
||||
|
||||
# project = settings.active_project
|
||||
|
||||
# if project and project.type == 'TVSHOW':
|
||||
@@ -47,21 +47,23 @@ class VSETB_PT_main(VSETB_main, Panel):
|
||||
|
||||
row = layout.row(align=True)
|
||||
|
||||
row.operator('vse_toolbox.load_projects', icon='FILE_REFRESH', text='', emboss=False)
|
||||
row.operator(
|
||||
"vse_toolbox.load_projects", icon="FILE_REFRESH", text="", emboss=False
|
||||
)
|
||||
row.separator(factor=0.5)
|
||||
row.prop(settings, 'project_name', text='')
|
||||
|
||||
row.prop(settings, "project_name", text="")
|
||||
|
||||
project = settings.active_project
|
||||
|
||||
if not project:
|
||||
return
|
||||
|
||||
if project and project.type == 'TVSHOW':
|
||||
if project and project.type == "TVSHOW":
|
||||
row.separator(factor=0.5)
|
||||
row.prop(project, 'episode_name', text='')
|
||||
|
||||
row.prop(project, "episode_name", text="")
|
||||
|
||||
row.separator(factor=0.5)
|
||||
row.prop(project, "show_settings", icon="PREFERENCES", text='')
|
||||
row.prop(project, "show_settings", icon="PREFERENCES", text="")
|
||||
if project.show_settings:
|
||||
box = layout.box()
|
||||
split = box.split(factor=0.3)
|
||||
@@ -76,7 +78,7 @@ class VSETB_PT_main(VSETB_main, Panel):
|
||||
row.separator(factor=0.5)
|
||||
row.label(text="Template")
|
||||
|
||||
row.operator("vse_toolbox.add_template", text="", icon='ADD', emboss=False)
|
||||
row.operator("vse_toolbox.add_template", text="", icon="ADD", emboss=False)
|
||||
|
||||
for i, template in enumerate(project.templates):
|
||||
row = name_col.row()
|
||||
@@ -86,12 +88,13 @@ class VSETB_PT_main(VSETB_main, Panel):
|
||||
subrow = row.row()
|
||||
subrow.prop(template, "value", text="")
|
||||
row.separator(factor=0.25)
|
||||
row.operator("vse_toolbox.remove_template", text="", icon='REMOVE', emboss=False).index = i
|
||||
|
||||
row.operator(
|
||||
"vse_toolbox.remove_template", text="", icon="REMOVE", emboss=False
|
||||
).index = i
|
||||
|
||||
# settings = get_scene_settings()
|
||||
# prefs = get_addon_prefs()
|
||||
|
||||
|
||||
# project = settings.active_project
|
||||
|
||||
# layout = self.layout
|
||||
@@ -103,13 +106,13 @@ class VSETB_PT_main(VSETB_main, Panel):
|
||||
# if project.type == 'TVSHOW':
|
||||
# col.prop(project, 'episode_name', text='Episodes')
|
||||
|
||||
#col.separator()
|
||||
# col.separator()
|
||||
|
||||
#row = col.row(align=True)
|
||||
|
||||
#row.prop(settings, 'toogle_prefs', text='', icon='PREFERENCES', toggle=True)
|
||||
|
||||
'''
|
||||
# row = col.row(align=True)
|
||||
|
||||
# row.prop(settings, 'toogle_prefs', text='', icon='PREFERENCES', toggle=True)
|
||||
|
||||
"""
|
||||
if settings.toogle_prefs:
|
||||
box = col.box()
|
||||
col = box.column(align=True)
|
||||
@@ -126,21 +129,22 @@ class VSETB_PT_main(VSETB_main, Panel):
|
||||
#col.prop(project, 'shot_template')
|
||||
# col.separator()
|
||||
# col.operator('vse_toolbox.new_episode', text='Add Episode', icon='IMPORT')
|
||||
'''
|
||||
"""
|
||||
|
||||
# Rename
|
||||
|
||||
|
||||
class VSETB_PT_strip(Panel):
|
||||
bl_space_type = "SEQUENCE_EDITOR"
|
||||
bl_region_type = "UI"
|
||||
bl_category = "Strip"
|
||||
bl_label = "VSE ToolBox"
|
||||
#bl_order = 0
|
||||
# bl_order = 0
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
strip = context.active_strip
|
||||
return strip and get_channel_name(strip) == 'Shots'
|
||||
return strip and get_channel_name(strip) == "Shots"
|
||||
|
||||
def draw(self, context):
|
||||
prefs = get_addon_prefs()
|
||||
@@ -150,22 +154,28 @@ class VSETB_PT_strip(Panel):
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
layout.prop(settings, 'source_name', text='Source Name')
|
||||
|
||||
layout.prop(settings, "source_name", text="Source Name")
|
||||
|
||||
|
||||
class VSETB_PT_sequencer(VSETB_main, Panel):
|
||||
bl_label = "Sequencer"
|
||||
#bl_parent_id = "VSETB_PT_main"
|
||||
|
||||
# bl_parent_id = "VSETB_PT_main"
|
||||
|
||||
def draw_header_preset(self, context):
|
||||
settings = get_scene_settings()
|
||||
|
||||
audio_strips = [s for s in get_strips('Audio') if s.type == "SOUND"]
|
||||
audio_strips = [s for s in get_strips("Audio") if s.type == "SOUND"]
|
||||
|
||||
depress = any(s.show_waveform for s in audio_strips)
|
||||
self.layout.operator('vse_toolbox.show_waveform', text="", icon="IPO_ELASTIC", depress=depress).enabled = not depress
|
||||
self.layout.operator(
|
||||
"vse_toolbox.show_waveform", text="", icon="IPO_ELASTIC", depress=depress
|
||||
).enabled = not depress
|
||||
|
||||
ico = ("RESTRICT_SELECT_OFF" if settings.auto_select_strip else "RESTRICT_SELECT_ON")
|
||||
ico = (
|
||||
"RESTRICT_SELECT_OFF"
|
||||
if settings.auto_select_strip
|
||||
else "RESTRICT_SELECT_ON"
|
||||
)
|
||||
self.layout.prop(settings, "auto_select_strip", text="", icon=ico)
|
||||
|
||||
def draw(self, context):
|
||||
@@ -175,21 +185,35 @@ class VSETB_PT_sequencer(VSETB_main, Panel):
|
||||
project = settings.active_project
|
||||
|
||||
strip = context.active_strip
|
||||
channel = get_channel_name(strip)
|
||||
if strip is None and context.scene.sequence_editor:
|
||||
strip = next(
|
||||
(s for s in context.scene.sequence_editor.strips if s.select),
|
||||
None,
|
||||
)
|
||||
channel = get_channel_name(strip) or "Selected Channel"
|
||||
|
||||
col = layout.column()
|
||||
col.operator('vse_toolbox.set_sequencer', text='Set-Up Sequencer', icon='SEQ_SEQUENCER')
|
||||
col.operator('vse_toolbox.strips_rename', text=f'Rename {channel}', icon='SORTALPHA')
|
||||
col.operator('vse_toolbox.set_stamps', text='Set Stamps', icon='COLOR')
|
||||
col.operator("vse_toolbox.collect_files", text='Collect Files', icon='PACKAGE')
|
||||
col.operator(
|
||||
"vse_toolbox.strips_rename", text=f"Rename {channel}", icon="SORTALPHA"
|
||||
)
|
||||
col.operator("vse_toolbox.set_stamps", text="Set Stamps", icon="COLOR")
|
||||
col.operator("vse_toolbox.collect_files", text="Collect Files", icon="PACKAGE")
|
||||
col.operator(
|
||||
"vse_toolbox.scene_cut_detection",
|
||||
text="Scene Cut Detection",
|
||||
icon="SCULPTMODE_HLT",
|
||||
)
|
||||
col.operator(
|
||||
"vse_toolbox.create_sequence_strip", text="Create Sequence", icon="SEQUENCE"
|
||||
)
|
||||
|
||||
|
||||
class VSETB_PT_settings(VSETB_main, Panel):
|
||||
bl_label = "Settings"
|
||||
#bl_parent_id = "VSETB_PT_main"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
#def draw_header_preset(self, context):
|
||||
# bl_parent_id = "VSETB_PT_main"
|
||||
bl_options = {"DEFAULT_CLOSED"}
|
||||
|
||||
# def draw_header_preset(self, context):
|
||||
# self.layout.operator('vse_toolbox.import_files', icon='IMPORT', text='', emboss=False)
|
||||
|
||||
def draw(self, context):
|
||||
@@ -199,19 +223,21 @@ class VSETB_PT_settings(VSETB_main, Panel):
|
||||
project = settings.active_project
|
||||
|
||||
col = layout.column()
|
||||
#row = col.row(align=True)
|
||||
col.prop(project, 'sequence_template')
|
||||
col.prop(project, 'shot_template')
|
||||
col.prop(project, 'render_template')
|
||||
# row = col.row(align=True)
|
||||
col.prop(project, "sequence_template")
|
||||
col.prop(project, "shot_template")
|
||||
col.prop(project, "render_template")
|
||||
|
||||
|
||||
class VSETB_PT_imports(VSETB_main, Panel):
|
||||
bl_label = "Imports"
|
||||
#bl_parent_id = "VSETB_PT_main"
|
||||
#bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
# bl_parent_id = "VSETB_PT_main"
|
||||
# bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw_header_preset(self, context):
|
||||
self.layout.operator('vse_toolbox.import_files', icon='IMPORT', text='', emboss=False)
|
||||
self.layout.operator(
|
||||
"vse_toolbox.import_files", icon="IMPORT", text="", emboss=False
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
prefs = get_addon_prefs()
|
||||
@@ -220,27 +246,35 @@ class VSETB_PT_imports(VSETB_main, Panel):
|
||||
project = settings.active_project
|
||||
|
||||
col = layout.column()
|
||||
#row = col.row(align=True)
|
||||
#col.operator('vse_toolbox.import_files', text='Import', icon='IMPORT')
|
||||
col.operator('vse_toolbox.import_spreadsheet', text='Import Spreadsheet', icon='SPREADSHEET')
|
||||
col.operator("vse_toolbox.import_shots", text='Import Shots', icon="FILE_MOVIE")
|
||||
col.operator("vse_toolbox.import_stb_xml", text='Import STB XML', icon="FILE_TEXT")
|
||||
# row = col.row(align=True)
|
||||
# col.operator('vse_toolbox.import_files', text='Import', icon='IMPORT')
|
||||
col.operator(
|
||||
"vse_toolbox.import_spreadsheet",
|
||||
text="Import Spreadsheet",
|
||||
icon="SPREADSHEET",
|
||||
)
|
||||
col.operator("vse_toolbox.import_shots", text="Import Shots", icon="FILE_MOVIE")
|
||||
col.operator(
|
||||
"vse_toolbox.import_stb_xml", text="Import STB XML", icon="FILE_TEXT"
|
||||
)
|
||||
|
||||
|
||||
class VSETB_PT_presets(PresetPanel, Panel):
|
||||
bl_label = 'Spreadsheet Presets'
|
||||
preset_subdir = 'vse_toolbox'
|
||||
preset_operator = 'script.execute_preset'
|
||||
bl_label = "Spreadsheet Presets"
|
||||
preset_subdir = "vse_toolbox"
|
||||
preset_operator = "script.execute_preset"
|
||||
preset_add_operator = "vse_toolbox.add_spreadsheet_preset"
|
||||
|
||||
|
||||
class VSETB_PT_exports(VSETB_main, Panel):
|
||||
bl_label = "Exports"
|
||||
#bl_parent_id = "VSETB_PT_main"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
# bl_parent_id = "VSETB_PT_main"
|
||||
bl_options = {"DEFAULT_CLOSED"}
|
||||
|
||||
def draw_header_preset(self, context):
|
||||
self.layout.operator('vse_toolbox.export_spreadsheet', icon='EXPORT', text='', emboss=False)
|
||||
self.layout.operator(
|
||||
"vse_toolbox.export_spreadsheet", icon="EXPORT", text="", emboss=False
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
prefs = get_addon_prefs()
|
||||
@@ -250,18 +284,26 @@ class VSETB_PT_exports(VSETB_main, Panel):
|
||||
col = layout.column(align=False)
|
||||
|
||||
# TODO FAIRE DES VRAIS OPS
|
||||
col.operator('vse_toolbox.strips_render', text='Render Strips', icon='SEQUENCE')
|
||||
col.operator("vse_toolbox.strips_render", text="Render Strips", icon="SEQUENCE")
|
||||
|
||||
tracker_label = settings.tracker_name.title().replace('_', ' ')
|
||||
col.operator('vse_toolbox.upload_to_tracker', text=f'Upload to {tracker_label}', icon='EXPORT')
|
||||
col.operator('vse_toolbox.export_spreadsheet', text='Export Spreadsheet', icon='SPREADSHEET')
|
||||
col.operator('vse_toolbox.export_edl', text='Export edl', icon='SEQ_SEQUENCER')
|
||||
tracker_label = settings.tracker_name.title().replace("_", " ")
|
||||
col.operator(
|
||||
"vse_toolbox.upload_to_tracker",
|
||||
text=f"Upload to {tracker_label}",
|
||||
icon="EXPORT",
|
||||
)
|
||||
col.operator(
|
||||
"vse_toolbox.export_spreadsheet",
|
||||
text="Export Spreadsheet",
|
||||
icon="SPREADSHEET",
|
||||
)
|
||||
col.operator("vse_toolbox.export_edl", text="Export edl", icon="SEQ_SEQUENCER")
|
||||
|
||||
|
||||
class VSETB_PT_tracker(VSETB_main, Panel):
|
||||
bl_label = "Tracker"
|
||||
#bl_parent_id = "VSETB_PT_main"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
# bl_parent_id = "VSETB_PT_main"
|
||||
bl_options = {"DEFAULT_CLOSED"}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@@ -274,19 +316,20 @@ class VSETB_PT_tracker(VSETB_main, Panel):
|
||||
def draw(self, context):
|
||||
return
|
||||
|
||||
|
||||
class VSETB_PT_casting(VSETB_main, Panel):
|
||||
bl_label = "Casting"
|
||||
bl_parent_id = "VSETB_PT_tracker"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_options = {"DEFAULT_CLOSED"}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
strip = context.active_strip
|
||||
return strip and get_channel_name(strip) == 'Shots'
|
||||
return strip and get_channel_name(strip) == "Shots"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
settings = get_scene_settings()
|
||||
strip_settings = get_strip_settings()
|
||||
|
||||
@@ -297,35 +340,47 @@ class VSETB_PT_casting(VSETB_main, Panel):
|
||||
|
||||
if not project.assets:
|
||||
row = layout.row(align=True)
|
||||
row.label(text='No Assets in this Project')
|
||||
row.label(text="No Assets in this Project")
|
||||
else:
|
||||
|
||||
row = layout.row()
|
||||
col = row.column()
|
||||
col.template_list("VSETB_UL_casting", "shot_casting", strip_settings, "casting", strip_settings, "casting_index", rows=6)
|
||||
|
||||
col.template_list(
|
||||
"VSETB_UL_casting",
|
||||
"shot_casting",
|
||||
strip_settings,
|
||||
"casting",
|
||||
strip_settings,
|
||||
"casting_index",
|
||||
rows=6,
|
||||
)
|
||||
|
||||
col_tool = row.column(align=True)
|
||||
col_tool.operator('vse_toolbox.casting_add', icon='ADD', text="")
|
||||
col_tool.operator('vse_toolbox.casting_remove', icon='REMOVE', text="")
|
||||
col_tool.operator("vse_toolbox.casting_add", icon="ADD", text="")
|
||||
col_tool.operator("vse_toolbox.casting_remove", icon="REMOVE", text="")
|
||||
col_tool.separator()
|
||||
col_tool.operator('vse_toolbox.casting_move', icon='TRIA_UP', text="").direction = 'UP'
|
||||
col_tool.operator('vse_toolbox.casting_move', icon='TRIA_DOWN', text="").direction = 'DOWN'
|
||||
col_tool.operator(
|
||||
"vse_toolbox.casting_move", icon="TRIA_UP", text=""
|
||||
).direction = "UP"
|
||||
col_tool.operator(
|
||||
"vse_toolbox.casting_move", icon="TRIA_DOWN", text=""
|
||||
).direction = "DOWN"
|
||||
col_tool.separator()
|
||||
col_tool.operator('vse_toolbox.copy_casting', icon='COPYDOWN', text="")
|
||||
col_tool.operator('vse_toolbox.paste_casting', icon='PASTEDOWN', text="")
|
||||
col_tool.operator("vse_toolbox.copy_casting", icon="COPYDOWN", text="")
|
||||
col_tool.operator("vse_toolbox.paste_casting", icon="PASTEDOWN", text="")
|
||||
col_tool.separator()
|
||||
|
||||
col_tool.operator('vse_toolbox.casting_replace', icon='ZOOM_ALL', text="")
|
||||
col_tool.operator("vse_toolbox.casting_replace", icon="ZOOM_ALL", text="")
|
||||
col_tool.separator()
|
||||
col_tool.operator('vse_toolbox.casting_create_asset', icon='PLUS', text="")
|
||||
col_tool.operator("vse_toolbox.casting_create_asset", icon="PLUS", text="")
|
||||
|
||||
if strip_settings.casting:
|
||||
casting_item = strip_settings.casting[strip_settings.casting_index]
|
||||
asset = casting_item.asset
|
||||
if asset:
|
||||
if asset:
|
||||
if asset.icon_id:
|
||||
row = col.row(align=True)
|
||||
#row.scale_y = 0.5
|
||||
# row.scale_y = 0.5
|
||||
# box = col.box()
|
||||
# box.template_icon(icon_value=ico.icon_id, scale=7.5)
|
||||
|
||||
@@ -335,27 +390,27 @@ class VSETB_PT_casting(VSETB_main, Panel):
|
||||
class VSETB_PT_metadata(VSETB_main, Panel):
|
||||
bl_label = "Shot Metadata"
|
||||
bl_parent_id = "VSETB_PT_tracker"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_options = {"DEFAULT_CLOSED"}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_strip and get_scene_settings().active_project
|
||||
|
||||
def draw(self, context):
|
||||
|
||||
|
||||
strip_settings = get_strip_settings()
|
||||
project = get_scene_settings().active_project
|
||||
|
||||
layout = self.layout
|
||||
row = layout.row(align=True)
|
||||
label_col = row.column(align=True)
|
||||
label_col.alignment = 'RIGHT'
|
||||
label_col.alignment = "RIGHT"
|
||||
field_col = row.column(align=True)
|
||||
|
||||
for metadata_type in project.metadata_types:
|
||||
if metadata_type.entity_type != 'SHOT':
|
||||
if metadata_type.entity_type != "SHOT":
|
||||
continue
|
||||
|
||||
|
||||
metadata_key = metadata_type.field_name
|
||||
metadata_label = metadata_key.title()
|
||||
|
||||
@@ -365,24 +420,31 @@ class VSETB_PT_metadata(VSETB_main, Panel):
|
||||
|
||||
if metadata_type.choices:
|
||||
metadata_value = getattr(strip_settings.metadata, metadata_key)
|
||||
icon = 'LAYER_USED'
|
||||
icon = "LAYER_USED"
|
||||
if metadata_value:
|
||||
if metadata_value in metadata_type.choices:
|
||||
icon = 'DOT'
|
||||
icon = "DOT"
|
||||
else:
|
||||
icon = 'ADD'
|
||||
icon = "ADD"
|
||||
|
||||
field_row.prop_search(
|
||||
strip_settings.metadata,
|
||||
metadata_key,
|
||||
metadata_type,
|
||||
"choices",
|
||||
results_are_suggestions=True,
|
||||
icon=icon,
|
||||
text="",
|
||||
)
|
||||
|
||||
field_row.prop_search(strip_settings.metadata, metadata_key, metadata_type, 'choices',
|
||||
results_are_suggestions=True, icon=icon, text='')
|
||||
|
||||
else:
|
||||
field_row.prop(strip_settings.metadata, metadata_key, text='')
|
||||
field_row.prop(strip_settings.metadata, metadata_key, text="")
|
||||
|
||||
|
||||
class VSETB_PT_comments(VSETB_main, Panel):
|
||||
bl_label = "Comments"
|
||||
bl_parent_id = "VSETB_PT_tracker"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_options = {"DEFAULT_CLOSED"}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@@ -393,17 +455,16 @@ class VSETB_PT_comments(VSETB_main, Panel):
|
||||
|
||||
row = layout.row(align=True)
|
||||
label_col = row.column(align=True)
|
||||
label_col.alignment = 'RIGHT'
|
||||
label_col.alignment = "RIGHT"
|
||||
field_col = row.column(align=True)
|
||||
|
||||
|
||||
strip_settings = get_strip_settings()
|
||||
project = get_scene_settings().active_project
|
||||
|
||||
|
||||
for task_type in project.task_types:
|
||||
|
||||
norm_task_name = norm_str(task_type.name)
|
||||
|
||||
|
||||
if not hasattr(strip_settings.tasks, norm_task_name):
|
||||
continue
|
||||
|
||||
@@ -412,19 +473,22 @@ class VSETB_PT_comments(VSETB_main, Panel):
|
||||
row = field_col.row(align=True)
|
||||
row.separator()
|
||||
sub = row.row(align=True)
|
||||
sub.alignment = 'LEFT'
|
||||
sub.alignment = "LEFT"
|
||||
sub.scale_x = 0.15
|
||||
|
||||
sub.prop(task_type, 'color', text='')
|
||||
sub.prop(task_type, "color", text="")
|
||||
sub.enabled = False
|
||||
|
||||
row.prop(getattr(strip_settings.tasks, norm_task_name), 'comment', text='')
|
||||
row.prop(getattr(strip_settings.tasks, norm_task_name), "comment", text="")
|
||||
|
||||
|
||||
def context_menu_prop(self, context):
|
||||
if not hasattr(context, 'button_prop') or context.space_data.type != 'SEQUENCE_EDITOR':
|
||||
if (
|
||||
not hasattr(context, "button_prop")
|
||||
or context.space_data.type != "SEQUENCE_EDITOR"
|
||||
):
|
||||
return
|
||||
|
||||
|
||||
settings = get_strip_settings()
|
||||
if not settings:
|
||||
return
|
||||
@@ -432,10 +496,12 @@ def context_menu_prop(self, context):
|
||||
button_prop = context.button_prop
|
||||
if button_prop not in settings.metadata.bl_rna.properties.values():
|
||||
return
|
||||
|
||||
|
||||
layout = self.layout
|
||||
layout.separator()
|
||||
layout.operator('vse_toolbox.copy_metadata', icon='PASTEDOWN', text='Copy metadata to selected').metadata = button_prop.name
|
||||
layout.operator(
|
||||
"vse_toolbox.copy_metadata", icon="PASTEDOWN", text="Copy metadata to selected"
|
||||
).metadata = button_prop.name
|
||||
|
||||
|
||||
class VSETB_MT_main_menu(Menu):
|
||||
@@ -444,30 +510,49 @@ class VSETB_MT_main_menu(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
op = layout.operator('workspace.append_activate', text='Set Review Workspace', icon="WORKSPACE")
|
||||
op.idname = 'Review'
|
||||
op = layout.operator(
|
||||
"workspace.append_activate", text="Set Review Workspace", icon="WORKSPACE"
|
||||
)
|
||||
op.idname = "Review"
|
||||
op.filepath = str(REVIEW_TEMPLATE_BLEND)
|
||||
|
||||
layout.operator("wm.split_view", icon="ARROW_LEFTRIGHT")
|
||||
layout.separator()
|
||||
layout.operator('vse_toolbox.update_media', text='Update Media', icon='FILE_REFRESH')
|
||||
layout.operator('vse_toolbox.open_shot_on_tracker', text='Open Shot on Tracker', icon='URL')
|
||||
layout.operator('vse_toolbox.open_strip_folder', text='Open Strip Folder', icon='FILE_FOLDER')
|
||||
layout.operator(
|
||||
"vse_toolbox.update_media", text="Update Media", icon="FILE_REFRESH"
|
||||
)
|
||||
layout.operator(
|
||||
"vse_toolbox.open_shot_on_tracker", text="Open Shot on Tracker", icon="URL"
|
||||
)
|
||||
layout.operator(
|
||||
"vse_toolbox.open_strip_folder",
|
||||
text="Open Strip Folder",
|
||||
icon="FILE_FOLDER",
|
||||
)
|
||||
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.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')
|
||||
layout.operator('vse_toolbox.create_sequence_strip', text='Create Sequence')
|
||||
layout.operator('vse_toolbox.scene_cut_detection', text='Scene Cut Detection', icon='SCULPTMODE_HLT')
|
||||
layout.operator("vse_toolbox.merge_shot_strips", text="Merge Shots")
|
||||
layout.operator("vse_toolbox.create_sequence_strip", text="Create Sequence")
|
||||
layout.operator(
|
||||
"vse_toolbox.scene_cut_detection",
|
||||
text="Scene Cut Detection",
|
||||
icon="SCULPTMODE_HLT",
|
||||
)
|
||||
|
||||
|
||||
def draw_vse_toolbox_menu(self, context):
|
||||
self.layout.menu("VSETB_MT_main_menu")
|
||||
|
||||
|
||||
|
||||
def draw_file_new(self, context):
|
||||
self.layout.separator()
|
||||
op = self.layout.operator('wm.read_homefile', text="Review")
|
||||
op = self.layout.operator("wm.read_homefile", text="Review")
|
||||
op.filepath = str(REVIEW_TEMPLATE_BLEND)
|
||||
op.load_ui = True
|
||||
|
||||
@@ -483,23 +568,25 @@ classes = (
|
||||
VSETB_PT_presets,
|
||||
VSETB_PT_exports,
|
||||
VSETB_PT_strip,
|
||||
VSETB_MT_main_menu
|
||||
VSETB_MT_main_menu,
|
||||
)
|
||||
|
||||
def register():
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
|
||||
|
||||
bpy.types.UI_MT_button_context_menu.append(context_menu_prop)
|
||||
bpy.types.SEQUENCER_MT_editor_menus.append(draw_vse_toolbox_menu)
|
||||
|
||||
bpy.types.TOPBAR_MT_file_new.append(draw_file_new)
|
||||
|
||||
|
||||
def unregister():
|
||||
for cls in reversed(classes):
|
||||
bpy.utils.unregister_class(cls)
|
||||
|
||||
|
||||
bpy.types.UI_MT_button_context_menu.remove(context_menu_prop)
|
||||
bpy.types.SEQUENCER_MT_editor_menus.remove(draw_vse_toolbox_menu)
|
||||
|
||||
bpy.types.TOPBAR_MT_file_new.remove(draw_file_new)
|
||||
bpy.types.TOPBAR_MT_file_new.remove(draw_file_new)
|
||||
|
||||
@@ -64,6 +64,18 @@ def load_trackers():
|
||||
print(e)
|
||||
|
||||
|
||||
def _load_settings_after_startup():
|
||||
"""Apply the config once Blender has a normal context available."""
|
||||
if not getattr(bpy.context, 'scene', None):
|
||||
return 0.5
|
||||
|
||||
try:
|
||||
bpy.ops.vse_toolbox.load_settings()
|
||||
except RuntimeError as e:
|
||||
print(f'Could not load VSE Toolbox settings at startup: {e}')
|
||||
return None
|
||||
|
||||
|
||||
def load_prefs():
|
||||
prefs = get_addon_prefs()
|
||||
prefs_config_file = prefs.config_path
|
||||
@@ -97,6 +109,11 @@ def load_prefs():
|
||||
except AttributeError:
|
||||
pass # Scene not available yet during register()
|
||||
|
||||
# Loading preferences only sets the config path and tracker credentials;
|
||||
# apply the project configuration once Blender has finished registering
|
||||
# and provides a normal context (register() uses _RestrictContext).
|
||||
bpy.app.timers.register(_load_settings_after_startup, first_interval=0.1)
|
||||
|
||||
|
||||
class Trackers(PropertyGroup):
|
||||
def __iter__(self):
|
||||
|
||||
+6
-4
@@ -119,6 +119,7 @@ class Sequence(PropertyGroup):
|
||||
|
||||
|
||||
class TaskStatus(PropertyGroup):
|
||||
is_done : BoolProperty(default=False)
|
||||
__annotations__ = {}
|
||||
|
||||
|
||||
@@ -267,7 +268,8 @@ class ImportShots(PropertyGroup):
|
||||
|
||||
|
||||
class UploadToTracker(PropertyGroup):
|
||||
render_strips: BoolProperty(default=False)
|
||||
render_strips: BoolProperty(default=False,
|
||||
description='Render each selected shot strip to the Movie Path before uploading it as the preview')
|
||||
render_strip_template : StringProperty(
|
||||
name="Movie Path", default="//render/{strip}.{ext}")
|
||||
|
||||
@@ -749,7 +751,7 @@ class VSETB_PGT_strip_settings(PropertyGroup):
|
||||
channel = get_channel_name(strip)
|
||||
|
||||
if channel == 'Sequences':
|
||||
data = parse(project.sequence_template, strip.name)
|
||||
data = parse(project.sequence_template, strip.name) or {}
|
||||
#data['index'] = int(data['index'])
|
||||
#data['sequence'] = strip.name
|
||||
data['strip'] = strip.name
|
||||
@@ -758,10 +760,10 @@ class VSETB_PGT_strip_settings(PropertyGroup):
|
||||
elif channel == "Shots":
|
||||
data = {}
|
||||
if sequence_strip_name := get_strip_sequence_name(strip):
|
||||
data = parse(project.sequence_template, sequence_strip_name)
|
||||
data = parse(project.sequence_template, sequence_strip_name) or {}
|
||||
data['sequence_strip'] = sequence_strip_name
|
||||
|
||||
data.update(parse(project.shot_template, strip.name))
|
||||
data.update(parse(project.shot_template, strip.name) or {})
|
||||
#data['index'] = int(data['index'])
|
||||
|
||||
data['strip'] = strip.name
|
||||
|
||||
Reference in New Issue
Block a user