Skip to content

create_copernicus

Creator plugin for creating composite sequences.

CreateCopernicusROP

Bases: HoudiniCreator

Copernicus ROP to Image Sequence

Source code in client/ayon_houdini/plugins/create/create_copernicus.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
class CreateCopernicusROP(plugin.HoudiniCreator):
    """Copernicus ROP to Image Sequence"""

    identifier = "io.ayon.creators.houdini.copernicus"
    label = "Composite (Copernicus)"
    description = "Render using the Copernicus Image ROP"
    product_type = "render"
    icon = "fa5.eye"

    ext = ".exr"

    # Copernicus was introduced in Houdini 20.5 so we only enable this
    # creator if the Houdini version is 20.5 or higher.
    enabled = hou.applicationVersion() >= (20, 5, 0)

    def create(self, product_name, instance_data, pre_create_data):
        instance_data["node_type"] = "image"

        instance = super().create(
            product_name,
            instance_data,
            pre_create_data)

        instance_node = hou.node(instance.get("instance_node"))
        filepath = "{}{}".format(
            hou.text.expandString("$HIP/pyblish/"),
            f"{product_name}.$F4{self.ext}"
        )
        parms = {
            "trange": 1,
            "copoutput": filepath
        }
        if self.selected_nodes:
            if len(self.selected_nodes) > 1:
                raise CreatorError("More than one item selected.")
            path = self.selected_nodes[0].path()
            parms["coppath"] = path

        instance_node.setParms(parms)

        # Manually set f1 & f2 to $FSTART and $FEND respectively
        # to match other Houdini nodes default.
        instance_node.parm("f1").setExpression("$FSTART")
        instance_node.parm("f2").setExpression("$FEND")

    def get_network_categories(self):
        return [
            hou.ropNodeTypeCategory(),
            hou.cop2NodeTypeCategory()
        ]

    def get_publish_families(self):
        return [
            "render",
            "image_rop",
        ]