diff --git a/server_addon/maya/client/ayon_maya/api/lib.py b/server_addon/maya/client/ayon_maya/api/lib.py index 66ad8b573f..c1918cee4d 100644 --- a/server_addon/maya/client/ayon_maya/api/lib.py +++ b/server_addon/maya/client/ayon_maya/api/lib.py @@ -11,6 +11,7 @@ import json import logging import contextlib import capture +import clique from .exitstack import ExitStack from collections import OrderedDict, defaultdict from math import ceil @@ -4254,7 +4255,7 @@ def search_textures(filepath): dynamic patterns like or %04d Returns: - list[str | clique.Collection]: The files found on disk + list: The files found on disk """ filename = os.path.basename(filepath) @@ -4264,15 +4265,15 @@ def search_textures(filepath): # For UDIM based textures (tiles) if "" in filename: - sequences = get_sequence(filepath, - pattern="") + sequences = self.get_sequence(filepath, + pattern="") if sequences: return sequences # Frame/time - Based textures (animated masks f.e) elif "%04d" in filename: - sequences = get_sequence(filepath, - pattern="%04d") + sequences = self.get_sequence(filepath, + pattern="%04d") if sequences: return sequences @@ -4282,7 +4283,6 @@ def search_textures(filepath): return [] - def get_sequence(filepath, pattern="%04d"): """Get sequence from filename. @@ -4299,11 +4299,9 @@ def get_sequence(filepath, pattern="%04d"): pattern (str): The pattern to swap with the variable frame number. Returns: - list[clique.Collection]: List of sequence frame collections. + list: file sequence. """ - import clique - escaped = re.escape(filepath) re_pattern = escaped.replace(pattern, "-?[0-9]+") @@ -4312,6 +4310,6 @@ def get_sequence(filepath, pattern="%04d"): if re.match(re_pattern, f)] pattern = [clique.PATTERNS["frames"]] - collections, remainder = clique.assemble( - files, patterns=pattern, minimum_items=1) - return collections + collection, remainder = clique.assemble(files, patterns=pattern) + + return collection diff --git a/server_addon/maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py b/server_addon/maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py index 279dc4bb0a..3c211b82db 100644 --- a/server_addon/maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py +++ b/server_addon/maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py @@ -1,5 +1,6 @@ import os +import re import pyblish.api from ayon_core.pipeline.publish import KnownPublishError from ayon_maya.api import lib @@ -214,3 +215,20 @@ class CollectYetiRig(plugin.MayaInstancePlugin): resources.append(item) return resources + + def _replace_tokens(self, strings): + env_re = re.compile(r"\$\{(\w+)\}") + + replaced = [] + for s in strings: + matches = re.finditer(env_re, s) + for m in matches: + try: + s = s.replace(m.group(), os.environ[m.group(1)]) + except KeyError: + msg = "Cannot find requested {} in environment".format( + m.group(1)) + self.log.error(msg) + raise RuntimeError(msg) + replaced.append(s) + return replaced \ No newline at end of file