As a TD, part of your job is to be able to create and distribute tools to the artists on your team. Sometimes, those artists may not be as tech-savvy as your average TD, and so part of the challenge is coming up with an easy way to distribute scripts and keep those scripts updated as you make changes to them.
Enter the magical ancient world of Maya’s module workflow.
In short, Maya’s module system allows scripts to be held in folders outside of the \user\maya\scripts folder. The magic of that is that you can thus put those scripts in a folder that’s shared over a network or cloud drive, which would allow for everyone on the team to be on the same page.
Here’s what you need to do:
Say you have a python script in the directory D:\sharedFolder\myScript.py
What you need to do is create a folder above that that will hold the entire module.
Then, you need to create a folder in there called “scripts” just like maya’s “scripts” folder and put in it all of the scripts you want to have shared. You could also do the same with plug-ins, icons, prefs… It’s essentially mirrors the \user\maya directory structure.
So! now you have D:\sharedFolder\myModule\scripts\myScript.py
And you’re almost set! Now what you need to do is in your \user\maya\modules folder, you need to create a type of file called a .mod file. This file will be used by maya to link the folder on our desktop to your maya’s path.
Just to get you started, the most basic syntax for a mod file is:
+ [module name] [version number] [full path to module folder]
+ myModule 1.0 D:\sharedFolder\myModule
Now, if you restart Maya and try to import myScript, everything should work as expected.
This kind of workflow, however, isn’t very animator friendly. That’s why I created a much quicker install method for installing a module.
- Download the module or add the shared folder to you shared drive.
- Drag a script called “drag_into_maya.py” into Maya and simply browse to confirm the module file’s location.
- Restart Maya and you’re done.
All I’m doing in that “drag_into_maya” python file is opening up a file dialog at the location of that python file, which should already be in the module package. I then write a .mod file into the “userAppDir” path ‘s module folder.
That’s it! Once you start looking into this, you’ll realize tools like the BCS and SHAPES are already being distributed via modules. I never really thought twice about modules before but this is honestly a game changer for my workflow. Thanks Rik, my coworker on a freelance project I’m on right now, for introducing me to this 🙂