Clean-up add set stamps
This commit is contained in:
+104
-26
@@ -32,19 +32,21 @@ from vse_toolbox.constants import (
|
||||
)
|
||||
from vse_toolbox.sequencer_utils import (
|
||||
clean_sequencer,
|
||||
get_shot_sequence,
|
||||
get_strips,
|
||||
get_active_strip,
|
||||
set_active_strip,
|
||||
import_edit,
|
||||
import_movie,
|
||||
import_sound,
|
||||
rename_strips,
|
||||
render_strips,
|
||||
set_channels,
|
||||
get_channel_index,
|
||||
new_text_strip
|
||||
)
|
||||
from vse_toolbox.bl_utils import get_addon_prefs, get_scene_settings, get_strip_settings
|
||||
from vse_toolbox.file_utils import install_module, norm_name, norm_str
|
||||
|
||||
|
||||
class VSETB_OT_tracker_connect(Operator):
|
||||
bl_idname = "vse_toolbox.tracker_connect"
|
||||
bl_label = "Connect to Tracker"
|
||||
@@ -71,7 +73,7 @@ class VSETB_OT_tracker_connect(Operator):
|
||||
|
||||
|
||||
class VSETB_OT_export_csv(Operator):
|
||||
bl_idname = "sequencer.export_csv"
|
||||
bl_idname = "vse_toolbox.export_csv"
|
||||
bl_label = "Set Scene"
|
||||
bl_description = "Set Scene for Breakdown"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
@@ -132,7 +134,7 @@ class VSETB_OT_auto_select_files(Operator):
|
||||
|
||||
|
||||
class VSETB_OT_import_files(Operator):
|
||||
bl_idname = "sequencer.import_files"
|
||||
bl_idname = "vse_toolbox.import_files"
|
||||
bl_label = "Import"
|
||||
bl_description = "Import Edit"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
@@ -316,24 +318,30 @@ class VSETB_OT_load_projects(Operator):
|
||||
|
||||
for project_data in tracker.get_projects():
|
||||
project = settings.projects.add()
|
||||
project.type = project_data['production_type']
|
||||
project.name = project_data['name']
|
||||
project.id = project_data['id']
|
||||
|
||||
for episode_data in tracker.get_episodes(project_data):
|
||||
episode = project.episodes.add()
|
||||
episode.name = episode_data['name']
|
||||
episode.id = episode_data['id']
|
||||
if project.type == 'TV Show':
|
||||
for episode_data in tracker.get_episodes(project_data):
|
||||
episode = project.episodes.add()
|
||||
episode.name = episode_data['name']
|
||||
episode.id = episode_data['id']
|
||||
|
||||
for metadata_data in tracker.get_shots_metadata(project_data):
|
||||
#print(metadata_data)
|
||||
metadata_type = project.metadata_types.add()
|
||||
metadata_type.name = metadata_data
|
||||
metadata_type.name = metadata_data['field_name']
|
||||
metadata_type['choices'] = metadata_data['choices']
|
||||
|
||||
for asset_type_data in tracker.get_asset_types(project_data):
|
||||
asset_type = project.asset_types.add()
|
||||
asset_type.name = asset_type_data['name']
|
||||
asset_type = project.asset_types.add()
|
||||
asset_type.name = asset_type_data['name']
|
||||
|
||||
# settings.load_metadata_types()
|
||||
project.set_strip_metadata()
|
||||
|
||||
bpy.ops.vse_toolbox.load_assets()
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
@@ -395,7 +403,7 @@ class VSETB_OT_reload_addon(Operator):
|
||||
|
||||
|
||||
class VSETB_OT_rename(Operator):
|
||||
bl_idname = "sequencer.strips_rename"
|
||||
bl_idname = "vse_toolbox.strips_rename"
|
||||
bl_label = "Rename Strips"
|
||||
bl_description = "Rename Strips"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
@@ -403,7 +411,7 @@ class VSETB_OT_rename(Operator):
|
||||
template : StringProperty(name="Strip Template Name", default="")
|
||||
increment : IntProperty(name="Name Increment", default=0)
|
||||
channel_name : StringProperty(name="Channel Name", default="")
|
||||
selected_only : BoolProperty(name="Selected Only", default=False)
|
||||
#selected_only : BoolProperty(name="Selected Only", default=False)
|
||||
start_number : IntProperty(name="Start Number", default=0, min=0)
|
||||
by_sequence : BoolProperty(
|
||||
name="Reset By Sequence",
|
||||
@@ -432,11 +440,12 @@ class VSETB_OT_rename(Operator):
|
||||
col.prop(self, 'start_number')
|
||||
if self.channel_name == 'Shots':
|
||||
col.prop(self, 'by_sequence')
|
||||
col.prop(self, 'selected_only')
|
||||
#col.prop(self, 'selected_only')
|
||||
|
||||
def execute(self, context):
|
||||
scn = context.scene
|
||||
strips = get_strips(channel=self.channel_name, selected_only=self.selected_only)
|
||||
#strips = get_strips(channel=self.channel_name, selected_only=self.selected_only)
|
||||
strips = get_strips(channel=self.channel_name, selected_only=True)
|
||||
|
||||
rename_strips(
|
||||
strips, self.template,
|
||||
@@ -448,7 +457,7 @@ class VSETB_OT_rename(Operator):
|
||||
|
||||
|
||||
class VSETB_OT_render(Operator):
|
||||
bl_idname = "sequencer.strips_render"
|
||||
bl_idname = "vse_toolbox.strips_render"
|
||||
bl_label = "Render Shots Strips"
|
||||
bl_description = "Render Shots Strips"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
@@ -486,10 +495,10 @@ class VSETB_OT_render(Operator):
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class VSETB_OT_set_scene(Operator):
|
||||
bl_idname = "vse_toolbox.set_scene"
|
||||
bl_label = "Set Scene"
|
||||
bl_description = "Set Scene for Breakdown"
|
||||
class VSETB_OT_set_sequencer(Operator):
|
||||
bl_idname = "vse_toolbox.set_sequencer"
|
||||
bl_label = "Set Sequencer"
|
||||
bl_description = "Set resolution, frame end and channel names"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
@classmethod
|
||||
@@ -519,6 +528,7 @@ def get_asset_items(self, context):
|
||||
|
||||
return [(a.id, a.label, '', i) for i, a in enumerate(project.assets)]
|
||||
|
||||
|
||||
class VSETB_OT_casting_add(Operator):
|
||||
bl_idname = "vse_toolbox.casting_add"
|
||||
bl_label = "Casting Add"
|
||||
@@ -557,6 +567,8 @@ class VSETB_OT_casting_add(Operator):
|
||||
item.name = asset.name
|
||||
item.id = project.assets[self.asset_name].id
|
||||
|
||||
item['_name'] = asset.label
|
||||
|
||||
strip_settings.casting.update()
|
||||
|
||||
return {"FINISHED"}
|
||||
@@ -586,7 +598,8 @@ class VSETB_OT_casting_remove(Operator):
|
||||
pass
|
||||
else:
|
||||
item = strip_settings.casting[strip_settings.casting_index]
|
||||
info = f"Item {item.asset.label} removed from casting"
|
||||
label = item.asset.label if item.asset.label else 'Empty'
|
||||
info = f"Item {label} removed from casting"
|
||||
strip_settings.casting.remove(idx)
|
||||
|
||||
if strip_settings.casting_index == 0:
|
||||
@@ -648,7 +661,7 @@ class VSETB_OT_casting_move(Operator):
|
||||
|
||||
|
||||
class VSETB_OT_copy_casting(Operator):
|
||||
bl_idname = "sequencer.copy_casting"
|
||||
bl_idname = "vse_toolbox.copy_casting"
|
||||
bl_label = "Casting Actions"
|
||||
bl_description = "Copy Casting from active strip"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
@@ -674,7 +687,7 @@ class VSETB_OT_copy_casting(Operator):
|
||||
|
||||
|
||||
class VSETB_OT_paste_casting(Operator):
|
||||
bl_idname = "sequencer.paste_casting"
|
||||
bl_idname = "vse_toolbox.paste_casting"
|
||||
bl_label = "Casting Actions"
|
||||
bl_description = "Copy Casting from active strip"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
@@ -709,7 +722,71 @@ class VSETB_OT_paste_casting(Operator):
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
classes=(
|
||||
|
||||
class VSETB_OT_set_stamps(Operator):
|
||||
bl_idname = "vse_toolbox.set_stamps"
|
||||
bl_label = "Set Stamps"
|
||||
bl_description = "Set Stamps on Video"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def execute(self, context):
|
||||
scn = context.scene
|
||||
settings = get_scene_settings()
|
||||
#strip_settings = get_strip_settings()
|
||||
channel_index = get_channel_index('Stamps')
|
||||
|
||||
for strip in get_strips('Stamps'):
|
||||
if strip.type == 'META':
|
||||
scn.sequence_editor.sequences.remove(strip)
|
||||
|
||||
bpy.ops.sequencer.select_all(action='DESELECT')
|
||||
|
||||
# Project Name
|
||||
project_strip_stamp = new_text_strip(
|
||||
'project_name_stamp', channel=1, start=scn.frame_start, end=scn.frame_end,
|
||||
text=settings.active_project.name, font_size=24,
|
||||
x=0.01, y=0.01, align_x='LEFT', align_y='BOTTOM', select=True,
|
||||
box_color=(0, 0, 0, 0.5), box_margin=0.005,
|
||||
)
|
||||
|
||||
# Shot Name
|
||||
shot_strip_stamp = new_text_strip(
|
||||
f'shot_name_stamp', channel=2, start=scn.frame_start, end=scn.frame_end,
|
||||
text='{active_shot_name}', font_size=24,
|
||||
y=0.01, align_y='BOTTOM', select=True,
|
||||
box_color=(0, 0, 0, 0.5), box_margin=0.005,
|
||||
)
|
||||
|
||||
# Frame Range
|
||||
frame_strip_stamp = new_text_strip(
|
||||
'frame_range_stamp', channel=3, start=scn.frame_start, end=scn.frame_end,
|
||||
text='{active_shot_frame} / {active_shot_duration}', font_size=24,
|
||||
x=0.99, y=0.01, align_x='RIGHT', align_y='BOTTOM', select=True,
|
||||
box_color=(0, 0, 0, 0.5), box_margin=0.005,
|
||||
)
|
||||
|
||||
# for shot_strip in get_strips('Shots'):
|
||||
# # Shot Name
|
||||
# shot_strip_stamp = new_text_strip(
|
||||
# f'{shot_strip.name}_stamp', channel=3, start=shot_strip.frame_final_start, end=shot_strip.frame_final_end,
|
||||
# text=shot_strip.name, font_size=24,
|
||||
# y=0.01, align_y='BOTTOM', select=True,
|
||||
# box_color=(0, 0, 0, 0.35), box_margin=0.005,
|
||||
# )
|
||||
|
||||
bpy.ops.sequencer.meta_make()
|
||||
stamps_strip = context.active_sequence_strip
|
||||
stamps_strip.name = 'Stamps'
|
||||
stamps_strip.channel = channel_index
|
||||
|
||||
#stamps_strip = scn.sequence_editor.sequences.new_meta('Stamps', scn.frame_start, scn.frame_end)
|
||||
#stamps_strip.channel = get_channel_index('Stamps')
|
||||
scn.frame_set(scn.frame_current) # For update stamps
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
classes = (
|
||||
VSETB_OT_auto_select_files,
|
||||
VSETB_OT_casting_add,
|
||||
VSETB_OT_casting_remove,
|
||||
@@ -724,8 +801,9 @@ classes=(
|
||||
VSETB_OT_reload_addon,
|
||||
VSETB_OT_rename,
|
||||
VSETB_OT_render,
|
||||
VSETB_OT_set_scene,
|
||||
VSETB_OT_set_sequencer,
|
||||
VSETB_OT_tracker_connect,
|
||||
VSETB_OT_set_stamps
|
||||
)
|
||||
|
||||
def register():
|
||||
|
||||
Reference in New Issue
Block a user