mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
transform the files with frame hashes to the list of filenames when publishing
This commit is contained in:
parent
0595afe8a3
commit
65bfe023c7
2 changed files with 30 additions and 1 deletions
|
|
@ -3456,3 +3456,27 @@ def get_head_filename_without_hashes(original_path, name):
|
|||
new_fhead = "{}.{}".format(fhead, name)
|
||||
filename = filename.replace(fhead, new_fhead)
|
||||
return filename
|
||||
|
||||
|
||||
def get_filenames_without_hash(filename, frame_start, frame_end):
|
||||
"""Get filenames without frame hash
|
||||
i.e. "renderCompositingMain.baking.0001.exr"
|
||||
|
||||
Args:
|
||||
filename (str): filename with frame hash
|
||||
frame_start (str): start of the frame
|
||||
frame_end (str): end of the frame
|
||||
|
||||
Returns:
|
||||
filenames(list): list of filename
|
||||
"""
|
||||
filenames = []
|
||||
for frame in range(int(frame_start), (int(frame_end) + 1)):
|
||||
if "#" in filename:
|
||||
# use regex to convert #### to {:0>4}
|
||||
def replace(match):
|
||||
return "{{:0>{}}}".format(len(match.group()))
|
||||
filename_without_hashes = re.sub("#+", replace, filename)
|
||||
new_filename = filename_without_hashes.format(frame)
|
||||
filenames.append(new_filename)
|
||||
return filenames
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ from .lib import (
|
|||
get_view_process_node,
|
||||
get_viewer_config_from_string,
|
||||
deprecated,
|
||||
get_head_filename_without_hashes
|
||||
get_head_filename_without_hashes,
|
||||
get_filenames_without_hash
|
||||
)
|
||||
from .pipeline import (
|
||||
list_instances,
|
||||
|
|
@ -638,6 +639,10 @@ class ExporterReview(object):
|
|||
"frameStart": self.first_frame,
|
||||
"frameEnd": self.last_frame,
|
||||
})
|
||||
if ".{}".format(self.ext) not in VIDEO_EXTENSIONS:
|
||||
filenames = get_filenames_without_hash(
|
||||
self.file, self.first_frame, self.last_frame)
|
||||
repre["files"] = filenames
|
||||
|
||||
if self.multiple_presets:
|
||||
repre["outputName"] = self.name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue