diff --git a/client/ayon_core/hosts/houdini/api/lib.py b/client/ayon_core/hosts/houdini/api/lib.py index 9db055779d..29a893cf12 100644 --- a/client/ayon_core/hosts/houdini/api/lib.py +++ b/client/ayon_core/hosts/houdini/api/lib.py @@ -1054,3 +1054,39 @@ def add_self_publish_button(node): template = node.parmTemplateGroup() template.insertBefore((0,), button_parm) node.setParmTemplateGroup(template) + + +def create_file_list(match, start_frame, end_frame): + """Collect files based on frame range and `regex.match` + + Args: + match(re.match): match object + start_frame(int): start of the animation + end_frame(int): end of the animation + + Returns: + list + + """ + + # Get the padding length + frame = match.group(1) + padding = len(frame) + + # Get the parts of the filename surrounding the frame number, + # so we can put our own frame numbers in. + span = match.span(1) + prefix = match.string[: span[0]] + suffix = match.string[span[1]:] + + # Generate filenames for all frames + result = [] + for i in range(start_frame, end_frame + 1): + + # Format frame number by the padding amount + str_frame = "{number:0{width}d}".format(number=i, width=padding) + + file_name = prefix + str_frame + suffix + result.append(file_name) + + return result \ No newline at end of file diff --git a/client/ayon_core/hosts/houdini/plugins/publish/collect_frames.py b/client/ayon_core/hosts/houdini/plugins/publish/collect_frames.py index a643ab0d38..6931f29e1c 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/collect_frames.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/collect_frames.py @@ -54,46 +54,10 @@ class CollectFrames(pyblish.api.InstancePlugin): # Check if frames are bigger than 1 (file collection) # override the result if end_frame - start_frame > 0: - result = self.create_file_list( + result = lib.create_file_list( match, int(start_frame), int(end_frame) ) # todo: `frames` currently conflicts with "explicit frames" for a # for a custom frame list. So this should be refactored. instance.data.update({"frames": result}) - - @staticmethod - def create_file_list(match, start_frame, end_frame): - """Collect files based on frame range and `regex.match` - - Args: - match(re.match): match object - start_frame(int): start of the animation - end_frame(int): end of the animation - - Returns: - list - - """ - - # Get the padding length - frame = match.group(1) - padding = len(frame) - - # Get the parts of the filename surrounding the frame number, - # so we can put our own frame numbers in. - span = match.span(1) - prefix = match.string[: span[0]] - suffix = match.string[span[1]:] - - # Generate filenames for all frames - result = [] - for i in range(start_frame, end_frame + 1): - - # Format frame number by the padding amount - str_frame = "{number:0{width}d}".format(number=i, width=padding) - - file_name = prefix + str_frame + suffix - result.append(file_name) - - return result