From 2b57f89b209472f3aca69c354fcdceafd1186e29 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Tue, 9 Jul 2024 18:45:04 +0800 Subject: [PATCH 1/7] use different file output template for textures from substance painter --- server/settings/tools.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/settings/tools.py b/server/settings/tools.py index 3ed12d3d0a..4f03f554f0 100644 --- a/server/settings/tools.py +++ b/server/settings/tools.py @@ -572,6 +572,17 @@ DEFAULT_TOOLS_VALUES = { "task_types": [], "task_names": [], "template_name": "tycache" + }, + { + "product_types": [ + "image" + ], + "hosts": [ + "substancepainter" + ], + "task_types": [], + "task_names": [], + "template_name": "substanceImage" } ], "hero_template_name_profiles": [ From df0202742a23256fef5fecb2c99a5f5e1881d46f Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Tue, 9 Jul 2024 21:27:56 +0800 Subject: [PATCH 2/7] make sure udim is not a list --- client/ayon_core/plugins/publish/integrate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/plugins/publish/integrate.py b/client/ayon_core/plugins/publish/integrate.py index 1a4cda4dbb..1bad97bc61 100644 --- a/client/ayon_core/plugins/publish/integrate.py +++ b/client/ayon_core/plugins/publish/integrate.py @@ -765,7 +765,7 @@ class IntegrateAsset(pyblish.api.InstancePlugin): # Manage anatomy template data template_data.pop("frame", None) if is_udim: - template_data["udim"] = repre["udim"][0] + template_data["udim"] = repre["udim"] # Construct destination filepath from template template_filled = path_template_obj.format_strict(template_data) repre_context = template_filled.used_values @@ -792,7 +792,7 @@ class IntegrateAsset(pyblish.api.InstancePlugin): # Explicitly store the full list even though template data might # have a different value because it uses just a single udim tile if repre.get("udim"): - repre_context["udim"] = repre.get("udim") # store list + repre_context["udim"] = repre.get("udim")[0] # store list # Use previous representation's id if there is a name match existing = existing_repres_by_name.get(repre["name"].lower()) From 45bfd411678c103eb91d8156b661e3f755c28b8c Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Tue, 9 Jul 2024 21:29:15 +0800 Subject: [PATCH 3/7] make sure udim is not a list --- server/settings/tools.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/server/settings/tools.py b/server/settings/tools.py index 4f03f554f0..3ed12d3d0a 100644 --- a/server/settings/tools.py +++ b/server/settings/tools.py @@ -572,17 +572,6 @@ DEFAULT_TOOLS_VALUES = { "task_types": [], "task_names": [], "template_name": "tycache" - }, - { - "product_types": [ - "image" - ], - "hosts": [ - "substancepainter" - ], - "task_types": [], - "task_names": [], - "template_name": "substanceImage" } ], "hero_template_name_profiles": [ From c852a429e5e643439b3fda9c6b2df814803b7865 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:16:34 +0200 Subject: [PATCH 4/7] use first udim for single file --- client/ayon_core/plugins/publish/integrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/integrate.py b/client/ayon_core/plugins/publish/integrate.py index 1bad97bc61..4808456ba9 100644 --- a/client/ayon_core/plugins/publish/integrate.py +++ b/client/ayon_core/plugins/publish/integrate.py @@ -765,7 +765,7 @@ class IntegrateAsset(pyblish.api.InstancePlugin): # Manage anatomy template data template_data.pop("frame", None) if is_udim: - template_data["udim"] = repre["udim"] + template_data["udim"] = repre["udim"][0] # Construct destination filepath from template template_filled = path_template_obj.format_strict(template_data) repre_context = template_filled.used_values From 6ffe70ddd554390f79548df942843b555707918e Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:16:52 +0200 Subject: [PATCH 5/7] don't store udims as list of integers --- client/ayon_core/plugins/publish/integrate.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/client/ayon_core/plugins/publish/integrate.py b/client/ayon_core/plugins/publish/integrate.py index 4808456ba9..2da33bfb19 100644 --- a/client/ayon_core/plugins/publish/integrate.py +++ b/client/ayon_core/plugins/publish/integrate.py @@ -789,11 +789,6 @@ class IntegrateAsset(pyblish.api.InstancePlugin): if value is not None: repre_context[key] = value - # Explicitly store the full list even though template data might - # have a different value because it uses just a single udim tile - if repre.get("udim"): - repre_context["udim"] = repre.get("udim")[0] # store list - # Use previous representation's id if there is a name match existing = existing_repres_by_name.get(repre["name"].lower()) repre_id = None From 1232fd9e2cc9af3f429d2a0b168cab34c9173d9d Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:19:34 +0200 Subject: [PATCH 6/7] auto-fix udim path calculation --- client/ayon_core/pipeline/load/utils.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/client/ayon_core/pipeline/load/utils.py b/client/ayon_core/pipeline/load/utils.py index 7f2bec6d34..a2e463ada0 100644 --- a/client/ayon_core/pipeline/load/utils.py +++ b/client/ayon_core/pipeline/load/utils.py @@ -639,6 +639,14 @@ def get_representation_path_with_anatomy(repre_entity, anatomy): try: context = repre_entity["context"] context["root"] = anatomy.roots + + # Auto-fix 'udim' being list of integers + # - This is a legacy issue for old representation entities, + # added 24/07/10 + udim = context.get("udim") + if isinstance(udim, list): + context["udim"] = udim[0] + path = StringTemplate.format_strict_template(template, context) except TemplateUnsolved as exc: @@ -681,6 +689,14 @@ def get_representation_path(representation, root=None): try: context = representation["context"] + + # Auto-fix 'udim' being list of integers + # - This is a legacy issue for old representation entities, + # added 24/07/10 + udim = context.get("udim") + if isinstance(udim, list): + context["udim"] = udim[0] + context["root"] = root path = StringTemplate.format_strict_template( template, context From 8203f6eeb2f91a6a775875c1fd22c9403035200a Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:41:57 +0200 Subject: [PATCH 7/7] added helper function for compatibility fix --- client/ayon_core/pipeline/load/utils.py | 30 ++++++++++++++----------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/client/ayon_core/pipeline/load/utils.py b/client/ayon_core/pipeline/load/utils.py index a2e463ada0..9ba407193e 100644 --- a/client/ayon_core/pipeline/load/utils.py +++ b/client/ayon_core/pipeline/load/utils.py @@ -587,6 +587,21 @@ def switch_container(container, representation, loader_plugin=None): return loader.switch(container, context) +def _fix_representation_context_compatibility(repre_context): + """Helper function to fix representation context compatibility. + + Args: + repre_context (dict): Representation context. + + """ + # Auto-fix 'udim' being list of integers + # - This is a legacy issue for old representation entities, + # added 24/07/10 + udim = repre_context.get("udim") + if isinstance(udim, list): + repre_context["udim"] = udim[0] + + def get_representation_path_from_context(context): """Preparation wrapper using only context as a argument""" from ayon_core.pipeline import get_current_project_name @@ -638,15 +653,9 @@ def get_representation_path_with_anatomy(repre_entity, anatomy): try: context = repre_entity["context"] + _fix_representation_context_compatibility(context) context["root"] = anatomy.roots - # Auto-fix 'udim' being list of integers - # - This is a legacy issue for old representation entities, - # added 24/07/10 - udim = context.get("udim") - if isinstance(udim, list): - context["udim"] = udim[0] - path = StringTemplate.format_strict_template(template, context) except TemplateUnsolved as exc: @@ -690,12 +699,7 @@ def get_representation_path(representation, root=None): try: context = representation["context"] - # Auto-fix 'udim' being list of integers - # - This is a legacy issue for old representation entities, - # added 24/07/10 - udim = context.get("udim") - if isinstance(udim, list): - context["udim"] = udim[0] + _fix_representation_context_compatibility(context) context["root"] = root path = StringTemplate.format_strict_template(