mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 08:54:53 +01:00
Fix VDB validation
This commit is contained in:
parent
d9c67a0bd5
commit
e2e03346fa
3 changed files with 13 additions and 66 deletions
|
|
@ -1,52 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import pyblish.api
|
||||
from openpype.pipeline import (
|
||||
PublishValidationError
|
||||
)
|
||||
|
||||
|
||||
class ValidateVDBInputNode(pyblish.api.InstancePlugin):
|
||||
"""Validate that the node connected to the output node is of type VDB.
|
||||
|
||||
Regardless of the amount of VDBs create the output will need to have an
|
||||
equal amount of VDBs, points, primitives and vertices
|
||||
|
||||
A VDB is an inherited type of Prim, holds the following data:
|
||||
- Primitives: 1
|
||||
- Points: 1
|
||||
- Vertices: 1
|
||||
- VDBs: 1
|
||||
|
||||
"""
|
||||
|
||||
order = pyblish.api.ValidatorOrder + 0.1
|
||||
families = ["vdbcache"]
|
||||
hosts = ["houdini"]
|
||||
label = "Validate Input Node (VDB)"
|
||||
|
||||
def process(self, instance):
|
||||
invalid = self.get_invalid(instance)
|
||||
if invalid:
|
||||
raise PublishValidationError(
|
||||
self,
|
||||
"Node connected to the output node is not of type VDB",
|
||||
title=self.label
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def get_invalid(cls, instance):
|
||||
|
||||
node = instance.data["output_node"]
|
||||
|
||||
prims = node.geometry().prims()
|
||||
nr_of_prims = len(prims)
|
||||
|
||||
nr_of_points = len(node.geometry().points())
|
||||
if nr_of_points != nr_of_prims:
|
||||
cls.log.error("The number of primitives and points do not match")
|
||||
return [instance]
|
||||
|
||||
for prim in prims:
|
||||
if prim.numVertices() != 1:
|
||||
cls.log.error("Found primitive with more than 1 vertex!")
|
||||
return [instance]
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import pyblish.api
|
||||
import hou
|
||||
from openpype.pipeline import PublishValidationError
|
||||
import clique
|
||||
from openpype.pipeline import PublishXmlValidationError
|
||||
|
||||
|
||||
class ValidateVDBOutputNode(pyblish.api.InstancePlugin):
|
||||
|
|
@ -27,9 +26,9 @@ class ValidateVDBOutputNode(pyblish.api.InstancePlugin):
|
|||
def process(self, instance):
|
||||
invalid = self.get_invalid(instance)
|
||||
if invalid:
|
||||
raise PublishValidationError(
|
||||
"Node connected to the output node is not" " of type VDB!",
|
||||
title=self.label
|
||||
raise PublishXmlValidationError(
|
||||
self,
|
||||
"Node connected to the output node is not" " of type VDB!"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
|
@ -62,16 +61,16 @@ class ValidateVDBOutputNode(pyblish.api.InstancePlugin):
|
|||
if not isinstance(prim, hou.VDB):
|
||||
invalid_prims.append(prim)
|
||||
if invalid_prims:
|
||||
# Log all invalid primitives in a short readable way, like 0-5
|
||||
collections, remainder = clique.assemble(
|
||||
str(prim.number()) for prim in invalid_prims
|
||||
# TODO Log all invalid primitives in a short readable way, like 0-5
|
||||
# This logging can be really slow for many primitives, say 20000+
|
||||
# which might be fixed by logging only consecutive ranges
|
||||
cls.log.error(
|
||||
"Found non-VDB primitives for '{}', "
|
||||
"primitive indices: {}".format(
|
||||
node.path(),
|
||||
", ".join(prim.number() for prim in invalid_prims)
|
||||
)
|
||||
)
|
||||
collection = collections[0]
|
||||
cls.log.error("Found non-VDB primitives for '{}', "
|
||||
"primitive indices: {}".format(
|
||||
node.path(),
|
||||
collection.format("{ranges}")
|
||||
))
|
||||
return [instance]
|
||||
|
||||
nr_of_points = len(geometry.points())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue