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
29
30
31
32
33
34
35
36
37
38
39
40 | 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("AYON_USD_RESOLVER_PINNING_FILE") \
and not self.launch_context.env.get("PINNING_FILE_PATH"):
return
anatomy = self.data["anatomy"]
self.launch_context.env["AYON_USD_RESOLVER_PINNING_FILE"] = anatomy.fill_root(
self.launch_context.env.get("AYON_USD_RESOLVER_PINNING_FILE"),
)
# Backwards compatibility (deprecated)
self.launch_context.env["PINNING_FILE_PATH"] = anatomy.fill_root(
self.launch_context.env.get("PINNING_FILE_PATH"),
)
roots = anatomy.roots
pinning_roots = ",".join(
f"{key}={value}" for key, value in roots.items()
)
self.launch_context.env[
"AYON_USD_RESOLVER_PINNING_ROOTS"
] = pinning_roots
# Backwards compatibility (deprecated)
self.launch_context.env["PROJECT_ROOTS"] = pinning_roots
|
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
29
30
31
32
33
34
35
36
37
38
39
40 | def execute(self) -> None:
"""Set environments necessary for pinning."""
if not self.launch_context.env.get("AYON_USD_RESOLVER_PINNING_FILE") \
and not self.launch_context.env.get("PINNING_FILE_PATH"):
return
anatomy = self.data["anatomy"]
self.launch_context.env["AYON_USD_RESOLVER_PINNING_FILE"] = anatomy.fill_root(
self.launch_context.env.get("AYON_USD_RESOLVER_PINNING_FILE"),
)
# Backwards compatibility (deprecated)
self.launch_context.env["PINNING_FILE_PATH"] = anatomy.fill_root(
self.launch_context.env.get("PINNING_FILE_PATH"),
)
roots = anatomy.roots
pinning_roots = ",".join(
f"{key}={value}" for key, value in roots.items()
)
self.launch_context.env[
"AYON_USD_RESOLVER_PINNING_ROOTS"
] = pinning_roots
# Backwards compatibility (deprecated)
self.launch_context.env["PROJECT_ROOTS"] = pinning_roots
|