Skip to content

force_startup_script

Pre-launch to force 3ds max startup script.

ForceStartupScript

Bases: PreLaunchHook

Inject AYON environment to 3ds max.

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_max/hooks/force_startup_script.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class ForceStartupScript(PreLaunchHook):
    """Inject AYON environment to 3ds max.

    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 = {"3dsmax", "adsk_3dsmax"}
    order = 11
    launch_types = {LaunchTypes.local}

    def execute(self):
        startup_args = [
            "-U",
            "MAXScript",
            os.path.join(MAX_HOST_DIR, "startup", "startup.ms"),
        ]
        self.launch_context.launch_args.append(startup_args)