-
Notifications
You must be signed in to change notification settings - Fork 34
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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})\.(.*)") | ||
|
||
|
||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
] |
There was a problem hiding this comment.
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.