This Learning Path aims to outline the important concepts, classes, and functions used to develop Maya plug-ins with Python.
We recommend reading the topics in this Learning Path in sequential order, however the annotated code samples can be consulted
independently as reference material.
"Now with 100% more voxels!"
Python Scripts and Python Plug-ins - What's the Difference?
To begin, an important distinction should be made here between Python scripts and plug-ins for Maya:
- Python scripts - These programs can be executed in Maya's interactive Script Editor window. Python scripts generally make extensive use
of the maya.cmds module, whose functionality emulates the majority of Maya's MEL commands. The import statement below is typically found at
the head of Maya Python scripts.
In this learning path, we will use the maya.cmds module to execute our Python plug-ins.
NoteFor more information on the maya.cmds Python module, consult Maya User Guide > Technical Documentation > CommandsPython.
- Python plug-ins - These programs are loaded by Maya's Plug-in Manager from C:\Users\<username>\Documents\maya\<version>\plug-ins, and from the directories defined in the MAYA_PLUG_IN_PATH environment variable. Maya Python plug-ins can be used to define your own commands, nodes, shaders, constraints, file translators,
and deformers to name but a few customizable elements. Python plug-ins for Maya make use of several OpenMaya modules, which are based on Maya's C++ API.
import maya.OpenMaya as OpenMaya # Common classes
import maya.OpenMayaMPx as OpenMayaMPx # Classes from which to inherit
import maya.OpenMayaAnim as OpenMayaAnim # Animation classes
import maya.OpenMayaFX as OpenMayaFX # Effect classes (hair, particles, fluids)
import maya.OpenMayaRender as OpenMayaRender # Rendering classes
import maya.OpenMayaUI as OpenMayaUI # User interface classes
import maya.OpenMayaCloth as OpenMayaCloth # Cloth classes