Skip to content

injected_python

Pre-launch hook to inject python environment.

InjectPythonPath

Bases: PreLaunchHook

Inject AYON environment to 3dsmax.

Note that this works in combination whit 3dsmax startup script that is translating it back to PYTHONPATH for cases when 3dsmax drops PYTHONPATH environment.

Hook GlobalHostDataHook must be executed before this hook.

Source code in client/ayon_motionbuilder/hooks/injected_python.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
class InjectPythonPath(PreLaunchHook):
    """Inject AYON environment to 3dsmax.

    Note that this works in combination whit 3dsmax startup script that
    is translating it back to PYTHONPATH for cases when 3dsmax drops PYTHONPATH
    environment.

    Hook `GlobalHostDataHook` must be executed before this hook.
    """
    app_groups = {"motionbuilder"}
    launch_types = {LaunchTypes.local}

    def execute(self):
        self.launch_context.env["MOTIONBUILDER_PYTHON_STARTUP"] = (
            os.environ["PYTHONPATH"]
        )