Skip to content

extract_max_scene_raw

ExtractMaxSceneRaw

Bases: Extractor, OptionalPyblishPluginMixin

Extract Raw Max Scene with SaveSelected

Source code in client/ayon_max/plugins/publish/extract_max_scene_raw.py
 7
 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
47
48
49
class ExtractMaxSceneRaw(publish.Extractor, OptionalPyblishPluginMixin):
    """
    Extract Raw Max Scene with SaveSelected
    """

    order = pyblish.api.ExtractorOrder - 0.2
    label = "Extract Max Scene (Raw)"
    hosts = ["max"]
    families = ["camera", "maxScene", "model"]
    optional = True

    settings_category = "max"

    def process(self, instance):
        if not self.is_active(instance.data):
            return

        # publish the raw scene for camera
        self.log.debug("Extracting Raw Max Scene ...")

        stagingdir = self.staging_dir(instance)
        filename = "{name}.max".format(**instance.data)

        max_path = os.path.join(stagingdir, filename)

        if "representations" not in instance.data:
            instance.data["representations"] = []

        nodes = instance.data["members"]
        rt.saveNodes(nodes, max_path, quiet=True)

        self.log.info("Performing Extraction ...")

        representation = {
            "name": "max",
            "ext": "max",
            "files": filename,
            "stagingDir": stagingdir,
        }
        instance.data["representations"].append(representation)
        self.log.info(
            "Extracted instance '%s' to: %s" % (instance.name, max_path)
        )