Distributing Maya plugins

Here I discuss various ways you can ship a Maya plugin to end users. 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

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



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.



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. 



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)



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.



This my favorite option.


Application plugin
Modules (1)
Modules (2)

One comment

Is there a good way to automatically run python code as Maya starts with the Custom Shortcut approach? As far as I can tell it won’t run code in a userSetup.py file which resides in the PYTHONPATH location defined via the shortcut?

Rod: I’ll have to test it but I don’t see why the shortcut method would not launch userSetup.py. In case it doesn’t you can always tell maya to execute mel commands when executing: maya.exe -command “some mel commands”. If you incorporate this method in the shortcut method it should work.

KG - 25/09/2020 -- 11:59
(optional field, I won't disclose or spam but it's necessary to notify you if I respond to your comment)
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.
Anti-spam question: