API Guide > Setting up your build environment >

# Windows environment (32-bit and 64-bit)

The Maya Development Kit product contains a number of example plug-ins located in C:\Program Files\Autodesk\maya2013\devkit\plug-ins. The development kit also contains several Maya API applications, located in C:\Program Files\Autodesk\maya2013\devkit\applications.

Maya plug-ins

Before you can use the example plug-ins, you need to build them. You can choose to build the plug-ins in the folder to which they were installed or you can copy the plug-ins to your own working folder.

Each plug-in resides in its own sub-folder. To build an individual plug-in, navigate to its sub-folder and double-click on the corresponding solution file (the .sln file) to load it into Microsoft Visual Studio 2010 SP1. When the solution has finished loading, select Build Solution from the Build menu. Visual Studio will build your plug-in and place the resulting .mll file in a subdirectory representing the configuration you built the plug-in for. For example, to build the circleNode plug-in you would navigate to the C:\Program Files\Autodesk\maya2013\devkit\plug-ins\circleNode folder, double-click on the circleNode.sln file, and then build the solution. Assuming that you built for the Debug|x64 configuration, the resulting plug-in will end up in C:\Program Files\Autodesk\maya2013\devkit\plug-ins\circleNode\x64\Debug\circleNode.mll. If you had built the for the Release|Win32 configuration, the plug-in would end up in C:\Program Files\Autodesk\maya2013\devkit\plug-ins\circleNode\Win32\Release\circleNode.mll.

To build all of the example plug-ins, navigate to the Development Kit's plug-ins folder (C:\Program Files\Autodesk\maya2013\devkit\plug-ins) and double-click on the Plugins.sln file to load it into Visual Studio. When the solution has finished loading, select Build Solution from the Build menu. Visual Studio should then rebuild all of the example plug-ins.

To load your plug-in into Maya, open the Plug-in Manager window and browse to the folder containing your plug-in. If you want the Plug-in Manager to automatically find your directory, you can build and put the plug-in into a directory defined by the MAYA_PLUG_IN_PATH variable.

Related topics

- Compiler Requirements

Maya API Applications

You can choose to build the applications in the folder to which they were installed or you can copy the applications to your own working folder.

To build an individual application, double-click on its solution file (e.g. readAndWrite.sln) to load it into Microsoft Visual Studio, then select Build Solution from the Build menu. Visual Studio will build your application and place the resulting executable file in the C:\Program Files\Autodesk\Maya2013\devkit\applications folder.

To build all of the example Maya API applications, use the APIApplications.sln solution file.

If, during installation, you added the Maya executable directory to your path, you can run the application immediately. If you did not, you will need to copy your application to the Maya executable directory to run it.

Several environment variables must be set in order to run a standalone Maya API application. These are:

- MAYA_LOCATION
- Path

For example:

    set MAYA_LOCATION=c:\Program Files\Autodesk\Maya2013
    set Path=c:\Program Files\Autodesk\Maya2013\bin;%Path%

Note that %Path% is included so that existing commands are not lost to the shell.

Creating your own plug-in build file

The instructions in the previous section enable you to build and use the example plug-ins included with Maya, but you still need information on creating your own plug-ins. On Windows, the process for creating the source code files is the same as it is on Linux, but in addition you must create Microsoft "Project" files so that Developer Studio knows how to build the plug-in. You can do this using the plug-in wizard, described in the following sections.

Using the Maya Plug-in Wizard for Developer Studio

A "Maya Plug-in Wizard" is provided for both the 32 and 64-bit versions of Maya. This wizard makes it very easy to create project files for your plug-in. It is highly recommended that you use this wizard.

To install this wizard, please follow the instructions contained in the $MAYA_LOCATION/devkit/pluginwizard directory.

To use the wizard, select File > New Project in Microsoft Visual Studio, then select Visual C++ Projects from Project Types and then finally select "Maya Plug-in Wizard" from the Templates area. The wizard will prompt you for the name of the plug-in, the type of plug-in (e.g. Command, Node, Tool, etc.) and the list of libraries the plug-in requires for linking. When you have answered all the questions, the wizard will create a complete project that contains the needed .sln and .vcxproj files, and a complete template of the code needed to create your Command, Node, Tool, and so on. This plug-in will compile without any changes, and will be a "do nothing" version of the type of plug-in you specified to the wizard. You just need to edit the .h and .cpp files and add the logic for your plug-in.