Skip to content

collect_output_node

CollectOutputSOPPath

Bases: HoudiniInstancePlugin

Collect the out node's SOP/COP Path value.

Source code in client/ayon_houdini/plugins/publish/collect_output_node.py
 6
 7
 8
 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
67
68
69
70
71
72
73
74
75
76
77
78
class CollectOutputSOPPath(plugin.HoudiniInstancePlugin):
    """Collect the out node's SOP/COP Path value."""

    order = pyblish.api.CollectorOrder - 0.45
    families = [
        "pointcache",
        "camera",
        "vdbcache",
        "imagesequence",
        "redshiftproxy",
        "staticMesh",
        "model",
        "usdrender",
        "usdrop"
    ]

    label = "Collect Output Node Path"

    def process(self, instance):

        import hou

        node = hou.node(instance.data["instance_node"])

        # Get sop path
        node_type = node.type().name()
        if node_type == "geometry":
            out_node = node.parm("soppath").evalAsNode()

        elif node_type == "alembic":

            # Alembic can switch between using SOP Path or object
            if node.parm("use_sop_path").eval():
                out_node = node.parm("sop_path").evalAsNode()
            else:
                root = node.parm("root").eval()
                objects = node.parm("objects").eval()
                path = root + "/" + objects
                out_node = hou.node(path)

        elif node_type == "comp":
            out_node = node.parm("coppath").evalAsNode()

        elif node_type == "usd" or node_type == "usdrender":
            out_node = node.parm("loppath").evalAsNode()

        elif node_type == "usd_rop" or node_type == "usdrender_rop":
            # Inside Solaris e.g. /stage (not in ROP context)
            # When incoming connection is present it takes it directly
            inputs = node.inputs()
            if inputs:
                out_node = inputs[0]
            else:
                out_node = node.parm("loppath").evalAsNode()

        elif node_type == "Redshift_Proxy_Output":
            out_node = node.parm("RS_archive_sopPath").evalAsNode()

        elif node_type == "filmboxfbx":
            out_node = node.parm("startnode").evalAsNode()

        else:
            raise KnownPublishError(
                f"ROP node type '{node_type}' is not supported"
                f" for product type '{instance.data['product_type']}'"
            )

        if not out_node:
            self.log.warning("No output node collected.")
            return

        self.log.debug("Output node: %s" % out_node.path())
        instance.data["output_node"] = out_node