From 60e2441927ffd72a996663e99486bbb2fff595d5 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 28 Jun 2024 18:20:04 +0800 Subject: [PATCH 1/9] make sure the udim texture can be searched correctly with absolute path --- .../client/ayon_maya/plugins/publish/collect_yeti_rig.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 dbdc10789f..d05bc70dbd 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 @@ -276,7 +276,10 @@ class CollectYetiRig(plugin.MayaInstancePlugin): """ import clique - escaped = re.escape(filepath) + escaped = ( + re.escape(os.path.basename(filepath)) + if os.path.isabs(filepath) else re.escape(filepath) + ) re_pattern = escaped.replace(pattern, "-?[0-9]+") source_dir = os.path.dirname(filepath) @@ -284,7 +287,8 @@ class CollectYetiRig(plugin.MayaInstancePlugin): if re.match(re_pattern, f)] pattern = [clique.PATTERNS["frames"]] - collection, remainder = clique.assemble(files, patterns=pattern) + collection, remainder = clique.assemble( + files, patterns=pattern, minimum_items=1) return collection From c0ecdb1d85fedaea897cb5fc988e8a9ea35280d5 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 28 Jun 2024 18:34:39 +0800 Subject: [PATCH 2/9] use basename of filepath - big roy's comment --- .../plugins/publish/collect_yeti_rig.py | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) 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 d05bc70dbd..c5b5dac4ec 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 @@ -276,19 +276,15 @@ class CollectYetiRig(plugin.MayaInstancePlugin): """ import clique - escaped = ( - re.escape(os.path.basename(filepath)) - if os.path.isabs(filepath) else re.escape(filepath) - ) - re_pattern = escaped.replace(pattern, "-?[0-9]+") - + filename = os.path.basename(filepath) + re_pattern = re.escape(filename) + re_pattern = re_pattern.replace(re.escape(pattern), "-?[0-9]+") source_dir = os.path.dirname(filepath) - files = [f for f in os.listdir(source_dir) - if re.match(re_pattern, f)] - - pattern = [clique.PATTERNS["frames"]] - collection, remainder = clique.assemble( - files, patterns=pattern, minimum_items=1) + files = [f for f in os.listdir(source_dir) if re.match(re_pattern, f)] + collection, _remainder = clique.assemble( + files, + patterns=[clique.PATTERNS["frames"]], + minimum_items=1) return collection From 462e31523025afc4ef0bafd1975e9a214f31c300 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 28 Jun 2024 18:44:41 +0800 Subject: [PATCH 3/9] move import clique to the top --- .../maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 c5b5dac4ec..fa09e60d45 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 clique import pyblish.api from ayon_core.pipeline.publish import KnownPublishError @@ -274,8 +275,6 @@ class CollectYetiRig(plugin.MayaInstancePlugin): list: file sequence. """ - import clique - filename = os.path.basename(filepath) re_pattern = re.escape(filename) re_pattern = re_pattern.replace(re.escape(pattern), "-?[0-9]+") From 6c92eb513f720cc68523ee8d1aee03348229cf2b Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Mon, 1 Jul 2024 12:22:47 +0800 Subject: [PATCH 4/9] make sure the parsed file is string value inside resources['files'] --- .../client/ayon_maya/plugins/publish/collect_yeti_rig.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 fa09e60d45..6ec691d156 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 @@ -284,8 +284,9 @@ class CollectYetiRig(plugin.MayaInstancePlugin): files, patterns=[clique.PATTERNS["frames"]], minimum_items=1) - - return collection + files = [texture for texture_collection in collection + for texture in texture_collection] + return files def _replace_tokens(self, strings): env_re = re.compile(r"\$\{(\w+)\}") From 0eb77893815aef665c3e9136f3305cdde47f5a24 Mon Sep 17 00:00:00 2001 From: Kayla Man <64118225+moonyuet@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:46:18 +0800 Subject: [PATCH 5/9] Update server_addon/maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py Co-authored-by: Roy Nieterau --- .../ayon_maya/plugins/publish/collect_yeti_rig.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 6ec691d156..c6e3384bc0 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 @@ -280,13 +280,15 @@ class CollectYetiRig(plugin.MayaInstancePlugin): re_pattern = re_pattern.replace(re.escape(pattern), "-?[0-9]+") source_dir = os.path.dirname(filepath) files = [f for f in os.listdir(source_dir) if re.match(re_pattern, f)] - collection, _remainder = clique.assemble( + collections, _remainder = clique.assemble( files, patterns=[clique.PATTERNS["frames"]], minimum_items=1) - files = [texture for texture_collection in collection - for texture in texture_collection] - return files + + if len(collections) > 1: + raise ValueError(f"Multiple collections found for {files}. This is a bug.") + + return list(collections[0]) def _replace_tokens(self, strings): env_re = re.compile(r"\$\{(\w+)\}") From acbdd430be6940d831ca74e6a2b590b57ad082c3 Mon Sep 17 00:00:00 2001 From: Kayla Man <64118225+moonyuet@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:46:26 +0800 Subject: [PATCH 6/9] Update server_addon/maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py Co-authored-by: Roy Nieterau --- .../maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c6e3384bc0..f2020651b4 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 @@ -272,7 +272,7 @@ class CollectYetiRig(plugin.MayaInstancePlugin): pattern (str): The pattern to swap with the variable frame number. Returns: - list: file sequence. + list[str]: file sequence. """ filename = os.path.basename(filepath) From 599462eb12828eff68eedeb531876f152bb18d0f Mon Sep 17 00:00:00 2001 From: Kayla Man <64118225+moonyuet@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:29:52 +0800 Subject: [PATCH 7/9] Update server_addon/maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py Co-authored-by: Roy Nieterau --- .../maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 f2020651b4..189fc08ef7 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 @@ -286,7 +286,9 @@ class CollectYetiRig(plugin.MayaInstancePlugin): minimum_items=1) if len(collections) > 1: - raise ValueError(f"Multiple collections found for {files}. This is a bug.") + raise ValueError( + f"Multiple collections found for {collections}. " + "This is a bug.") return list(collections[0]) From c91b82eb2ece1556796275c323b864330ef84a4e Mon Sep 17 00:00:00 2001 From: Kayla Man <64118225+moonyuet@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:23:32 +0800 Subject: [PATCH 8/9] Update server_addon/maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py Co-authored-by: Roy Nieterau --- .../ayon_maya/plugins/publish/collect_yeti_rig.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 189fc08ef7..5bc5634023 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 @@ -280,6 +280,12 @@ class CollectYetiRig(plugin.MayaInstancePlugin): re_pattern = re_pattern.replace(re.escape(pattern), "-?[0-9]+") source_dir = os.path.dirname(filepath) files = [f for f in os.listdir(source_dir) if re.match(re_pattern, f)] + if not files: + # Files do not exist, this may not be a problem if e.g. the + # textures were relative paths and we're searching across + # multiple image search paths. + return + collections, _remainder = clique.assemble( files, patterns=[clique.PATTERNS["frames"]], @@ -290,7 +296,10 @@ class CollectYetiRig(plugin.MayaInstancePlugin): f"Multiple collections found for {collections}. " "This is a bug.") - return list(collections[0]) + return [ + os.path.join(source_dir, filename) + for filename in collections[0] + ] def _replace_tokens(self, strings): env_re = re.compile(r"\$\{(\w+)\}") From 6b9ff1772d53fd242a933467f7d2f5964f760b5c Mon Sep 17 00:00:00 2001 From: Kayla Man <64118225+moonyuet@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:23:43 +0800 Subject: [PATCH 9/9] Update server_addon/maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py Co-authored-by: Roy Nieterau --- .../maya/client/ayon_maya/plugins/publish/collect_yeti_rig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 5bc5634023..9cf13e6cc1 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 @@ -272,7 +272,7 @@ class CollectYetiRig(plugin.MayaInstancePlugin): pattern (str): The pattern to swap with the variable frame number. Returns: - list[str]: file sequence. + Optional[list[str]]: file sequence. """ filename = os.path.basename(filepath)