Skip to content

pre_load_repres

PassRepresentationsHook

Bases: PreLaunchHook

Pre-hook for openrv.

Source code in client/ayon_openrv/hooks/pre_load_repres.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class PassRepresentationsHook(PreLaunchHook):
    """Pre-hook for openrv."""
    app_groups = ["openrv"]

    def execute(self):
        representation_ids = self.data.get("representation_ids")
        if not representation_ids:
            return

        payload = {"representation_ids": representation_ids}
        with tempfile.NamedTemporaryFile(mode="w+", delete=False) as file:
            json.dump(payload, file)
            metadata_path = file.name

        self.launch_context.env["AYON_LOADER_REPRESENTATIONS"] = metadata_path