Add nice new report

This commit is contained in:
Roy Nieterau 2023-01-27 15:44:10 +01:00
parent d4a9e1cd3e
commit aae89c42e4
2 changed files with 41 additions and 3 deletions

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<error id="main">
<title>Missing node ids</title>
<description>## Nodes found with missing `cbId`
Nodes were detected in your scene which are missing required `cbId`
attributes for identification further in the pipeline.
### How to repair?
The node ids are auto-generated on scene save, and thus the easiest fix is to
save your scene again.
After that restart publishing with Reload button.
</description>
<detail>
### Invalid nodes
{nodes}
### How could this happen?
This often happens if you've generated new nodes but haven't saved your scene
after creating the new nodes.
</detail>
</error>
</root>

View file

@ -1,6 +1,9 @@
import pyblish.api
from openpype.pipeline.publish import ValidatePipelineOrder
from openpype.pipeline.publish import (
ValidatePipelineOrder,
PublishXmlValidationError
)
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib
@ -34,8 +37,14 @@ class ValidateNodeIDs(pyblish.api.InstancePlugin):
# Ensure all nodes have a cbId
invalid = self.get_invalid(instance)
if invalid:
raise RuntimeError("Nodes found without "
"IDs: {0}".format(invalid))
names = "\n".join(
"- {}".format(node) for node in invalid
)
raise PublishXmlValidationError(
plugin=self,
message="Nodes found without IDs: {}".format(invalid),
formatting_data={"nodes": names}
)
@classmethod
def get_invalid(cls, instance):