Skip to content

load_pointcloud

PointCloudLoader

Bases: LoaderPlugin

Point Cloud Loader.

Source code in client/ayon_max/plugins/load/load_pointcloud.py
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
class PointCloudLoader(load.LoaderPlugin):
    """Point Cloud Loader."""

    product_types = {"pointcloud"}
    representations = {"prt"}
    order = -8
    icon = "code-fork"
    color = "green"
    postfix = "param"

    def load(self, context, name=None, namespace=None, data=None):
        """load point cloud by tyCache"""
        from pymxs import runtime as rt
        filepath = os.path.normpath(self.filepath_from_context(context))
        obj = rt.tyCache()
        obj.filename = filepath

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

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

    def update(self, container, context):
        """update the container"""
        from pymxs import runtime as rt

        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)
        update_custom_attribute_data(
            node, node_list)
        with maintained_selection():
            rt.Select(node_list)
            for prt in rt.Selection:
                prt.filename = 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):
        """remove the container"""
        from pymxs import runtime as rt
        node = rt.GetNodeByName(container["instance_node"])
        remove_container_data(node)

load(context, name=None, namespace=None, data=None)

load point cloud by tyCache

Source code in client/ayon_max/plugins/load/load_pointcloud.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def load(self, context, name=None, namespace=None, data=None):
    """load point cloud by tyCache"""
    from pymxs import runtime as rt
    filepath = os.path.normpath(self.filepath_from_context(context))
    obj = rt.tyCache()
    obj.filename = filepath

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

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

remove(container)

remove the container

Source code in client/ayon_max/plugins/load/load_pointcloud.py
67
68
69
70
71
def remove(self, container):
    """remove the container"""
    from pymxs import runtime as rt
    node = rt.GetNodeByName(container["instance_node"])
    remove_container_data(node)

update(container, context)

update the container

Source code in client/ayon_max/plugins/load/load_pointcloud.py
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
def update(self, container, context):
    """update the container"""
    from pymxs import runtime as rt

    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)
    update_custom_attribute_data(
        node, node_list)
    with maintained_selection():
        rt.Select(node_list)
        for prt in rt.Selection:
            prt.filename = path

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