fix stamps

florentin.luce 2024-04-18 18:02:38 +02:00
parent 7f60aae277
commit 948f5b53dd
2 changed files with 11 additions and 12 deletions

View File

@ -147,22 +147,21 @@ def open_file(filepath, env=None, select=False):
subprocess.Popen(cmd, env=env)
# def parse(string, template):
# template = re.sub(r'{index:(.+?)}', r'(?P<index>.+)', template)
# reg = re.sub(r'{(.+?)}', r'(?P<_\1>.+)', template)
# values = list(re.search(reg, string).groups())
# keys = re.findall(r'{(.+?)}', template) + ['index']
# return dict(zip(keys, values))
def parse(template, string):
template = re.sub(r'{index:(.+?)}', r'(?P<index>.+)', template)
reg = re.sub(r'{(.+?)}', r'(?P<_\1>.+)', template)
values = list(re.search(reg, string).groups())
keys = re.findall(r'{(.+?)}', template) + ['index']
return dict(zip(keys, values))
"""def parse(template, string):
reg = re.sub(r'{[^}]*}|\.', lambda m: m.group() if m.group().startswith('{') else r'\.', template)
reg = re.sub(r'{(.+?)}', r'(?P<\1>.*)', reg)
#print(string, template, reg)
if result := re.match(reg, string):
return result.groupdict()
return result.groupdict()"""
def expand(template, **kargs):
template = Path(template).as_posix()

View File

@ -218,7 +218,7 @@ class VSETB_OT_set_stamps(Operator):
# Shot Name
shot_strip_stamp = new_text_strip('shot_stamp', channel=2, **stamp_params,
text='sq{sequence} / sh{shot}', align_y='BOTTOM')
text='{sequence} / sh{index}', align_y='BOTTOM')
shot_strip_stamp.crop.min_x = crop_x
shot_strip_stamp.crop.max_x = crop_x