improve stamps

pull/5/head
“christopheseux” 2023-06-21 13:46:28 +02:00
parent 83d34c2e67
commit 3e5bed2f2a
2 changed files with 31 additions and 13 deletions

View File

@ -155,6 +155,7 @@ class VSETB_OT_set_stamps(Operator):
def execute(self, context): def execute(self, context):
scn = context.scene scn = context.scene
settings = get_scene_settings() settings = get_scene_settings()
project = settings.active_project
#strip_settings = get_strip_settings() #strip_settings = get_strip_settings()
channel_index = get_channel_index('Stamps') channel_index = get_channel_index('Stamps')
@ -179,15 +180,19 @@ class VSETB_OT_set_stamps(Operator):
font_size=font_size, y=margin, box_margin=box_margin, select=True, box_color=(0, 0, 0, 0.5)) font_size=font_size, y=margin, box_margin=box_margin, select=True, box_color=(0, 0, 0, 0.5))
# Project Name # Project Name
project_text = '{project_name}'
if project.type == 'TVSHOW':
project_text = '{project_name} / {episode_name}'
project_strip_stamp = new_text_strip('project_name_stamp', channel=1, **stamp_params, project_strip_stamp = new_text_strip('project_name_stamp', channel=1, **stamp_params,
text=settings.active_project.name, x=0.01, align_x='LEFT', align_y='BOTTOM') text=project_text, x=0.01, align_x='LEFT', align_y='BOTTOM')
project_strip_stamp.crop.max_x = crop_x * 2 project_strip_stamp.crop.max_x = crop_x * 2
project_strip_stamp.crop.max_y = crop_max_y project_strip_stamp.crop.max_y = crop_max_y
# Shot Name # Shot Name
shot_strip_stamp = new_text_strip('shot_name_stamp', channel=2, **stamp_params, shot_strip_stamp = new_text_strip('shot_name_stamp', channel=2, **stamp_params,
text='{active_shot_name}', align_y='BOTTOM') text='{sequence_name} / {shot_name}', align_y='BOTTOM')
shot_strip_stamp.crop.min_x = crop_x shot_strip_stamp.crop.min_x = crop_x
shot_strip_stamp.crop.max_x = crop_x shot_strip_stamp.crop.max_x = crop_x
@ -195,7 +200,7 @@ class VSETB_OT_set_stamps(Operator):
# Frame Range # Frame Range
frame_strip_stamp = new_text_strip('frame_range_stamp', channel=3, **stamp_params, frame_strip_stamp = new_text_strip('frame_range_stamp', channel=3, **stamp_params,
text='{active_shot_frame} / {active_shot_duration}', x=0.99, align_x='RIGHT', align_y='BOTTOM') text='{shot_frame} / {shot_duration}', x=0.99, align_x='RIGHT', align_y='BOTTOM')
frame_strip_stamp.crop.min_x = crop_x *2 frame_strip_stamp.crop.min_x = crop_x *2
frame_strip_stamp.crop.max_y = crop_max_y frame_strip_stamp.crop.max_y = crop_max_y

View File

@ -403,6 +403,9 @@ def set_active_strip(scene):
def update_text_strips(scene): def update_text_strips(scene):
#print("update_text_strips") #print("update_text_strips")
settings = get_scene_settings()
project = settings.active_project
episode = settings.active_episode
scn = bpy.context.scene scn = bpy.context.scene
if not scn.sequence_editor: if not scn.sequence_editor:
@ -410,21 +413,31 @@ def update_text_strips(scene):
format_data = { format_data = {
'scene': scene, 'scene': scene,
'active_shot_name': 'None', 'project_name': 'None',
'active_shot_frame': 0, 'episode_name': 'None',
'active_shot_duration': 0, 'sequence_name': 'None',
'active_shot_start': 0, 'strip_name': 'None',
'active_shot_end': 0 'shot_name': 'None',
'shot_frame': 0,
'shot_duration': 0,
'shot_start': 0,
'shot_end': 0,
} }
shot_strip = get_strip_at('Shots', frame=scene.frame_current) shot_strip = get_strip_at('Shots', frame=scene.frame_current)
if shot_strip: if shot_strip:
format_data.update({ format_data.update({
'active_shot_name': shot_strip.name, 'project_name': project.name,
'active_shot_duration': shot_strip.frame_final_duration, 'episode_name': episode.name,
'active_shot_frame': scene.frame_current - shot_strip.frame_final_start + 1, 'sequence_name': get_strip_sequence_name(shot_strip),
'active_shot_start': shot_strip.frame_final_start, 'strip_name': shot_strip.name,
'active_shot_end': shot_strip.frame_final_end, 'shot_name': 'sh{index:04d}'.format(**shot_strip.vsetb_strip_settings.format_data),
'shot_duration': shot_strip.frame_final_duration,
'shot_frame': scene.frame_current - shot_strip.frame_final_start + 1,
'shot_start': shot_strip.frame_final_start,
'shot_end': shot_strip.frame_final_end,
}) })
for strip in scene.sequence_editor.sequences_all: for strip in scene.sequence_editor.sequences_all: