ayon-core/openpype/hosts/max/hooks/set_paths.py
Jakub Trllo 3ae020f064
Applications: Launch hooks cleanup (#5395)
* ApplicationManager can have more granular way how applications are launched

* executable is optional to be able create ApplicationLaunchContext

* launch context can run prelaunch hooks without launching application

* 'get_app_environments_for_context' is using launch context to prepare environments

* added 'launch_type' as one of filtering options for LaunchHook

* added 'local' launch type filter to existing launch hooks

* define 'automated' launch type in remote publish function

* modified publish and extract environments cli commands

* launch types are only for local by default

* fix import

* fix launch types of global host data

* change order or kwargs

* change unreal filter attribute

* use set instead of list

* removed '__init__' from celaction hooks

* use 'CELACTION_ROOT_DIR' in pre setup

* use full import from applications
2023-08-03 12:24:23 +02:00

18 lines
518 B
Python

from openpype.lib.applications import PreLaunchHook, LaunchTypes
class SetPath(PreLaunchHook):
"""Set current dir to workdir.
Hook `GlobalHostDataHook` must be executed before this hook.
"""
app_groups = {"max"}
launch_types = {LaunchTypes.local}
def execute(self):
workdir = self.launch_context.env.get("AVALON_WORKDIR", "")
if not workdir:
self.log.warning("BUG: Workdir is not filled.")
return
self.launch_context.kwargs["cwd"] = workdir