🐛 fix ASS creator and validator

This commit is contained in:
Ondrej Samohel 2023-06-23 16:06:19 +02:00
parent d3b2102f52
commit 1279acc090
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
2 changed files with 21 additions and 13 deletions

View file

@ -98,4 +98,4 @@ class CreateArnoldSceneSource(plugin.MayaCreator):
content = cmds.sets(name=instance_node + "_content_SET", empty=True)
proxy = cmds.sets(name=instance_node + "_proxy_SET", empty=True)
cmds.sets([content, proxy], forceElement=instance)
cmds.sets([content, proxy], forceElement=instance_node)

View file

@ -23,7 +23,9 @@ class ValidateAssRelativePaths(pyblish.api.InstancePlugin):
def process(self, instance):
# we cannot ask this until user open render settings as
# `defaultArnoldRenderOptions` doesn't exists
# `defaultArnoldRenderOptions` doesn't exist
errors = []
try:
relative_texture = cmds.getAttr(
"defaultArnoldRenderOptions.absolute_texture_paths")
@ -42,10 +44,11 @@ class ValidateAssRelativePaths(pyblish.api.InstancePlugin):
scene_dir, scene_basename = os.path.split(cmds.file(q=True, loc=True))
scene_name, _ = os.path.splitext(scene_basename)
assert self.maya_is_true(relative_texture) is not True, \
("Texture path is set to be absolute")
assert self.maya_is_true(relative_procedural) is not True, \
("Procedural path is set to be absolute")
if not self.maya_is_true(relative_texture):
errors.append("Texture path is set to be absolute")
if not self.maya_is_true(relative_procedural):
errors.append("Procedural path is set to be absolute")
anatomy = instance.context.data["anatomy"]
@ -57,15 +60,20 @@ class ValidateAssRelativePaths(pyblish.api.InstancePlugin):
for k in keys:
paths.append("[{}]".format(k))
self.log.info("discovered roots: {}".format(":".join(paths)))
self.log.debug("discovered roots: {}".format(":".join(paths)))
assert ":".join(paths) in texture_search_path, (
"Project roots are not in texture_search_path"
)
if ":".join(paths) not in texture_search_path:
errors.append((
"Project roots {} are not in texture_search_path: {}"
).format(paths, texture_search_path))
assert ":".join(paths) in procedural_search_path, (
"Project roots are not in procedural_search_path"
)
if ":".join(paths) not in procedural_search_path:
errors.append((
"Project roots {} are not in procedural_search_path: {}"
).format(paths, procedural_search_path))
if errors:
raise PublishValidationError("\n".join(errors))
@classmethod
def repair(cls, instance):