Take control over before_app_launch.py hook

Hey everyone,
I want to take control over the before_app_launch hook for maya.
Here’s what i did:

In the tk-multi-launchapp.yml i added:

settings.tk-multi-launchapp.maya:
…engine: tk-maya
…hook_before_app_launch: “{config}/maya/before_app_launch.py”
…windows_path: “@path.windows.maya
…location: “@apps.tk-multi-launchapp.location

I then created the maya folder in the hooks folder and added my before_app_launch.py into it

The next step would be to tell tk-desktop to use this new setting, so i added the following line
to the project settings in tk-desktop.yml:

tk-multi-launchmaya: “@settings.tk-multi-launchapp.maya

The default config does the same with mari, so i figured that would be the best way.
But where do I tell Shotung to use tk-multi-launchmaya instead of tk-multi-launchapp. I couldn’t find an corresponding setting for the mari example in the whole default-config, so I’m a bit confused. I dont think SG would automatically find this setting so i guess it must be linked somewhere.

Can somebody help me with this?
Every help would be appreciated

Jonas

2 Likes

Hi @jonase

I just wanted to check, are you intentionally not wanting to use the Software entities for launching your software?

It’s just that you can add a generic hook to the default settings and then in the hook check if engine == "tk-maya:... (or you could inspect the passed software_entity,) before doing anything specific to Maya.

Best
Phil

2 Likes

Thanks Philip!
I am currently porting our config from default-config to default-config2 and the old one uses the before_app_launch.py to load additional plugins to maya.

So i’m not really doing this intentionally but for the sake of keeping the old hook as it was.
Do you reccomend switching the way we are doing this and if so could you please be a bit more specific about how to add the generic hook to the settings so that it gets executed before the app launches?

EDIT: Do you mean taking control over the generic before_app_launch.py and then in that check if the engine is maya? If thats the case i understand what you mean and my question would be irrelevant

Jonas

3 Likes

Yes that is what I mean.

2 Likes