Skip to content

create_usd

Creator plugin for creating USDs.

CreateUSD

Bases: HoudiniCreator

Universal Scene Description

Source code in client/ayon_houdini/plugins/create/create_usd.py
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
79
80
81
82
83
84
85
86
87
88
89
class CreateUSD(plugin.HoudiniCreator):
    """Universal Scene Description"""
    identifier = "io.openpype.creators.houdini.usd"
    label = "USD"
    product_type = "usd"
    product_base_type = "usd"
    icon = "cubes"
    enabled = False
    description = "Create USD for generic use"

    # Default render target
    render_target = "local"

    additional_parameters = {}

    def create(self, product_name, instance_data, pre_create_data):

        instance_data.update({"node_type": "usd"})
        creator_attributes = instance_data.setdefault(
            "creator_attributes", dict())
        creator_attributes["render_target"] = pre_create_data["render_target"]

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

        instance_node = hou.node(instance.get("instance_node"))

        parms = {
            "enableoutputprocessor_simplerelativepaths": False,
        }
        parms.update(self.additional_parameters)

        if self.selected_nodes:
            parms["loppath"] = self.selected_nodes[0].path()

        instance_node.setParms(parms)

        # Lock any parameters in this list
        to_lock = [
            # Lock some AYON attributes
            "productType",
            "productBaseType",
            "id",
        ]
        self.lock_parameters(instance_node, to_lock)

    def set_node_staging_dir(
            self, node, staging_dir, instance, pre_create_data):
        node.parm("lopoutput").set(f"{staging_dir}/$OS.usd")

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

    def get_publish_families(self):
        return ["usd", "usdrop", "publish.hou"]

    def get_instance_attr_defs(self):
        render_target_items = {
            "local": "Local machine rendering",
            "local_no_render": "Use existing frames (local)",
            "farm": "Farm Rendering",
        }

        return [
            EnumDef("render_target",
                    items=render_target_items,
                    label="Render target",
                    default=self.render_target)
        ]

    def get_pre_create_attr_defs(self):
        attrs = super().get_pre_create_attr_defs()
        return attrs + self.get_instance_attr_defs()

CreateUSDLook

Bases: CreateUSD

Universal Scene Description Look

Source code in client/ayon_houdini/plugins/create/create_usd.py
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
class CreateUSDLook(CreateUSD):
    """Universal Scene Description Look"""

    identifier = "io.openpype.creators.houdini.usd.look"
    label = "USD Asset Look"
    product_type = "look"
    product_base_type = "look"
    icon = "paint-brush"
    enabled = True
    description = "Create USD Asset Look with localized textures"

    additional_parameters = {
        # Set the 'default prim' by default to the folder name being
        # published to
        "defaultprim": DEFAULT_PRIM_EXPRESSION,
    }

    def get_detail_description(self):
        return inspect.cleandoc("""Publish looks in USD data.

        From the Houdini Solaris context (LOPs) this will publish the look for
        an asset as a USD file with the used textures.

        Any assets used by the look will be relatively remapped to the USD
        file and integrated into the publish as `resources`.
        """)

    def get_publish_families(self):
        return ["usd", "look", "usdrop", "publish.hou"]