The Maya API Tutor

copyright (c) Rob Bateman - NCCA - 2004


A big thanks to the 3rd year Ba course of the NCCA - I doubt i'd have got quite this far without you lot pushing me so hard, so thanks!





I can't vouch that all of this information is 100% correct. This is a very difficult thing todo since some aspects of the Maya API are not documented very well. In addition, many API plug-in examples that are included with Maya6.0 either do not work, are very shonky, or use obseleted functions. The information here is as good as i can make it due to time constraints etc.

!! use it at your own risk !!







The material on this site correponds to the Maya API lectures currently given to the third year Ba Computer Visualisation & Animation, and MSc Computer Animation courses at the National Center for Computer Animation in Bournemouth, UK. As such, some of it may not make 100% sense if you haven't attended the lecture series....

The only real text book on the subject of the Maya API is the book by David Gould, however it only covers the very basics and unfortunately the response I've had over the years from students, is that it is not worth buying :( It might be worth getting out from a library....

Some of these notes refer to the Maya Exporter Factfile I wrote last year, I'm trying to update it all so that it makes some form of linear sense, but these things take time.... :(

If anyone spots any errors, then please do let me know....






Source Code

The source code examples that accompany the lectures can be downloaded here. This code is set up to use gcc on linux, and Visual C++ Express 2005 beta (it's free, so students an use it...). If you are using an older version of visual C++ then you will need to create projects for the plugins.

This *should* be a case of creating a Win32 dll project. Change the output extension to "mll", ensure that the multi-threaded run-time libraries are used, and make sure that you have set the include and library directories for the Maya API. You may also need to define NT_PLUGIN in the pre-processor settings (though i think i've done that manually for all the code...). Visual C++ 6 will NOT compile plugins for Maya 6.0, if you are using it, download the beta of .NET 2005 !!






Core Topics

MObject - The generic handle of All things




Traversing the Maya Scene (Iterators, Function sets and Parenting)

Accessing Attributes via MFnDependencyNode and MPlugs

MPlug - Traversing Node Connections

MSelectionList - Selection in the Maya API

MSelectionList2 - selecting geometry components (ie, vert's, cv's etc)







MPxCommand - Adding Custom mel functions

MSyntax - Easier Argument Parsing

MDagModifier / MDgModifier - Implimenting Undo / Redo

Enabling Query and Edit






Adding Custom Tools

MPxContext and MPxContextCommand

MPxSelectionContext - Simplified selection tools

MPxToolCommand - Interactive Maya Tools






Adding Custom Nodes

MPxLocatorNode - Adding a Custom Locator Node

Adding Attributes to Nodes

The Attribute Editor templates and Channel Box

Using The compute() function and data blocks

Utilizing time inputs to nodes

Adding Manipulators

Handling Drag & Drop Behaviour within the Hypergraph






Adding Particle Systems

MPxEmitterNode - Adding a Custom Particle Emitter

MPxFieldNode - Adding Custom Dynamics Fields






Adding Custom Shaders

MPxNode - Adding a custom material (software shader)

MPxHwShaderNode - Adding a custom material (hardware shader)

Some Nasty mel hacks






Adding Custom Geometry Types



MPxGeometryData & MPxData







Importers / Exporters

GameDev Article


The Maya Exporter Factfile







Function Set Quick Reference (from Exporter Factfile)




Bump Maps

Environment Maps


Polygonal Meshes

Nurbs Surfaces

Nurbs Curves



Locator Nodes

Volume Primitives



Sampled Animation Data

Animation Curves

IK Chains



Blend Shapes

Joint Clusters (rigid skinning)

Skin Clusters (smooth skinning)



Particle Systems

Dynamics Fields


Display Layers

Render Layers

Custom Nodes