Distributing Maya plugins


I will discuss various ways you can ship a Maya plugin to users.

Note that ultimately the methods I present below can be automated and wrapped with scripts or installers (.msi etc.) You can see my git repository to get a template project that demonstrate how to generate a windows installer for Maya plugin with CMake and CPack.

A plugin usually contains:

You need to gather all those files and tell Maya where to find them. To this end you will need to define the following Maya environment variables:

MAYA_SHELF_PATH=C:\installation_folder\prefs\shelves // <- Must be defined first
PYTHONPATH=C:\installation_folder\scripts 
MAYA_SCRIPT_PATH=C:\installation_folder\scripts 
MAYA_PLUG_IN_PATH=C:\installation_folder\plug-ins 
XBMLANGPATH=C:\installation_folder\prefs\icons 

Defining those variables can be done as follows:

Each method as its pros and cons which I will detail below. Personally my preference goes to the Application Plugin method which I find the most robust. This is also the official method to provide plugins through the autodesk app store (see also developer guidelines). Finally this is the method I use in my template project demonstrating how to ship a Maya plugin with CMake/CPack.

Using system environment variable

Directly edit the user's system environment variable with a bat script to add the needed variables (MAYA_SHELF_PATH etc.)

Pros

Cons

I don't recommend at all...

Using Maya.env

You directly add a file Maya.env in  C:\Users\name\Documents\maya\version\ . Pros and cons are almost identical to the above method.

Pros

Cons

If you're testing out your plugin on your local machine it's a good solution, but I don't recommend for shipping.

Using a custom shortcut

Start Maya with a special script that loads the correct environment variables! You can also have a shortcut linking to %COMSPEC% /C start /d Contents\ launch.bat 2018 in order to launch your script. 

Pros

Cons


Using the module file

Just add a .mod file in the user directory C:\Users\name\Documents\maya\version\modules\. See the Maya documentation to understand this file format. The shelves won't load you will need to include a userSetup.py in your script folder (PYTHONPATH)

 Pros

Cons

Using Application plugin

Almost the same as the module version but it is the official way to distribute plugins on the Autodesk app store. Plus you can specify a custom mel script to be launched at startup.

Add a PackageContents.xml file in C:\ProgramData\Autodesk\ApplicationPlugins\plugin_name\. The mel script "plugin_name"_load.mel will be automatically executed at startup.

 Pros

Cons

This my favorite option.

References

Application plugin
Modules (1)
Modules (2)

No comments

All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.
Spam bot question: