mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Improve same named nodes error message.
This commit is contained in:
parent
b63b026870
commit
c2c963c703
1 changed files with 12 additions and 7 deletions
|
|
@ -24,7 +24,7 @@ class ValidateArnoldSceneSource(pyblish.api.InstancePlugin):
|
|||
ungrouped_nodes = []
|
||||
nodes_by_name = {}
|
||||
parents = []
|
||||
same_named_nodes = []
|
||||
same_named_nodes = {}
|
||||
for node in nodes:
|
||||
node_split = node.split("|")
|
||||
if len(node_split) == 2:
|
||||
|
|
@ -39,16 +39,21 @@ class ValidateArnoldSceneSource(pyblish.api.InstancePlugin):
|
|||
# Check for same same nodes, which can happen in different
|
||||
# hierarchies.
|
||||
if node_name in nodes_by_name:
|
||||
same_named_nodes.append((node, nodes_by_name[node_name]))
|
||||
try:
|
||||
same_named_nodes[node_name].append(node)
|
||||
except KeyError:
|
||||
same_named_nodes[node_name] = [
|
||||
nodes_by_name[node_name], node
|
||||
]
|
||||
|
||||
nodes_by_name[node_name] = node
|
||||
|
||||
if same_named_nodes:
|
||||
raise PublishValidationError(
|
||||
"Found nodes with the same name:\n{}".format(
|
||||
"\n".join(["{}".format(n) for n in same_named_nodes])
|
||||
)
|
||||
)
|
||||
message = "Found nodes with the same name:"
|
||||
for name, nodes in same_named_nodes.items():
|
||||
message += "\n\n\"{}\":\n{}".format(name, "\n".join(nodes))
|
||||
|
||||
raise PublishValidationError(message)
|
||||
|
||||
return ungrouped_nodes, nodes_by_name, parents
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue