rewrite import_shots and cleanup

This commit is contained in:
ChristopheSeux
2024-04-10 16:15:57 +02:00
parent dae9d55494
commit 2960bab63d
15 changed files with 1068 additions and 269 deletions
+57 -49
View File
@@ -7,7 +7,7 @@ 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.constants import ASSET_PREVIEWS
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.file_utils import norm_str
@@ -20,27 +20,53 @@ class VSETB_main:
class VSETB_PT_main(VSETB_main, Panel):
bl_options = {"HIDE_HEADER"}
def draw_header_preset(self, context):
self.layout.operator('vse_toolbox.load_projects', icon='FILE_REFRESH', text='', emboss=False)
# def draw_header(self, context):
# settings = get_scene_settings()
# prefs = get_addon_prefs()
# row = self.layout.row(align=True)
# row.label('VSE Toolbox')
# row.prop(settings, 'project_name', text='')
# project = settings.active_project
# if project and project.type == 'TVSHOW':
# row.prop(project, 'episode_name', text='')
# row.operator('vse_toolbox.load_projects', icon='FILE_REFRESH', text='', emboss=False)
def draw(self, context):
wm = context.window_manager
scn = context.scene
settings = get_scene_settings()
prefs = get_addon_prefs()
row = self.layout.row(align=False)
row.operator('vse_toolbox.load_projects', icon='FILE_REFRESH', text='', emboss=False)
row.prop(settings, 'project_name', text='')
project = settings.active_project
layout = self.layout
col = layout.column()
if project and project.type == 'TVSHOW':
row.prop(project, 'episode_name', text='')
col.prop(settings, 'project_name', text='Project')
# settings = get_scene_settings()
# prefs = get_addon_prefs()
# project = settings.active_project
if project:
if project.type == 'TVSHOW':
col.prop(project, 'episode_name', text='Episodes')
# layout = self.layout
# col = layout.column()
# col.prop(settings, 'project_name', text='Project')
# if project:
# if project.type == 'TVSHOW':
# col.prop(project, 'episode_name', text='Episodes')
#col.separator()
@@ -94,7 +120,7 @@ class VSETB_PT_strip(Panel):
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()
@@ -113,42 +139,19 @@ class VSETB_PT_sequencer(VSETB_main, Panel):
settings = get_scene_settings()
project = settings.active_project
strip = context.active_sequence_strip
channel = get_channel_name(strip)
col = layout.column()
col.operator('vse_toolbox.set_sequencer', text='Set-Up Sequencer', icon='SEQ_SEQUENCER')
#row = col.row()
shot_label = ''
sequence_label = ''
if project:
episode = project.episode_name
sequence_label = project.sequence_template.format(episode=episode, index=project.sequence_start_number)
shot_label = project.shot_template.format(episode=episode, sequence=sequence_label, index=project.shot_start_number)
#row.separator()
strip = context.active_sequence_strip
channel_name = get_channel_name(strip) or ''
if channel_name == 'Shots':
label = shot_label
elif channel_name == 'Sequences':
label = sequence_label
else:
label = 'Not Supported'
row = col.row(align=True)
if label == 'Not Supported':
row.enabled = False
op = row.operator('vse_toolbox.strips_rename', text=f'Rename {channel_name} ( {label} )', icon='SORTALPHA')
op.channel_name = channel_name
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')
class VSETB_PT_settings(VSETB_main, Panel):
bl_label = "Settings"
bl_parent_id = "VSETB_PT_main"
#bl_parent_id = "VSETB_PT_main"
bl_options = {'DEFAULT_CLOSED'}
#def draw_header_preset(self, context):
@@ -169,7 +172,7 @@ class VSETB_PT_settings(VSETB_main, Panel):
class VSETB_PT_imports(VSETB_main, Panel):
bl_label = "Imports"
bl_parent_id = "VSETB_PT_main"
#bl_parent_id = "VSETB_PT_main"
bl_options = {'DEFAULT_CLOSED'}
def draw_header_preset(self, context):
@@ -197,7 +200,7 @@ class VSETB_PT_presets(PresetPanel, Panel):
class VSETB_PT_exports(VSETB_main, Panel):
bl_label = "Exports"
bl_parent_id = "VSETB_PT_main"
#bl_parent_id = "VSETB_PT_main"
bl_options = {'DEFAULT_CLOSED'}
def draw_header_preset(self, context):
@@ -208,20 +211,20 @@ class VSETB_PT_exports(VSETB_main, Panel):
layout = self.layout
settings = get_scene_settings()
project = settings.active_project
col = layout.column(align=False)
# TODO FAIRE DES VRAIS OPS
layout.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('_', ' ')
layout.operator('vse_toolbox.upload_to_tracker', text=f'Upload to {tracker_label}', icon='EXPORT')
layout.operator('vse_toolbox.export_spreadsheet', text='Export Spreadsheet', icon='SPREADSHEET')
layout.operator('vse_toolbox.export_edl', text='Export edl', icon='SEQ_SEQUENCER')
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_parent_id = "VSETB_PT_main"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
@@ -403,8 +406,13 @@ class VSETB_MT_main_menu(Menu):
def draw(self, context):
layout = self.layout
layout.operator('vse_toolbox.open_shot_dir', text='Open Shot', icon='FILE_FOLDER')
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.operator('vse_toolbox.open_shot_folder', text='Open Shot Folder', icon='FILE_FOLDER')
layout.operator('vse_toolbox.open_shot_on_tracker', text='Open Shot on Tracker', icon='URL')
def draw_vse_toolbox_menu(self, context):
self.layout.menu("VSETB_MT_main_menu")