rewrite import_shots and cleanup
This commit is contained in:
+57
-49
@@ -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")
|
||||
|
||||
+4
-1
@@ -29,6 +29,7 @@ from vse_toolbox.file_utils import (
|
||||
)
|
||||
from vse_toolbox.resources.trackers.kitsu import Kitsu
|
||||
|
||||
|
||||
def load_trackers():
|
||||
from vse_toolbox.resources.trackers.tracker import Tracker
|
||||
|
||||
@@ -112,7 +113,9 @@ class VSETB_Prefs(AddonPreferences):
|
||||
|
||||
layout = self.layout
|
||||
|
||||
layout.prop(self, 'config_path', text='Config Path')
|
||||
row = layout.row(align=True)
|
||||
row.prop(self, 'config_path', text='Config Path')
|
||||
row.operator("vse_toolbox.load_settings", icon="CHECKMARK", text='')
|
||||
layout.prop(self, "sort_metadata_items", text='Sort Metadata Items')
|
||||
|
||||
col = layout.column(align=True)
|
||||
|
||||
+89
-16
@@ -110,6 +110,12 @@ class MetadataType(PropertyGroup):
|
||||
class TaskType(PropertyGroup):
|
||||
color : FloatVectorProperty(subtype='COLOR')
|
||||
import_enabled : BoolProperty(default=False)
|
||||
id : StringProperty(default='')
|
||||
|
||||
|
||||
class Sequence(PropertyGroup):
|
||||
import_enabled : BoolProperty(default=False)
|
||||
id : StringProperty(default='')
|
||||
|
||||
|
||||
class TaskStatus(PropertyGroup):
|
||||
@@ -211,6 +217,66 @@ class SpreadsheetImport(PropertyGroup):
|
||||
update_edit: BoolProperty(default=True)
|
||||
|
||||
|
||||
def get_task_status_items(self, context):
|
||||
settings = get_scene_settings()
|
||||
project = settings.active_project
|
||||
|
||||
status_items = [('CURRENT', 'Current', '')]
|
||||
|
||||
if project:
|
||||
status_items += [(t.name, t.name, '') for t in project.task_statuses]
|
||||
return status_items
|
||||
|
||||
|
||||
def get_task_type_items(self, context):
|
||||
settings = get_scene_settings()
|
||||
project = settings.active_project
|
||||
|
||||
if not project:
|
||||
return [('NONE', 'None', '')]
|
||||
|
||||
return [(t.name, t.name, '') for t in project.task_types]
|
||||
|
||||
|
||||
class ImportShots(PropertyGroup):
|
||||
import_source: EnumProperty(items=[(i, i.title(), '') for i in ('DISK', 'TRACKER')])
|
||||
import_task: EnumProperty(items=[(i, i.title().replace('_', ' '), '')
|
||||
for i in ('LAST', 'FROM_LIST', 'ALL')], default='FROM_LIST')
|
||||
|
||||
#sequence_dir_template: StringProperty(
|
||||
# name="Sequence Template", default="$PROJECT_ROOT/sequences/{sequence}")
|
||||
|
||||
shot_folder_template: StringProperty(
|
||||
name="Shot Template", default="$PROJECT_ROOT/sequences/sq{sequence}/sh{shot}")
|
||||
|
||||
import_video_template : StringProperty(
|
||||
name="Video Path", default="./{task}/render/{version}.{ext}")
|
||||
|
||||
import_sequence: EnumProperty(items=[(i, i.title().replace('_', ' '), '')
|
||||
for i in ('SELECTED_STRIPS', 'FROM_LIST', 'ALL')], default='FROM_LIST')
|
||||
|
||||
previews_folder: StringProperty(
|
||||
name="Previews Folder", default="//sources", subtype='DIR_PATH')
|
||||
|
||||
|
||||
class UploadToTracker(PropertyGroup):
|
||||
render_strips: BoolProperty(default=False)
|
||||
render_strip_template : StringProperty(
|
||||
name="Movie Path", default="//render/{project_basename}.{ext}")
|
||||
|
||||
task : EnumProperty(items=get_task_type_items)
|
||||
status : EnumProperty(items=get_task_status_items)
|
||||
comment : StringProperty()
|
||||
add_preview : BoolProperty(default=True)
|
||||
preview_mode : EnumProperty(items=[(m, m.title().replace('_', ' '), '')
|
||||
for m in ('ONLY_NEW', 'REPLACE', 'ADD')])
|
||||
set_main_preview : BoolProperty(default=True)
|
||||
casting : BoolProperty(default=True)
|
||||
update_frames: BoolProperty(default=True)
|
||||
custom_data : BoolProperty(default=True)
|
||||
tasks_comment: BoolProperty(default=True)
|
||||
|
||||
|
||||
def get_episodes_items(self, context):
|
||||
settings = get_scene_settings()
|
||||
|
||||
@@ -232,7 +298,10 @@ class Project(PropertyGroup):
|
||||
id : StringProperty(default='')
|
||||
|
||||
shot_start_number : IntProperty(name="Shot Start Number", default=10, min=0)
|
||||
shot_padding : IntProperty(name="Shot Padding", default=4, min=0, max=10)
|
||||
|
||||
sequence_start_number : IntProperty(name="Sequence Start Number", default=10, min=0)
|
||||
sequence_padding : IntProperty(name="Sequence Padding", default=3, min=0, max=10)
|
||||
|
||||
reset_by_sequence : BoolProperty(
|
||||
name="Reset By Sequence",
|
||||
@@ -247,13 +316,13 @@ class Project(PropertyGroup):
|
||||
name="Shot Increment", default=10, min=0, step=10)
|
||||
|
||||
sequence_template : StringProperty(
|
||||
name="Sequence Name", default="sq{index:03d}")
|
||||
name="Sequence Name", default="sq{sequence}")
|
||||
|
||||
episode_template : StringProperty(
|
||||
name="Episode Name", default="ep{index:03d}")
|
||||
name="Episode Name", default="ep{episode}")
|
||||
|
||||
shot_template : StringProperty(
|
||||
name="Shot Name", default="{sequence}_sh{index:04d}")
|
||||
name="Shot Name", default="sq{sequence}_sh{shot}")
|
||||
|
||||
render_video_template : StringProperty(
|
||||
name="Movie Path", default="//render/{project_basename}.{ext}")
|
||||
@@ -300,17 +369,15 @@ class Project(PropertyGroup):
|
||||
task_types : CollectionProperty(type=TaskType)
|
||||
task_type_index : IntProperty()
|
||||
task_statuses : CollectionProperty(type=TaskStatus)
|
||||
sequences : CollectionProperty(type=Sequence)
|
||||
|
||||
spreadsheet_import: PointerProperty(type=SpreadsheetImport)
|
||||
spreadsheet_export: PointerProperty(type=SpreadsheetExport)
|
||||
|
||||
type : StringProperty()
|
||||
|
||||
import_source: EnumProperty(items=[(i, i.title(), '') for i in ('DISK', 'TRACKER')])
|
||||
import_task: EnumProperty(items=[(i, i.title(), '') for i in ('LAST', 'SELECTED', 'ALL')], default='LAST')
|
||||
|
||||
shot_dir_template: StringProperty(
|
||||
name="Shot Template", default="$PROJECT_ROOT/sequences/{sequence}/sh{index:04d}")
|
||||
upload_to_tracker: PointerProperty(type=UploadToTracker)
|
||||
import_shots: PointerProperty(type=ImportShots)
|
||||
|
||||
@property
|
||||
def active_episode(self):
|
||||
@@ -354,8 +421,6 @@ class Project(PropertyGroup):
|
||||
return cell_types
|
||||
|
||||
def set_spreadsheet(self):
|
||||
|
||||
|
||||
cell_names = ['Sequence', 'Shot', 'Nb Frames', 'Description']
|
||||
if self.type == 'TVSHOW':
|
||||
cell_names.insert(0, 'Episode')
|
||||
@@ -563,6 +628,7 @@ def on_project_updated(self, context):
|
||||
|
||||
os.environ['TRACKER_PROJECT_ID'] = settings.active_project.id
|
||||
|
||||
|
||||
class VSETB_PGT_scene_settings(PropertyGroup):
|
||||
|
||||
projects : CollectionProperty(type=Project)
|
||||
@@ -649,17 +715,21 @@ class VSETB_PGT_strip_settings(PropertyGroup):
|
||||
channel = get_channel_name(strip)
|
||||
|
||||
if channel == 'Sequences':
|
||||
data = parse(strip.name, template=project.sequence_template)
|
||||
data['index'] = int(data['index'])
|
||||
data['sequence'] = strip.name
|
||||
data = parse(project.sequence_template, strip.name)
|
||||
#data['index'] = int(data['index'])
|
||||
#data['sequence'] = strip.name
|
||||
data['strip'] = strip.name
|
||||
#data['shot'] = project.shot_template
|
||||
|
||||
elif channel == "Shots":
|
||||
data = {}
|
||||
if sequence_strip_name := get_strip_sequence_name(strip):
|
||||
data = parse(project.sequence_template, sequence_strip_name)
|
||||
data['sequence_strip'] = sequence_strip_name
|
||||
|
||||
data.update(parse(project.shot_template, strip.name))
|
||||
#data['index'] = int(data['index'])
|
||||
|
||||
data = parse(strip.name, template=project.shot_template)
|
||||
data['index'] = int(data['index'])
|
||||
data['sequence'] = get_strip_sequence_name(strip)
|
||||
data['strip'] = strip.name
|
||||
#data['shot'] = project.shot_template
|
||||
else:
|
||||
@@ -677,11 +747,14 @@ classes = (
|
||||
Episode,
|
||||
Metadata,
|
||||
MetadataType,
|
||||
Sequence,
|
||||
TaskType,
|
||||
ShotTasks,
|
||||
ShotTask,
|
||||
SpreadsheetImport,
|
||||
SpreadsheetExport,
|
||||
ImportShots,
|
||||
UploadToTracker,
|
||||
Project,
|
||||
VSETB_UL_spreadsheet_import,
|
||||
VSETB_UL_spreadsheet_export,
|
||||
|
||||
Reference in New Issue
Block a user