Script Distribution using Maya Modules

 

 

 

Modules_Demo3.gif

Hi everyone!

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.

D:\sharedFolder\myModule\myScript.py

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]

for example:

+ 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.

  1. Download the module or add the shared folder to you shared drive.
  2. Drag a script called “drag_into_maya.py” into Maya and simply browse to confirm the module file’s location.
  3. 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 🙂

Ben

More resources

Advertisements
Image

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s