Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish UDIM tiles with publisher #963

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions client/ayon_core/plugins/publish/collect_udim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""Publish UDIM tiles."""
import re

import pyblish.api
from ayon_core.lib import BoolDef
from ayon_core.pipeline import publish

UDIM_REGEX = re.compile(r"(.*)\.(?P<udim>\d{4})\.(.*)")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow either . or _ separator to the udim numbers.

Suggested change
UDIM_REGEX = re.compile(r"(.*)\.(?P<udim>\d{4})\.(.*)")
UDIM_REGEX = re.compile(r"(.*)[._](?P<udim>\d{4})\.(.*)")



class CollectUDIMs(
pyblish.api.InstancePlugin, publish.AYONPyblishPluginMixin):
"""Collect UDIMs tiles."""

label = "Collect UDIMs"
order = pyblish.api.CollectorOrder + 0.499
families = ["image"]

def process(self, instance):
# type: (pyblish.api.Instance) -> None
instance_settings = self.get_attr_values_from_data(instance.data)
is_udim = instance_settings.get("isUDIM", False)
if not is_udim:
return

for representation in instance.data["representations"]:
if isinstance(representation["files"], (list, tuple)):
continue
Comment on lines +27 to +28
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, no?

Wouldn't this technically actually skip sequences of UDIMs?
Also, should we pop frame from the representation

Copy link
Collaborator

@BigRoy BigRoy Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Libor's screenshot show the problem - it's generating a representation PER image in the sequence? Even though it should be one representation - right?


# sourcery skip: use-named-expression
match = re.search(UDIM_REGEX, representation["files"])
if match:
representation["udim"] = [match.group("udim")]

@classmethod
def get_attribute_defs(cls):
return [
BoolDef("isUDIM",
label="Is UDIM",
default=False)
Comment on lines +38 to +40
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a tooltip/description to explain what this does and when to use it.

]
Loading