Can anyone tell me how I would go about loading plugins on maya launch. I want to get the mayafbx plugin loading by default when a user launches maya. Thanks!
Hi, @jkiser,
Trying to find something useful to you while we are awaiting toolkit experts to get a hand on this. Check this out here:Maya - SG Developer and see if it helps you or not.
Hi! One way to do this would be to add an engine_init hook to your configuration and add some code in there to check and load the plugin - just copy this hook into your config core hooks folder: https://github.com/shotgunsoftware/tk-core/blob/master/hooks/engine_init.py
Keep in mind that this will potentially be called multiple times, if the toolkit maya engine restarts.
What we are doing here is checking, and eventually load the maya plugins based on the pipeline step.
We used the hook of the workfiles âscene_operation_tk-mayaâ and every time the user create a file, depending on the context we load the relevant plugins.
Hello all thank you so much for the help. Sorry it took so long to respond here. What I ended up doing was creating a maya setup tool that loads plugins sets scene units etc based on project configurations and I called that through the engine init hook.
I ran into a problem with the âloading pluginsâ logic which is in our case within the before_app_launch.py. I cannot find a proper way to find out which plugin has already been loaded into Maya.
This results in having multiple instances of the studio-library, which is very confusing.
Hereâs a short version of how this is working at the moment:
module_path = âPATH_TO_STUDIO-LIBâ
os.environ['MAYA_MODULE_PATH] = â;â.join(module_path)
My first idea was to find out if the studio-lib already exists in the MAYA_MODULE_PATH and to load it only when it does not:
module_paths = [path for path in os.environ.get(âMAYA_MODULE_PATHâ, â â).split(â;') if path]
if not module_path in module_paths:
. . . .os.environ['MAYA_MODULE_PATH] = â;â.join(module_path)
The only thing I found out doing this, was that the MAYA_MODULE_PATH is always empty when running the script, so this obviously doesnât work. Does anyone know a way of finding out which Module already exists in Maya so it doesnât get loaded multiple times?
thanks in advance
Jonas
I managed to find a workaround when I noticed, that all Modules get loaded into the .mel - Shelffiles inside prefs/shelves.
I read those files and search them for the Module I want to find. If itâs already inside one of the shelf files, I delete it from my MAYA_MODULE_PATH variable, so i doesnât get loaded again.
Cheers Jonas
Hey there jonase,
You can check the loaded plugins with the command: