Efficient Maya development environment

How to setup your IDE so that clicking 'build' allows you to test and run your Maya plugin without extra steps or application restart.

To avoid copy/pasting plugin files it is best to tell Maya where to find the binary and scripts directly from your project folder. You can add the following environment variables:


MAYA_SHELF_PATH = C:\repo\trunk\plugin_name_maya\prefs\shelves/mayaxxxx
MAYA_SCRIPT_PATH = C:\repo\trunk\plugin_name_maya\scripts;C:\repo\trunk\libraries\toolbox_maya\mel
PYTHONPATH = C:\repo\trunk\plugin_name_maya\scripts
MAYA_PLUG_IN_PATH = C:\repo\trunk\plugin_name_maya\lib\mayaxxxx\release;C:\repo\trunk\plugin_name_maya\lib\mayaxxxx\debug
XBMLANGPATH = C:\repo\trunk\plugin_name_maya\prefs\icons


PLUGIN_MAYA_PATH = /home/user/repo/trunk/plugin_name_maya
MAYA_SHELF_PATH = $PLUGIN_MAYA_PATH/prefs/shelves/mayaxxxx
MAYA_SCRIPT_PATH = $PLUGIN_MAYA_PATH/scripts;C:\repo\trunk\libraries\toolbox_maya\mel
MAYA_PLUG_IN_PATH = $PLUGIN_MAYA_PATH/lib/mayaxxxx/release:$PLUGIN_MAYA_PATH/lib/mayaxxxx/debug

Note 1 Instead of globally defining these variables in your OS,
you can instead define those in Maya.env
(usually located around `C:/Users/your_name/Documents/maya/2015-x64`)

Note 2 MAYA_SHELF_PATH should always be defined first!

Once this setup is completed you should be able to load the plugin using your favourite method

From Maya MEL command line

# loadPlugin plugin_name.mll
# loadPlugin plugin_name_debug.mll // for the plugin in debug mode

Through Maya GUI

Window -> Settings/Preferences -> Plug-in Manager


It is possible to execute maya commands remotely (i.e from the Operating system command line). This is really useful if you whish to automatically unload / build / reload the plugin without having to type or press anything in Maya! In other words it is possible to re-build the plugin with a single click, and test is immediatly directly in Maya. First you need to open a port in Maya with the Mel command:

commandPort -n ":54321";

We recommend launching it automatically at each startup (through `userSetup.mel` in `maya_user_folder/scripts/userSetup.mel`) Then execute the python script in a flow that look like this:

py ./project_name/scripts/remote_plugin_unload.py
make -j8
py ./project_name/scripts/remote_plugin_load_release.py 

Example of python scripts.

Obviously you need to install python to execute those scripts (or use the interpreter installed with Maya)

It's worth noting it is usually pretty easy to setup your favourite IDE such as Qt creator, Eclipse etc. to execute those three steps when pushing the "build button"!

No comments

All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.
Anti-spam question: