Skip to content

load_redshift_proxy

RedshiftProxyLoader

Bases: LoaderPlugin

Load rs files with Redshift Proxy

Source code in client/ayon_max/plugins/load/load_redshift_proxy.py
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
class RedshiftProxyLoader(load.LoaderPlugin):
    """Load rs files with Redshift Proxy"""

    label = "Load Redshift Proxy"
    product_types = {"redshiftproxy"}
    representations = {"rs"}
    order = -9
    icon = "code-fork"
    color = "white"

    def load(self, context, name=None, namespace=None, data=None):
        plugin_info = get_plugins()
        if "redshift4max.dlr" not in plugin_info:
            raise LoadError("Redshift not loaded/installed in Max..")
        filepath = self.filepath_from_context(context)
        rs_obj = self._get_redshift_object_type()
        rs_obj.file = filepath

        namespace = unique_namespace(
            name + "_",
            suffix="_",
        )
        rs_obj.name = f"{namespace}:{rs_obj.name}"

        return containerise(
            name, [rs_obj], context,
            namespace, loader=self.__class__.__name__)

    def update(self, container, context):
        repre_entity = context["representation"]
        path = os.path.normpath(self.filepath_from_context(context))
        node = rt.getNodeByName(container["instance_node"])
        node_list = get_previous_loaded_object(node)
        rt.Select(node_list)
        update_custom_attribute_data(
            node, rt.Selection)
        for rs_obj in rt.Selection:
            rs_obj.file = path

        lib.imprint(container["instance_node"], {
            "representation": repre_entity["id"],
            "project_name": context["project"]["name"]
        })

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

    def remove(self, container):
        node = rt.GetNodeByName(container["instance_node"])
        remove_container_data(node)

    def _get_redshift_object_type(self):
        return rt.RedshiftProxy()

RedshiftVolumeLoader

Bases: RedshiftProxyLoader

Load vdb files with Redshift Volume Grid

Source code in client/ayon_max/plugins/load/load_redshift_proxy.py
75
76
77
78
79
80
81
82
83
84
85
86
class RedshiftVolumeLoader(RedshiftProxyLoader):
    """Load vdb files with Redshift Volume Grid"""

    label = "Load VDB"
    product_types = {"vdbcache"}
    representations = {"vdb"}
    order = -9
    icon = "code-fork"
    color = "orange"

    def _get_redshift_object_type(self):
        return rt.RedshiftVolumeGrid()