From 86a9613fdb849971f1f9fb2ddf16b3e28de3eca4 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 27 Feb 2025 13:06:45 +0100 Subject: [PATCH] Fix get real frames to include steps --- .../pipeline/farm/pyblish_functions.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/pipeline/farm/pyblish_functions.py b/client/ayon_core/pipeline/farm/pyblish_functions.py index e9a9906d48..81e10abeff 100644 --- a/client/ayon_core/pipeline/farm/pyblish_functions.py +++ b/client/ayon_core/pipeline/farm/pyblish_functions.py @@ -480,13 +480,27 @@ def get_real_frames_to_render(frames): """Returns list of frames that should be rendered. Artists could want to selectively render only particular frames + Handles formats as: + 1001 + 1002,1004 + 1003-1005 + 1001-1100x5 """ + pattern = r'(?:x|step|by|every)?(\d+)$' + frames_to_render = [] + step = 1 for frame in frames.split(","): if "-" in frame: - splitted = frame.split("-") + frame_start, frame_end = frame.split("-") + match = re.findall(pattern, frame_end) + if match: + step = int(match[0]) + frame_end = re.sub(pattern, "", frame_end) + frames_to_render.extend( - range(int(splitted[0]), int(splitted[1])+1)) + range(int(frame_start), int(frame_end) + 1, step) + ) else: frames_to_render.append(int(frame)) frames_to_render.sort()