Skip to content

Commit

Permalink
Merge pull request #764 from ynput/enhancement/AY-5975_Maya-Manage---…
Browse files Browse the repository at this point in the history
…Set-VersionUpdate-to-latest-action-doesnt-work-for-Image-Product-using-UDIM

Chore: Make sure udim in representation is not a list
  • Loading branch information
iLLiCiTiT authored Jul 10, 2024
2 parents b487574 + 8203f6e commit d15bdd4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
20 changes: 20 additions & 0 deletions client/ayon_core/pipeline/load/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -638,7 +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

path = StringTemplate.format_strict_template(template, context)

except TemplateUnsolved as exc:
Expand Down Expand Up @@ -681,6 +698,9 @@ def path_from_representation():

try:
context = representation["context"]

_fix_representation_context_compatibility(context)

context["root"] = root
path = StringTemplate.format_strict_template(
template, context
Expand Down
5 changes: 0 additions & 5 deletions client/ayon_core/plugins/publish/integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,11 +789,6 @@ def prepare_representation(
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") # 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
Expand Down

0 comments on commit d15bdd4

Please sign in to comment.