Skip to content

validate_alembic_input_node

ValidateAlembicInputNode

Bases: HoudiniInstancePlugin

Validate that the node connected to the output is correct.

The connected node cannot be of the following types for Alembic
  • VDB
  • Volume
Source code in client/ayon_houdini/plugins/publish/validate_alembic_input_node.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
class ValidateAlembicInputNode(plugin.HoudiniInstancePlugin):
    """Validate that the node connected to the output is correct.

    The connected node cannot be of the following types for Alembic:
        - VDB
        - Volume

    """

    order = pyblish.api.ValidatorOrder + 0.1
    families = ["abc"]
    label = "Validate Input Node (Abc)"

    def process(self, instance):
        invalid = self.get_invalid(instance)
        if invalid:
            raise PublishValidationError(
                ("Primitive types found that are not supported "
                 "for Alembic output."),
                title=self.label
            )

    @classmethod
    def get_invalid(cls, instance):

        invalid_prim_types = ["VDB", "Volume"]
        output_node = instance.data.get("output_node")

        if output_node is None:
            node = hou.node(instance.data["instance_node"])
            cls.log.error(
                "SOP Output node in '%s' does not exist. "
                "Ensure a valid SOP output path is set." % node.path()
            )

            return [node]

        if not hasattr(output_node, "geometry"):
            # In the case someone has explicitly set an Object
            # node instead of a SOP node in Geometry context
            # then for now we ignore - this allows us to also
            # export object transforms.
            cls.log.warning("No geometry output node found, skipping check..")
            return

        frame = instance.data.get("frameStart", 0)
        geo = output_node.geometryAtFrame(frame)

        invalid = False
        for prim_type in invalid_prim_types:
            if geo.countPrimType(prim_type) > 0:
                cls.log.error(
                    "Found a primitive which is of type '%s' !" % prim_type
                )
                invalid = True

        if invalid:
            return [output_node]