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\maya2011\devkit\plug-ins. The development kit also contains several Maya API applications, located in C:\Program Files\Autodesk\maya2011\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 directory to which they were installed or you can copy the plug-ins to your own working directory.

To build an individual plug-in, you need to load the corresponding solution file (the .sln file) into Microsoft Visual Studio 2008 SP1.

The easiest way to do this is to open Visual C++ and drag and drop the .sln file onto it. When the workspace is loaded, you can select Build Solution from the Build menu. Visual C++ will build your plug-in and place the resulting .mll file in the current directory.

To build all of the example plug-ins, you need to load the Plugins.sln workspace file into Visual C++. As above, the easiest way to do this is to open Visual C++ and drag and drop the Plugins.sln file onto it. When the workspace is loaded, you can select Rebuild Solution from the Build menu.

To load your plug-in into Maya, open the Plug-in Manager window and browse to the directory 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

Maya API Applications

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

To build an individual application, you need to load the corresponding workspace file (the .sln file) into Microsoft Visual C++. The easiest way to do this is to open Visual C++ and drag and drop the .sln file onto it.

When the solution is loaded, you can select Build Solution from the Build menu. Visual C++ will build your application and place the resulting executable file in the C:\Program Files\Autodesk\Maya2011\devkit\applications directory.

To build all of the example Maya API applications, you need to load the APIApplications.sln workspace file into Visual C++. As above, the easiest way to do this is to open Visual C++ and drag and drop the APIApplications.sln file onto it. When the workspace is loaded, you can select Rebuild Solution from the Build menu.

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:

For example:

set MAYA_LOCATION=c:\Program Files\Autodesk\Maya2011
set Path=c:\Program Files\Autodesk\Maya2011\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 .vcproj 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.

Configuring Qt for use in Maya plug-ins

Maya uses Nokia's Qt toolkit, version 4.5, for its graphical user interface (GUI).

Qt is provided under both a commercial license and the open source Lesser GNU Public License (LGPL). How you set up your plug-in build environment varies depending upon the type of license you are using.

If you are uncertain as to which licensing best applies to your intended usage of Qt, please refer to the QT licensing page.

Using a Qt commercial license with Maya plug-ins

Maya 2011 uses Qt 4.5 and Microsoft Visual Studio 2008; therefore, the respective download file will have a name similar to qt-win-commercial-4.5.3-vs2008.exe, where the revision number (in other words, the .3 in 4.5.3) is not important.

The commercial package comes with both the source code for Qt and binaries pre-built for use with 32-bit applications. If you want to build plug-ins for 32-bit Maya, then no further configuration of Qt is required and you can skip straight to Building the devkit Qt plug-ins.

If you want to build plug-ins for 64-bit Maya, then you will need to reconfigure Qt for 64-bit and rebuild it from the provided source. To do that, follow the instructions in Rebuilding Qt from source.

Using a Qt LGPL/Free license with Maya plug-ins

The LGPL version of Qt comes in a variety of packages but none of them contain binaries which are configured for use with Microsoft Visual Studio 2008, which is required by Maya's plug-in build environment. Therefore, you must rebuild Qt from source. To do that, download and install ftp://ftp.qt.nokia.com/qt/source/qt-win-opensource-4.5.3-mingw.exe.

During installation, you will be asked if you want to download and install the minimal MinGW installation. Although you won't need MinGW when building Maya plug-ins, Qt requires it during configuration. If you already have MinGW installed on your system, set the Previously Installed MinGW installation field to point to your MinGW installation. If not, then check the box to download and install MinGW.

After installation proceed to Rebuilding Qt from source.

Rebuilding Qt from source

NoteThese instructions assume that you have already downloaded and installed one of the packages mentioned in the previous two sections.
Warning32- and 64-bit versions of Qt cannot co-exist in the same directory tree. If you want to be able to build both 32- and 64-bit Maya plug-ins on the same machine, you must install Qt twice, into two different directories, then configure one directory tree for 32-bit and the other for 64-bit. If this case, you must also remember to adjust the directory paths in the remaining steps accordingly.
  1. Start up a Visual Studio command prompt.

    If you are building for 32-bit Maya, start up a Visual Studio 2008 Command Prompt.

    If you're building for 64-bit Maya, start up a Visual Studio 2008 x64 Win64 Command Prompt.

    If Visual Studio 2008 is installed normally, then you can find these on the Windows Start menu, in All Programs -> Microsoft Visual Studio 2008 -> Visual Studio Tools.

  2. Change directory to the folder where the Qt version is installed:

    cd C:\Qt\4.5.3

  3. Delete your old configuration of QT.

    If you have previously configured this version of Qt, you may have an old configuration already in place. Delete it by executing the following command:

    nmake confclean

    If you get the following error message:

    NMAKE : fatal error U1073: don't know how to make 'confclean'

    you can safely ignore it. This message simply means that there isn't an old configuration to delete.

  4. Configure Qt to use Visual C++ 2008 by executing the following command, all on one line:

    configure -platform win32-msvc2008 -debug-and-release -no-phonon -no-phonon-backend -no-webkit -direct3d

    NoteEven though the -platform flag indicates win32, the command will build a 64-bit version if you chose the Win64 command prompt back in step 1.

    Configuration may take several minutes to run.

  5. After configuration is complete, rebuild Qt by executing the following command. It may take an hour or more to run:

    nmake

  6. Create the file C:\Qt\4.5.3\bin\qtvars-msc.bat and give it the following contents:

    set QTDIR=C:\Qt\4.5.3

    set PATH=C:\Qt\4.5.3\bin

    set PATH=%PATH%;%SystemRoot%\System32

    set QMAKESPEC=win32-msvc2008

    call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall" x86

    If you want to build plug-ins for 64-bit Maya, then change the x86 in the last line to amd64. If your system is running 64-bit Windows, then change Program Files in that last line to Program Files (x86).

    Thus, if your system is running 64-bit Windows and you want to build plug-ins for 64-bit Maya, then that last line would be as follows:

    call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall" amd64

  7. From the Windows Start menu, navigate to All Programs -> Qt by Nokia v4.5.3. Right-click on the Qt 4.5.3 Command Prompt item and select Properties from the menu that appears.
  8. In the Target field of the Shortcut tab, change qtvars.bat to qtvars-msc.bat then click on the OK button.

    You should now be ready to build the devkit Qt plug-ins.

Building the devkit Qt plug-ins

  1. Start up a Qt command prompt, which can be found in the Windows Start menu in All Programs -> Qt by Nokia v4.5.3.
  2. Change to Maya's devkit plug-ins directory:

    cd C:\Program Files\Autodesk\Maya2011\devkit\plug-ins

  3. Execute the following command:

    nmake -f Makefile.qt

    The .mll files for the plug-ins will end up in the release sub-directory.

Cleaning up after a build

To clean up after a build, use the following command:

nmake -f Makefile.qt clean

NoteThis also deletes the .mll files; therefore, if you want to preserve them, you should first copy them to a backup folder.