The Maya Developer Kit is available online at Autodesk Exchange at https://apps.exchange.autodesk.com/MAYA/en/Home/Index. After you copy the archive to your $HOME directory and unarchive it, a folder called devkitBase is created. There are a number of example plug-ins located in devkitBase/devkit/plug-ins. The Developer Kit also contains several Maya API applications, located in devkitBase/devkit/applications. Copy the /devkit and /mkspecs folders into /Applications/Autodesk/maya2017. You should therefore have the following folder structure:
Before you can use these plug-ins, you need to build them.
All plug-ins that are compiled for the Mac OS X platform must export the MApiVersion string; otherwise a linker error will occur. Exporting the MApiVersion string can be done by including <maya/MApiVersion.h>. Most plug-ins already include <maya/MFnPlugin.h> which in turn includes <maya/MApiVersion.h>; therefore, in most cases, no action needs to be taken.
To compile your custom plug-ins, you can also find the C++ API header files and libraries in the following folders of your Maya installation:
To compile plug-ins and standalone applications on Mac OS X, you must have the following installed: Mavericks 10.9.5, Xcode 6.1.1 with SDK 10.9, clang with libc++.
Maya does not provide binary compatibility for plug-ins between releases. For example a plug-in built in Maya 2015 will not load in Maya 2016. With each new release, the source must be recompiled. However, it is our goal to maintain source-code compatibility, and in the majority of cases, no changes to the source will be required.
There are two ways of building plug-ins on Mac OS X. You can either use Xcode or the Makefile that we supply with the Developer Kit.
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:
export MAYA_LOCATION=/Applications/Autodesk/maya2017/Maya.app/Contents
If you don't want to have to reset MAYA_LOCATION each time you log in, then add those commands to your $HOME/.profile as well.
If your command-line shell is csh or tcsh then command would be:
setenv MAYA_LOCATION /Applications/Autodesk/maya2017/Maya.app/Contents
and you can also add it to your $HOME/.cshrc to avoid having to reset it each time you log in.
Create a local working directory and copy the plug-in sources into it. This step is necessary because you likely won't have write permissions on the directories where Maya's Developer Kit is installed:
mkdir -p $HOME/devkit/plug-ins cd $HOME/devkit/plug-ins cp -r /Applications/Autodesk/maya2017/devkit/plug-ins/* .
make clean make
mkdir plug-ins scripts icons
cp */*.bundle plug-ins cp */*.{mel,py} scripts cp */*.{png,xpm,cur,rgb} icons
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. Using Maya.env makes it easy to 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 command line and they are prepended to the values given in Maya.env.
Set your Maya.env file to use the common directories:
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
Now when you start up Maya and bring up the Plug-in Manager you'll see all of the Developer Kit plug-ins, listed within a common section.
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.
To build one of the example plug-ins using Xcode, you must use the same version of Mac OS X that you'll be running Maya on and have the Xcode application installed. Then, do the following:
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. See Installing a Maya plug-in for more information regarding installing the plug-in and setting environment variables in the Maya.env file. As an example, in this case, if you want to access the circleNode and whatisCmd Developer Kit plug-ins from within Maya, then your Maya.env file should contain the following:
MAYA_PLUG_IN_PATH = $HOME/myCircleNode/build/Debug MAYA_SCRIPT_PATH = $HOME/myCircleNode XBMLANGPATH = $HOME/myCircleNode/%B
For building API applications, we only provide a Makefile solution. To build the supplied stand-alone application examples, you need to do the following:
export MAYA_LOCATION=/Applications/Autodesk/maya2017/Maya.app/Contents mkdir –p $HOME/devkit/applications cd $HOME/devkit/applications cp –r /Applications/Autodesk/maya2017/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.
On Mac OS X, you must set the DYLD_LIBRARY_PATH environment variable before you try to execute one of these applications so the runtime linker can find the Maya shared libraries.
The recommended procedure for preparing to build and run stand-alone applications is to set the following environment variables:
export MAYA_LOCATION=/Applications/Autodesk/maya2017/Maya.app/Contents export DYLD_LIBRARY_PATH=$MAYA_LOCATION/MacOS export DYLD_FRAMEWORK_PATH=$MAYA_LOCATION/Frameworks