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!
Trying to find something useful to you while we are awaiting toolkit experts to get a hand on this. Check this out here: https://support.shotgunsoftware.com/hc/en-us/articles/219032818-Maya 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
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.
Hey there jonase,
You can check the loaded plugins with the command: