Creating a Maya Python plugin
Our tour of the Maya Python API continues with probably its most common use in the wild: creating a Maya plugin with Python. In fact, the entirety of the next chapter is spent working with Maya Python plugins in novel ways. We should have a good understanding of how plugins work before ending our API tour, so the remainder of this chapter will be focused on creating a Maya command plugin with Python. When called, the command will play a sound.
There are several plugin types supported by Maya. Plugin types are denoted by the MPx
prefix and are inside the maya.OpenMayaMPx
namespace. You can look at the Maya API Reference to get an idea of what's available. All plugins work with basically the same concepts, which we will cover in this chapter. Custom plugins are handled by subclassing the appropriate Maya plugin type, and registration is handled by the OpenMayaMPx.MFnPlugin
class.
In this section, we will create a command plugin by subclassing the maya.OpenMayaMPx...