Skip to content

startup_script

Pre-launch to force motion builder startup script.

ForceStartupScript

Bases: PreLaunchHook

Inject AYON environment to motion builder.

Note that this works in combination with motion builder startup script that is translating it back to PYTHONPATH for cases when motion builder drops PYTHONPATH environment.

Hook GlobalHostDataHook must be executed before this hook.

Source code in client/ayon_motionbuilder/hooks/startup_script.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class ForceStartupScript(PreLaunchHook):
    """Inject AYON environment to motion builder.

    Note that this works in combination with motion builder startup script that
    is translating it back to PYTHONPATH for cases when motion builder
    drops PYTHONPATH environment.

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

    def execute(self):
        startup_args = [
            "-suspendMessages",
            os.path.join(MOTION_BUILDER_ADDON_ROOT, "startup", "startup.py"),
        ]
        self.launch_context.launch_args.append(startup_args)