From 3e5bed2f2a9e83dc7b7081a61aac51eb080a56ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cchristopheseux=E2=80=9D?= <“seuxchristophe@hotmail.fr”> Date: Wed, 21 Jun 2023 13:46:28 +0200 Subject: [PATCH] improve stamps --- operators/sequencer.py | 11 ++++++++--- sequencer_utils.py | 33 +++++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/operators/sequencer.py b/operators/sequencer.py index 8656299..c2a270a 100644 --- a/operators/sequencer.py +++ b/operators/sequencer.py @@ -155,6 +155,7 @@ class VSETB_OT_set_stamps(Operator): def execute(self, context): scn = context.scene settings = get_scene_settings() + project = settings.active_project #strip_settings = get_strip_settings() 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)) # 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, - 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_y = crop_max_y # Shot Name + 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.max_x = crop_x @@ -195,7 +200,7 @@ class VSETB_OT_set_stamps(Operator): # Frame Range 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.max_y = crop_max_y diff --git a/sequencer_utils.py b/sequencer_utils.py index 6a7d5e0..5694be2 100644 --- a/sequencer_utils.py +++ b/sequencer_utils.py @@ -403,6 +403,9 @@ def set_active_strip(scene): def update_text_strips(scene): #print("update_text_strips") + settings = get_scene_settings() + project = settings.active_project + episode = settings.active_episode scn = bpy.context.scene if not scn.sequence_editor: @@ -410,21 +413,31 @@ def update_text_strips(scene): format_data = { 'scene': scene, - 'active_shot_name': 'None', - 'active_shot_frame': 0, - 'active_shot_duration': 0, - 'active_shot_start': 0, - 'active_shot_end': 0 + 'project_name': 'None', + 'episode_name': 'None', + 'sequence_name': 'None', + 'strip_name': 'None', + '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) if shot_strip: + + format_data.update({ - 'active_shot_name': shot_strip.name, - 'active_shot_duration': shot_strip.frame_final_duration, - 'active_shot_frame': scene.frame_current - shot_strip.frame_final_start + 1, - 'active_shot_start': shot_strip.frame_final_start, - 'active_shot_end': shot_strip.frame_final_end, + 'project_name': project.name, + 'episode_name': episode.name, + 'sequence_name': get_strip_sequence_name(shot_strip), + 'strip_name': shot_strip.name, + '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: