flame: fix otio path padding

This commit is contained in:
Jakub Jezek 2022-01-12 15:37:11 +01:00
parent 67138f2787
commit f0a11fa0bf
No known key found for this signature in database
GPG key ID: D8548FBF690B100A
2 changed files with 9 additions and 6 deletions

View file

@ -295,7 +295,7 @@ def create_otio_reference(clip_data):
if is_sequence:
metadata.update({
"isSequence": True,
"padding": padding
"padding": len(padding)
})
otio_ex_ref_item = None

View file

@ -1,4 +1,5 @@
import re
import os
import opentimelineio as otio
import logging
log = logging.getLogger(__name__)
@ -33,19 +34,21 @@ def get_reformated_path(path, padded=True):
get_reformated_path("plate.1001.exr") > plate.%04d.exr
"""
padding = get_padding_from_path(path)
found = get_frame_from_path(path)
basename = os.path.basename(path)
dirpath = os.path.dirname(path)
padding = get_padding_from_path(basename)
found = get_frame_from_path(basename)
if not found:
log.info("Path is not sequence: {}".format(path))
return path
if padded:
path = path.replace(found, "%0{}d".format(padding))
basename = basename.replace(found, "%0{}d".format(padding))
else:
path = path.replace(found, "%d")
basename = basename.replace(found, "%d")
return path
return os.path.join(dirpath, basename)
def get_padding_from_path(path):