Bases: HoudiniInstancePlugin
Validate the Instance has no current cooking errors.
Source code in client/ayon_houdini/plugins/publish/validate_no_errors.py
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77 | class ValidateNoErrors(plugin.HoudiniInstancePlugin):
"""Validate the Instance has no current cooking errors."""
order = pyblish.api.ValidatorOrder
label = "Validate no errors"
def process(self, instance):
if not instance.data.get("instance_node"):
self.log.debug(
"Skipping 'Validate no errors' because instance "
"has no instance node: {}".format(instance)
)
return
validate_nodes = []
if len(instance) > 0:
validate_nodes.append(hou.node(instance.data.get("instance_node")))
output_node = instance.data.get("output_node")
if output_node:
validate_nodes.append(output_node)
for node in validate_nodes:
self.log.debug("Validating for errors: %s" % node.path())
errors = get_errors(node)
if errors:
# If there are current errors, then try an unforced cook
# to see whether the error will disappear.
self.log.debug(
"Recooking to revalidate error "
"is up to date for: %s" % node.path()
)
current_frame = hou.intFrame()
start = instance.data.get("frameStart", current_frame)
end = instance.data.get("frameEnd", current_frame)
cook_in_range(node, start=start, end=end)
# Check for errors again after the forced recook
errors = get_errors(node)
if errors:
self.log.error(errors)
raise PublishValidationError(
"Node has errors: {}".format(node.path()),
title=self.label)
|