Skip to content

load_shot_lop

LOPLoadShotLoader

Bases: LoaderPlugin

Load sublayer into Solaris using AYON Load Shot LOP

Source code in client/ayon_houdini/plugins/load/load_shot_lop.py
 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
class LOPLoadShotLoader(load.LoaderPlugin):
    """Load sublayer into Solaris using AYON Load Shot LOP"""

    product_types = {"*"}
    label = "Load Shot (LOPs)"
    representations = ["usd", "abc", "usda", "usdc"]
    order = -10
    icon = "code-fork"
    color = "orange"

    def load(self, context, name=None, namespace=None, data=None):

        # Define node name
        namespace = namespace if namespace else context["folder"]["name"]
        node_name = "{}_{}".format(namespace, name) if namespace else name

        # Create node
        network = find_active_network(
            category=hou.lopNodeTypeCategory(),
            default="/stage"
        )
        node = network.createNode("ayon::load_shot", node_name=node_name)
        node.moveToGoodPosition()

        hda_utils.set_node_representation_from_context(node, context)

        nodes = [node]
        self[:] = nodes

    def update(self, container, context):
        node = container["node"]
        hda_utils.set_node_representation_from_context(node, context)

    def remove(self, container):
        node = container["node"]
        node.destroy()

    def switch(self, container, context):
        self.update(container, context)