I’d like to run some logic after the engine has started within Maya. Specifically I am wanting to check what department the current logged in user is under and then run some logic off of that.
I’ve got a user setup.py running that will import sgtk but I am not sure how I could query the user from there as the engine hasn’t launched by that point in the startup sequence.
Something like a Post App Launch Hook would be great but to my knowledge there’s only the before app launch hook?
If you are putting a lot of work into this functionality I would consider bundling it in a toolkit app so you have access to everything you need.
There are various places in the toolkit app where you can put logic depending on the state of things
When I started out and didn’t know about engine_init, I hacked engines to have an additional hook after_load which gets triggered in a specific place when the engine has been initialized.
I still think it might be a worthwhile addition - engine_init is a core hook, global for all engines.
Actually a really good point! More hooks never hurt. Had to check against engine name in engine_init and then do my imports within the function like a filthy casual.
For plugin packs and managing various sets of plugin environments per project I would highly recommend using a Package manager like CPENV (which is integrated with Toolkit).