API Guide > Maya API introduction >

# 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:

- MEL™—(Maya Embedded Language) is a powerful and easy to learn scripting language. Most common operations can be done using MEL.
- Python™—is a powerful and easy to learn scripting language, which provides an interface to the Maya commands.
- C++ API—(Application Programmer Interface) provides better performance than MEL or Python. You can add new objects to Maya using the API, and code executes approximately ten times faster than when you perform the same task using MEL. Also, you are able to execute MEL commands from the API.
- Maya Python API—Based on the API and allows the API to be used through the Python scripting language.

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:

- As dynamic or relocatable libraries which are loaded into Maya using standard operating system functionality. Plug-ins work by accessing the symbol space of the host application Maya. Access to the symbol space of other loaded plug-ins is not available.
- As scripts that use the Maya Python API.

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:

- Linux: .so
- Windows: .mll
- Mac OS X: .bundle
- All platforms for Python plug-ins: .py

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.

TinyXML

Maya currently uses version 2.5.3 of TinyXML.

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.

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
- The API class descriptions

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:

- The MEL and Expressions guide
- The Maya MEL command reference
- The Maya Nodes and Attributes reference. Working with Maya nodes is a normal part of programming the Maya API
- The What’s New information provided with each release
- The Release Notes that provide items of interest for developers

You can access these resources from the Maya Help.

Other Requirements

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

- virtual functions
- class inheritance (including multiple)
- stream classes
- operator methods (there are many operator methods in the Maya API)

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.