Summary
In this chapter, we learned about object-oriented programming and how to use the Maya Python API. We saw the power of inheritance and how to draw shapes into the Maya viewport using OpenGL. Then we learned about the inner workings of the Maya Python API bindings, how to navigate the Maya API Reference, and how MObject
s and function sets work.
We accomplished a number of tasks with the API which demonstrated common patterns. We used the powerful MFnMesh
class to build a mesh from scratch, wrestled with the MScriptUtil
class and pass by reference pattern, and saw how OpenMaya callbacks are used. We ended the chapter by implementing a command plugin for playing sound.
Throughout this chapter we also saw various problems with the Maya Python API. More and more code is being written as Python scripts instead of plugins, though some plugin types, especially for rendering, often still belong in C++. Next, in Chapter 8, Unleashing the Maya API through Python, we will look at OpenMayaMPx.MPxNode...