Distributing individual files

If your Maya add-on consists of a single file, such as a single plug-in, a single script file or a single icon, then it generally makes sense to simply distribute the file itself, possibly in compressed format, and have the end user copy it into the appropriate directory.

For example, if a user wishes to install a plug-in, written in either C++ or Python, they can do so simply by copying the plug-in file to one of the directories in their MAYA_PLUG_IN_PATH environment variable.

At sites where multiple users may need to use the same plug-in, it is often preferable to install it in a common directory to which all users have access, such as a directory on a network drive, rather than have each user install it separately. This makes it much easier for the site administrator to apply any new versions of the file which might later be released.

For a common directory to work for all users, it must appear in the MAYA_PLUG_IN_PATH for all users. By default, MAYA_PLUG_IN_PATH contains both user-specific and system-wide directories. The system-wide directories can be further subdivided into those whose paths are fixed and those whose paths are relative to the location where Maya is installed. For example, Maya 2017 on Linux has the following system-wide directories in its MAYA_PLUG_IN_PATH:

The first two paths are the same regardless of where Maya is installed, but the third path contains /usr/autodesk/maya/2017 which is the top of the directory tree where Maya is installed. Had Maya been installed in /opt/maya2017 then the first two paths would still be the same as shown above but the third would become:

This suggests several approaches to making the plug-in available to all users:

  1. Install Maya into a common directory to which all users have access, such as a network drive, then install the plug-in into the MAYA_PLUG_IN_PATH directory which is relative to where Maya is installed (for example, the third path in the list given above).
  2. On each user's system, map one of the fixed system-wide paths from MAYA_PLUG_IN_PATH (for example, either of the first two paths in the list given above) to a common directory to which all users have access, such as a network drive, then install the plug-in to that directory. For this approach, it does not matter whether Maya is installed in a common location or separately on each user's machine.
  3. Ignore the default directories provided in MAYA_PLUG_IN_PATH. Instead, install the plug-in into a common directory to which all users have access and explicitly add that directory to the MAYA_PLUG_IN_PATH for all users. This can be done either by modifying each user's Maya.env file or by using system-specific tools to ensure that the MAYA_PLUG_IN_PATH for all users contain the common directory before Maya is run.

These same approaches will also work with MEL or Python script files, except that instead of using MAYA_PLUG_IN_PATH scripts must be installed into a directory in the user's MAYA_SCRIPT_PATH environment variable. Similarly, icons must be installed into a directory in the user's XBMLANGPATH environment variable and presets must be installed into a directory in the user's MAYA_PRESET_PATH.

TIP:To summarize, the four environment variables described above are:
  • MAYA_PLUG_IN_PATH - directories to search for plug-ins
  • MAYA_SCRIPT_PATH - directories to search for MEL and Python scripts
  • XBMLANGPATH - directories to search for icons
  • MAYA_PRESET_PATH - directories to search for Maya presets

To see what directories each environment variable is set to, use the getenv command in the Maya Script Editor or Maya command line as follows:

getenv MAYA_PLUG_IN_PATH

You can also set an environment variable to a directory of your choice. To do so, you must create a Maya.env file.

For more information about the Maya.env file, including the location to which it should be saved on each platform, see Setting environment variables using Maya.env.

Related topics