|
Because Maya’s Modules system is largely an undocumented feature, it would be nice to put info somewhere people can find it.
Modules allows you to easily define paths for external plug-ins, scripts, presets, and icons. They are especially useful in a production environment because they do not require users to modify their existing Maya.env files.
Here is the only documentation from Maya Help about Modules that I know of:
MAYA_MODULE_PATH
Defines the search paths for Maya module files. A module file describes the install location for certain Maya components, such as subdivision surfaces. Generally, you don’t need to set this variable. But, keep in mind that for each path extracted from the modules files, Maya appends the suffixes “plug-ins”, “presets”, “scripts”, and “icons”, and then adds the appended path to MAYA_PLUG_IN_PATH, MAYA_PRESET_PATH, MAYA_SCRIPT_PATH, and XBMLANGPATH, respectively.
The following table lists the default paths, which will always follow any path that you specify.
Default for Windows Default for Mac OS X, Linux
<user’s directory>/My Documents/maya/2009/modules
<user’s directory>/My Documents/maya/modules
C:/Program Files/Common Files/Autodesk Shared/Modules/maya/2009
C:/Program Files/Common Files/Autodesk Shared/Modules/maya
<maya_directory>/modules/
$MAYA_APP_DIR/maya/2009/modules
$MAYA_APP_DIR/maya/modules
/usr/autodesk/modules/maya/2009
/usr/autodesk/modules/maya
NoteIf you use spaces in a file path that you create, you may have problems accessing icon image files stored within that directory, because the file path does not appear in Maya. You can avoid this problem by only specifying file paths that do not include spaces.
Module files are text files that have the following syntax:
+ Module_Name Maya_Version_Number Module_Path
For example:
+ MyModule 2009-x64 C:\MyModule
There doesn’t appear to be any functions to query the path of a module. In BonusTools they use the mel command “whatIs” on one of their scripts and then parse the string to extract the module path like so:
string $btPath = `whatIs bonusToolsMenu`; //string $buffer[];
//subtract magic number of 24: "Mel procedure found in: " int $numCharacters = `size($btPath)`; $btPath = `endString $btPath ($numCharacters-24)`; //subtract magic number of 18: "scripts/bonusToolsMenu.mel" $numCharacters = `size($btPath)`; $btPath = `substring $btPath 1 ($numCharacters-27)`;
Shelves, unfortunately, do not appear to be supported. :(
If anyone knows of further documentation or corrections, please post here!
Autodesk - My Modules wishlist:
add this mel command: getModulePath(string $moduleName) to return path of given module.
add shelf support.
add support for userSetup.mel in module (or something similar: moduleSetup.mel)
|