Skip to content

Commit

Permalink
Merge branch 'refs/heads/bugfix/preserve_launch_context_env' into bug…
Browse files Browse the repository at this point in the history
…fix/refactor_settings_fix_31

# Conflicts:
#	client/ayon_usd/hooks/pre_resolver_init.py
#	client/ayon_usd/utils.py
  • Loading branch information
BigRoy committed Aug 31, 2024
2 parents c733417 + 22af843 commit c5c0ef5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
11 changes: 5 additions & 6 deletions client/ayon_usd/hooks/pre_resolver_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ def _setup_resolver(self, local_resolver, settings):
self.log.info(
f"Initializing USD asset resolver for application: {self.app_name}"
)
env_var_dict = utils.get_resolver_setup_info(
local_resolver, settings, self.app_name, self.log
)

for key in env_var_dict:
value = env_var_dict[key]
self.launch_context.env[key] = value
updated_env = utils.get_resolver_setup_info(
local_resolver, settings, self.app_name, self.log,
env=self.launch_context.env
)
self.launch_context.env.update(updated_env)

def execute(self):
"""Pre-launch hook entry method."""
Expand Down
16 changes: 13 additions & 3 deletions client/ayon_usd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,19 @@ def get_resolver_to_download(settings, app_name: str) -> str:

def get_resolver_setup_info(
resolver_dir,
settings: dict,
env: dict = None) -> dict:

settings,
env=None) -> dict:
"""Get the environment variables to load AYON USD setup.
Arguments:
resolver_dir (str): Directory of the resolver.
settings (dict[str, Any]): Studio settings.
env (dict[str, str]): Source environment to build on.
Returns:
dict[str, str]: The environment needed to load AYON USD correctly.
"""

resolver_root = pathlib.Path(resolver_dir) / "ayonUsdResolver"
resolver_plugin_info_path = resolver_root / "resources" / "plugInfo.json"
resolver_ld_path = resolver_root / "lib"
Expand Down

0 comments on commit c5c0ef5

Please sign in to comment.