Skip to content

collect_ornatrix_cache

CollectOxCache

Bases: MayaInstancePlugin

Collect all information of the Ornatrix caches

Source code in client/ayon_maya/plugins/publish/collect_ornatrix_cache.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
class CollectOxCache(plugin.MayaInstancePlugin):
    """Collect all information of the Ornatrix caches"""

    order = pyblish.api.CollectorOrder + 0.45
    label = "Collect Ornatrix Cache"
    families = ["oxrig", "oxcache"]

    def process(self, instance):

        nodes = []
        ox_shapes = cmds.ls(instance[:], shapes=True)
        for ox_shape in ox_shapes:
            ox_shape_id = lib.get_id(ox_shape)
            if not ox_shape_id:
                continue
            ox_cache_nodes = cmds.listConnections(
                ox_shape, destination=True, type="HairFromGuidesNode") or []

            if not ox_cache_nodes:
                continue
            # transfer cache file
            if instance.data["productType"] == "oxcache":
                # strip the namespace
                namespace = get_namespace(ox_shape)
                ox_shape = strip_namespace(ox_shape, namespace)
                self.log.debug(ox_shape)
            nodes.append({
                "name": ox_shape,
                "cbId": ox_shape_id,
                "ox_nodes": ox_cache_nodes,
                "cache_file_attributes": ["{}.cacheFilePath".format(ox_node)
                                          for ox_node in ox_cache_nodes]
            })
        instance.data["cachesettings"] = {"nodes": nodes}
        self.log.debug(f"Found Ornatrix HairFromGuidesNodes: {nodes}")