Introduction
 
 
 

Autodesk® Maya® is an open product. This means that anyone outside of Autodesk can change Maya’s existing features or add entirely new features. There are several ways you can modify Maya:

Please see the “MEL and Expressions” book for an introduction to MEL and the “Python” book for its equivalent interface. This book provides a technical introduction to the Maya API and the Maya Python API.

Overview

The Maya API is a C++ API that provides internal access to Maya and is available on the following platforms: Microsoft® Windows®, Linux®, and Apple® Mac OS® X. You can use the API to implement two types of code resources: plug-ins which extend the functionality of Maya, or stand-alones such as console applications which can access and manipulate a Maya model.

Plug-ins can be built in two ways:

Many of the examples in the API development kit are provided with both C++ and Python source codes. To allow both versions to be loaded into Maya at the same we have adopted the convention of prefixing the commands and nodes from Python plugins with “sp” (e.g. spHelix). You are not required to follow this convention.

When you use dynamic libraries, the operating system that you develop on place various restrictions on how to build and name plug-ins. The file extensions for plug-ins are:

Also, the rules for creating plug-ins and API applications differ on the various platforms. These rules are described in more detail later in this book.

The Developer Kit

The Maya API is located in the developer’s kit in the Maya Installation package. On some platforms, the Maya installer does not install the developer kit by default. As a result, you may have to specify that you want to install the devkit during the installation process. The developer kit contains 3 major components: include files, libraries, and examples.

Include Files

The development kit provides the header files which interface with Maya. These header files are located in the include/maya directory. Maya header files normally start with the M prefix. For certain types of header files the two letters following the M indicate the header file type: Fn for function set, It for iterator, Px for proxy class. These naming conventions will be described in more detail later.

Libraries

The API is packaged as a set of libraries that correspond to the different functional areas of Maya. These libraries are:

OpenMaya—Contains fundamental classes for defining nodes and commands and for assembling them into a plug-in.

OpenMayaUI—Contains classes necessary for creating new user interface elements such as manipulators, contexts, and locators.

OpenMayaAnim—Contains classes for animation, including deformers and inverse kinematics.

OpenMayaFX—Contains classes for Autodesk® Dynamics.

OpenMayaRender—Contains classes for performing rendering functions.

These libraries are shared libraries so that many plug-ins can use them at the same time. The libraries are located in the lib directory.

Select Build > Build <MayaAPI>.exe (where <MayaAPI> is the name of your Maya API application) to build your plug-in.

Mac OS X environment

Examples

The Maya API examples are located within the devkit directory. This directory contains an applications and plug-ins folder. The applications folder contains examples of stand-alone API applications while the plug-ins folder contains Maya API plug-in examples. The method for building stand-alone or plug-ins varies on the different platforms. In most cases, Makefiles are used. On Windows and Mac OS X, we have provided IDE solutions for building most of our examples.

Maya Python API examples are located within the plug-ins/scripted folder of the Maya Development Kit.

We do not provide the compiled plug-in and applications binaries on the Maya installation DVD. You must build these yourself. Building the devkit examples is described in more detail in the “Setting up your plug-in build environment” section.

Documentation

We provide extensive documentation with the Maya API. The documentation components we provide are:

This technical introduction to the Maya API includes a section for the Maya Python API. In addition, our class description documentation is used for both C++ and Maya Python API development as it includes information for both of these development approaches.

Related documentation includes:

You can access these resources from the Maya Help ( Help > Maya Help).

Other Requirements

Since the Maya API is a C++ API, it is best to have an understanding of the following:

In addition, when building a plug-in or a standalone, you must use the compiler and linker that is recommended for the release. This information can be found in the Whats New or in Introduction to building plug-ins and applications of the documentation.