Skip to content

usd_pinning_root

Pre-launch hook to set USD pinning related environment variable.

UsdPinningRoot

Bases: PreLaunchHook

Pre-launch hook to set USD_ROOT environment variable.

Source code in client/ayon_usd/hooks/usd_pinning_root.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class UsdPinningRoot(PreLaunchHook):
    """Pre-launch hook to set USD_ROOT environment variable."""

    app_groups = {"maya", "houdini", "blender", "unreal"}
    # this should be set to farm_render, but this issue
    # https://github.com/ynput/ayon-applications/issues/2
    # stands in the way
    launch_types = {LaunchTypes.farm_publish}

    def execute(self) -> None:
        """Set environments necessary for pinning."""
        if not self.launch_context.env.get("PINNING_FILE_PATH"):
            return

        anatomy = self.data["anatomy"]
        self.launch_context.env["PINNING_FILE_PATH"] = anatomy.fill_root(
            self.launch_context.env.get("PINNING_FILE_PATH"),
        )

        roots = anatomy.roots()
        self.launch_context.env[
            "PROJECT_ROOTS"
        ] = ",".join(f"{key}={value}"
                     for key, value in roots.items())

execute()

Set environments necessary for pinning.

Source code in client/ayon_usd/hooks/usd_pinning_root.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def execute(self) -> None:
    """Set environments necessary for pinning."""
    if not self.launch_context.env.get("PINNING_FILE_PATH"):
        return

    anatomy = self.data["anatomy"]
    self.launch_context.env["PINNING_FILE_PATH"] = anatomy.fill_root(
        self.launch_context.env.get("PINNING_FILE_PATH"),
    )

    roots = anatomy.roots()
    self.launch_context.env[
        "PROJECT_ROOTS"
    ] = ",".join(f"{key}={value}"
                 for key, value in roots.items())