mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Support same attribute names on different node types.
This commit is contained in:
parent
f8cb017e90
commit
2388cf53cb
1 changed files with 19 additions and 8 deletions
|
|
@ -274,16 +274,18 @@ class ValidateRenderSettings(pyblish.api.InstancePlugin):
|
||||||
|
|
||||||
# go through definitions and test if such node.attribute exists.
|
# go through definitions and test if such node.attribute exists.
|
||||||
# if so, compare its value from the one required.
|
# if so, compare its value from the one required.
|
||||||
for attribute, data in cls.get_nodes(instance, renderer).items():
|
for data in cls.get_nodes(instance, renderer):
|
||||||
for node in data["nodes"]:
|
for node in data["nodes"]:
|
||||||
try:
|
try:
|
||||||
render_value = cmds.getAttr(
|
render_value = cmds.getAttr(
|
||||||
"{}.{}".format(node, attribute)
|
"{}.{}".format(node, data["attribute"])
|
||||||
)
|
)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
invalid = True
|
invalid = True
|
||||||
cls.log.error(
|
cls.log.error(
|
||||||
"Cannot get value of {}.{}".format(node, attribute)
|
"Cannot get value of {}.{}".format(
|
||||||
|
node, data["attribute"]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if render_value not in data["values"]:
|
if render_value not in data["values"]:
|
||||||
|
|
@ -291,7 +293,10 @@ class ValidateRenderSettings(pyblish.api.InstancePlugin):
|
||||||
cls.log.error(
|
cls.log.error(
|
||||||
"Invalid value {} set on {}.{}. Expecting "
|
"Invalid value {} set on {}.{}. Expecting "
|
||||||
"{}".format(
|
"{}".format(
|
||||||
render_value, node, attribute, data["values"]
|
render_value,
|
||||||
|
node,
|
||||||
|
data["attribute"],
|
||||||
|
data["values"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -305,7 +310,7 @@ class ValidateRenderSettings(pyblish.api.InstancePlugin):
|
||||||
"{}_render_attributes".format(renderer)
|
"{}_render_attributes".format(renderer)
|
||||||
) or []
|
) or []
|
||||||
)
|
)
|
||||||
result = {}
|
result = []
|
||||||
for attr, values in OrderedDict(validation_settings).items():
|
for attr, values in OrderedDict(validation_settings).items():
|
||||||
values = [convert_to_int_or_float(v) for v in values if v]
|
values = [convert_to_int_or_float(v) for v in values if v]
|
||||||
|
|
||||||
|
|
@ -335,7 +340,13 @@ class ValidateRenderSettings(pyblish.api.InstancePlugin):
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
result[attribute_name] = {"nodes": nodes, "values": values}
|
result.append(
|
||||||
|
{
|
||||||
|
"attribute": attribute_name,
|
||||||
|
"nodes": nodes,
|
||||||
|
"values": values
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
@ -350,11 +361,11 @@ class ValidateRenderSettings(pyblish.api.InstancePlugin):
|
||||||
"{aov_separator}", instance.data.get("aovSeparator", "_")
|
"{aov_separator}", instance.data.get("aovSeparator", "_")
|
||||||
)
|
)
|
||||||
|
|
||||||
for attribute, data in cls.get_nodes(instance, renderer).items():
|
for data in cls.get_nodes(instance, renderer):
|
||||||
if not data["values"]:
|
if not data["values"]:
|
||||||
continue
|
continue
|
||||||
for node in data["nodes"]:
|
for node in data["nodes"]:
|
||||||
lib.set_attribute(attribute, data["values"][0], node)
|
lib.set_attribute(data["attribute"], data["values"][0], node)
|
||||||
|
|
||||||
with lib.renderlayer(layer_node):
|
with lib.renderlayer(layer_node):
|
||||||
default = lib.RENDER_ATTRS['default']
|
default = lib.RENDER_ATTRS['default']
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue