Distributing Multi-File Modules
 
 
 

All but the simplest of Maya add-ons involve more than one file. For example, a fully implemented render utility node will have at least three files:

Each of these files must go into a different directory on the target system. Even with just three files, having the user or site-administrator install them separately, by hand, can be an unwanted burden, and that burden will only grow with the number of files involved, as will opportunities for mistakes.

To simplify multi-file distribution, Maya provides the ability to package them into modules.

A module consists of a root directory which contains the following sub-directories:

plus a module description file, which contains a single line of text with four fields, separate by blanks:

For example, if version 1.3 of myModule is installed in /opt/MyCompany/myModule, then the module file would contain the following line of text.

+ myModule 1.3 /opt/MyCompany/myModule

When creating the module you place your icons in the icons sudirectory, your C++ and Python plug-ins in the plug-ins subdirectory, your presets in the presets subdirectory (same structure as Maya's presets directory) and your MEL and Python scripts in the scripts subdirectory.

In the module's root directory, place a copy of the module description file with the fourth field set to a suggested path. Distribution simply involves providing the user with a copy of the directory tree, possibly in compressed form.

Individual users wishing to install the module would do the following:

  1. Uncompress the distribution, if necessary.
  2. Move or copy the module's entire directory tree to wherever they want to keep it.
  3. Change the fourth field of the module description file to contain the full path to the module's directory tree.
  4. Place a copy of the modified module description file into one of the directories in their MAYA_MODULE_PATH environment variable.

Site administrators wishing to install a common copy of the module for multiple users would follow a similar set of steps:

  1. Uncompress the distribution, if necessary.
  2. Move or copy the module's entire directory tree to a directory which is accessible to all users, such as a network drive.
  3. Change the fourth field of the module description file to contain the full path to the module's directory tree.
  4. Place a copy of the modified module description file into a common directory which all users have in their MAYA_MODULE_PATH environment variables.

There are three approaches to doing this which are identical to those discussed for the MAYA_PLUG_IN_PATH variable in Distributing individual files. When Maya starts up, it will read in the module description file and add the module's icons directory to its XBMLANGPATH, add the module's plug-ins directory to its MAYA_PLUG_IN_PATH, add the module's presets directory to its MAYA_PRESET_PATH and add the module's scripts directory to its MAYA_SCRIPT_PATH and PYTHON_PATH.