The Maya Development Kit product contains a number of example plug-ins located in /Applications/Autodesk/maya2013/devkit/plug-ins. Before you can use these plug-ins, you need to build them. The first step is to define the MAYA_LOCATION environment variable to point to the directory where Maya is installed. If your command-line shell is sh, bash or ksh then the commands would be as follows:
MAYA_LOCATION=/Applications/Autodesk/maya2013/Maya.app/Contents export MAYA_LOCATION
setenv MAYA_LOCATION /Applications/Autodesk/maya2013/Maya.app/Contents
mkdir -p $HOME/devkit/plug-ins cd $HOME/devkit/plug-ins cp -r /Applications/Autodesk/maya2013/devkit/plug-ins/* .
make Clean make
These variables can be defined in a file called Maya.env. Using Maya.env makes it easy set up the same runtime environment on another system by simply copying the file. You can still set explicit values for these variables on the commmand line and they will prepended to the values given in Maya.env.
Each C++ plug-in resides in its own subdirectory within $HOME/devkit/plug-ins while all of the Python plug-ins reside in a common subdirectory named scripted. You must add to the aforementioned environment variables the directories for all of the plug-ins you wish to access from Maya. For example, if you want to access the circleNode and whatisCmd C++ plug-ins from within Maya, then your Maya.env file should contain the following:
MAYA_PLUG_IN_PATH = $HOME/devkit/plug-ins/circleNode:$HOME/devkit/plug-ins/whatisCmd MAYA_SCRIPT_PATH = $HOME/devkit/plug-ins/circleNode:$HOME/devkit/plug-ins/whatisCmd XBMLANGPATH = $HOME/devkit/plug-ins/circleNode/%B:$HOME/devkit/plug-ins/whatisCmd/%B
If you now start Maya and open the Plug-in Manager window, you should see the circleNode and whatisCmd plug-ins each listed within its own section. This can get cumbersome if you want access to large number of plugins, in which case it makes sense to copy the various types of files into a set of common directories. For example, to access all of the devkit plug-ins from within Maya, you could do the following:
mkdir plug-ins scripts icons cp */*.bundle plug-ins cp */*.mel */*.py scripts cp */*.png */*.xpm */*.cur */*.rgb icons
MAYA_PLUG_IN_PATH = $HOME/devkit/plug-ins/plug-ins MAYA_SCRIPT_PATH = $HOME/devkit/plug-ins/scripts XBMLANGPATH = $HOME/devkit/plug-ins/icons/%B
The environment variable, MAYA_APP_DIR, can be used to help find the Maya.env file. If this variable is not set, Maya looks in your $HOME/Library/Preferences/Autodesk/maya directory. In addition, if you have multiple versions of Maya installed on your system, you can put your Maya.env file in a versioned subdirectory of either the directory pointed to by the MAYA_APP_DIR environment variable or $HOME/Library/Preferences/Autodesk/maya. For example, if you set MAYA_APP_DIR to be /usr/mydir, you can create a Maya.env file in the directory /usr/mydir/2013 that will only be used when the 2013 version of Maya is run. If you do not set MAYA_APP_DIR, you can put your 2013-specific Maya.env file in $HOME/Library/Preferences/Autodesk/maya/2013.
As an alternative to setting environment variables to point to the plug-in's files, you can instead copy the files into directories which Maya automatically adds to the variables when it starts up. The easiest way to see what those directories are is to use the getenv command from within Maya's Script Editor. E.g:
In order for Maya to find the plug-in you must set a number of environment variables to point to the directories containing its files. Continuing in our use of the circleNode plug-in as an example, you would put the following into your Maya.env file:
MAYA_PLUG_IN_PATH = $HOME/myCircleNode/build/Debug MAYA_SCRIPT_PATH = $HOME/myCircleNode XBMLANGPATH = $HOME/myCircleNode/%B
setenv MAYA_LOCATION /Applications/Autodesk/maya2013/Maya.app/Contents mkdir $HOME/devkit/applications cd $HOME/devkit/applications cp MAYA_LOCATION/Applications/Autodesk/maya2013/devkit/applications/* . make Clean make
The shell script mayald is used to link Maya API applications. It is important that the MAYA_LOCATION be set to the correct version of Maya before running the command, otherwise the application may fail to execute properly.
When linking your own plug-ins, make sure to provide the mayald command with a list all of the OpenMaya libraries containing the API classes you have used. The reference pages for each class specify the particular OpenMaya library containing the class.
setenv MAYA_LOCATION /Applications/Autodesk/maya2013/Maya.app/Contents setenv DYLD_LIBRARY_PATH $MAYA_LOCATION/MacOS setenv DYLD_FRAMEWORK_PATH $MAYA_LOCATION/Frameworks