nuke validate backdrop with help

This commit is contained in:
Jakub Jezek 2022-05-25 17:46:35 +02:00
parent dd6c41d30f
commit 397ecb529e
No known key found for this signature in database
GPG key ID: 730D7C02726179A7
2 changed files with 52 additions and 3 deletions

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<error id="multiple_outputs">
<title>Found multiple outputs</title>
<description>
## Invalid output amount
Backdrop is having more than one outgoing connections.
### How to repair?
1. Use button `Center node in node graph` and navigate to the backdrop.
2. Reorganize nodes the way only one outgoing connection is present.
3. Hit reload button on the publisher.
</description>
<detail>
### How could this happen?
More than one node, which are found above the backdrop, are linked downstream or more output connections from a node also linked downstream.
</detail>
</error>
<error id="no_nodes">
<title>Empty backdrop</title>
<description>
## Invalid empty backdrop
Backdrop is empty and no nodes are found above it.
### How to repair?
1. Use button `Center node in node graph` and navigate to the backdrop.
2. Add any node above it or delete it.
3. Hit reload button on the publisher.
</description>
</error>
</root>

View file

@ -1,6 +1,7 @@
import nuke
import pyblish
from openpype.hosts.nuke.api.lib import maintained_selection
from openpype.pipeline import PublishXmlValidationError
class SelectCenterInNodeGraph(pyblish.api.Action):
@ -63,8 +64,20 @@ class ValidateBackdrop(pyblish.api.InstancePlugin):
msg_multiple_outputs = (
"Only one outcoming connection from "
"\"{}\" is allowed").format(instance.data["name"])
assert len(connections_out.keys()) <= 1, msg_multiple_outputs
msg_no_content = "No content on backdrop node: \"{}\"".format(
if len(connections_out.keys()) > 1:
raise PublishXmlValidationError(
self,
msg_multiple_outputs,
"multiple_outputs"
)
msg_no_nodes = "No content on backdrop node: \"{}\"".format(
instance.data["name"])
assert len(instance) > 1, msg_no_content
if len(instance) == 0:
raise PublishXmlValidationError(
self,
msg_no_nodes,
"no_nodes"
)