Scratch-pad as I become more familiar with the various API classes. Also see:
API: class organization
Starting with Maya 2013, they offered a API Class Taxonomy online, which is all classes arranged according to subject/concept.
This is mainly a place where I can note classes I've used, there are obviously more than what is listed here.
See:
Also gives query methods for many data items as well (like the scene name, for example).
Many, many usable methods in here.
See:
Meaning, the
See:
See:
See:
API: class organization
Starting with Maya 2013, they offered a API Class Taxonomy online, which is all classes arranged according to subject/concept.
This is mainly a place where I can note classes I've used, there are obviously more than what is listed here.
M
Notes:- Maya's base utility classes.
M3dView
"provides methods for working with 3D model views. 3D views are based on OpenGL drawing areas"MAnimControl
"Control over animation playback and values"MAnimUtil
"...a static class which provides methods which determine if an object is being animated, which attributes are animated for a given object and which animation curves are used to animate a given attribute."- Methods include
isAnimated
,findAnimatedPlugs
,findAnimation
MBoundingBox
"Implementation of a 3D bounding box"MColor
"... used to store values of color attribute."MDagPath
"Provides methods for obtaining one or all Paths to a specified DAG Node..."node()
: returns anMObject
fullPathName()
: Returns string of the full path to the node.isInstanced()
: Returns True\False.
See:
MDGModifier
"...is used to change the structure of the dependency graph (DG). This includes adding nodes, making new connections, and removing existing connections."- Only usable in scripted plugins. If you call to API commands and want to be able to undo them, you need execute those operations through this class. See this example API: undoing commands.
- Used for node creation, deletion, attribute connection, disconnection, attribute addition, attribute removal, node renaming, mel execution, etc.
MDagModifier
Inherits fromMDGModifier
"...used to change the structure of the DAG (subset of the DG, focusing on transforms\shapes). This includes adding nodes, making new connections, and removing existing connections.
MDistance
"... provides a fundamental type for the Maya API to hold and manipulate linear data. All API methods that require or return distance information do so through variables of this type."- Great for converting from ui units to system units and vice-versa.
MEulerRotation
"This class provides methods for working with euler angle rotations."MFileIO
"Methods for opening, saving, importing, exporting, and referencing files."Also gives query methods for many data items as well (like the scene name, for example).
- Closely mirrors functionality found in the mel
file
command.
MGLFunctionTable
"...is a utility class which provides wrappers for the basic functions in the OpenGL API"- An instance of this class can be obtained from MHardwareRenderer.glFunctionTable()
MGlobal
"Provide methods for selection, 3D-views, time, model manipulation and MEL commands."Many, many usable methods in here.
deleteNode(MObject)
: Delete the given node.executeCommand(...)
: Has a variety of parameter signatures, executes a mel command.getActiveSelectionList(MSelectionList)
: Fill aMSelectionList
with what is currently selected (MObject
s).getFunctionSetList (MObject, MStringArray)
: Get a list of strings representing the function sets that will accept this objectselect(MObject)
: Put the given object on the active selection list.select(MDagPath, MObject) : Put the given object ({{{MDagPath
) and components (MObject
) on the active selection list.selectByName(string)
: Puts objects that match the give name on the active selection list, can use regular expressions.setOptionVarValue(string, int)
: Set an optionVar with an int value. More similar commands for setting other data types.sourceFile(string)
: Sources a mel script.viewFrame(double)
: Sets the current frame.
MImage
"...provides access to some of Maya's image manipulation functionality."MImageFileInfo
"...used to describe the characteristics of an image file, such as dimensions, channel count, and pixel format."MObject
"The generic class for accessing all Maya internal modelling, animation and rendering Objects, collectively referred to as Model Objects, through the API. This includes all Dependency Graph (DG) Nodes, of which Directed Acyclic Graph (DAG) Nodes are a subset."isNull()
: Returns True\False on whether it is a validMObject
or not.hasFn(MFn.kSomeConstant)
: Query to determine if theMObject
is comaptible with a given Function Set.function.
See:
MMatrix
"A matrix math class for 4x4 matrices of doubles."MPlug
"A plug is a point on a dependency node where a particular attribute can be connected."- Similar to the mel commands
connectionInfo
,isConnected
,getAttr
,setAttr
MPoint
"This class provides an implementation of a point. Numerous convienence operators are provided to help with the manipulation of points. This includes operators that work with theMVector
and MMatrix
classes."MProgressWindow
"...manages a window containing a status message, a graphical progress gauge, and optionally a "Hit ESC to Cancel" label for interruptable operations."- This is like the mel
progressWindow
command.
MQuaternion
"...provides methods for working with Quaternions"MScriptUtil
"Utility class for working with pointers to basic types such as int, float and arrays of these types."- Used heavily by Python scripting in the API to make it jive with c++ syntax.
- Some good notes HERE.
MSelectionList
"A list ofMObject
s."add()
: Accepts strings (using wildcards),MObject
,MDagPath
, andMPlug
.clear()
: Empty the selection list.getDagPath(int, MDagPath, MObject)
: For the given index, get the dag pathMDagPath
and componentMObject
(if present).getDependNode(int, MObject)
: Get theMObject
at the given index.getPlug (int, MPlug)
: Get the plug (attribute) at the given index).getSelectionStrings(MStringArray)
: Gets the string representations of the items in the selection list.getSelectionStrings(int, MStringArray)
: Gets the string representations of the items in the selection list at the given index.length()
Returns the length of the list.
MTime
"Set and retrieve animation time values in various unit systems."MTransformationMatrix
"...allows the manipulation of the individual transformation components (eg scale, rotation, shear, etc) of a four by four transformation matrix."MVector
"A vector math class for vectors of doubles."MFn
Notes:- Wrappers to make accessing common object easier. 'Fn' = 'Function'. They wrapper "functionality". Any class with this prefix is a function set used to operate on
MObject
s of a particular type. - All
MFn
classes (except forMFn
itself) inherit from MFnBase. The below hierarchy illustrates the class inheritance tree. - The mel command
nodeType
, via it'sapiType
flag can be used to query theMFn
type of a DAG node, which can then be used to find what type of function set to use. - Bit of craziness: Since Maya stores the Python API in different packages (see API: class organization), it's possible that this inheritance can span multiple packages. For example, this is the inheritance tree for
MFnSkinCluster
, which as you'll see inherits from two different packages;OpenMaya
andOpenMayaAnim
:OpenMaya.MFnBase
(superclass)OpenMaya.MFnDependencyNode
OpenMayaAnim.MFnGeometryFilter
OpenMayaAnim.MFnSkinCluster
(subclass)
MFn
"MFn
encapsulates all API Function Set type identifiers used for RTTI in the API."Meaning, the
MFn
class holds the constants (MFn.k*
) that can be tested against to determine what type function objects can be attached to an MObject
. Used with MObject.hasFn()
MFnBase
It has two useful methods:setObject(MObject)
that allows for anMObject
to be assigned to the function set after it was created.object()
, which returns theMObject
assigned to the function set.
MFnAttribute
"Dependency node attribute function set."
MFnComponent
"This is the base class for all function sets which deal with component objects. Components are MObjects which hold index information for shapes. Examples of these types are mesh vertices (single indexed), nurbs surface CVs (double indexed), and lattice points (triple indexed)."
MFnSingleIndexedComponent
MFnDoubleIndexedComponent
MFnTripleIndexedComponent
MFnDependencyNode
"...allows the creation and manipulation of dependency graph nodes (MObject
). Traversal of the dependency graph is possible using the getConnections method."
*MFnDependencyNode()
: Creation, no passed in object.
*MFnDependencyNode(MObject)
: Creation, passing in anMObject
.
*create(string)
: (has other signatures, but this one is easiest) : Creates a new dependency node with the given type. The new node is placed into the dependency graph.
* Many methods for node creation, getting connections, name setting, plug (attr) finding, attribute addition and removal, locking & unlocking, query if referenced, query parent namepace, query if name is unique, query if made via plug-in, and more...
MFnAnimCurve
"Create, query and edit Anim Curve Nodes and the keys internal to those Nodes."
*Many, many methods for interacting with animCurves.
MFnExpression
"...used to create, edit, and query expression nodes"
MFnGeometryFilter
"...the function set for geometry filters, the node that is the base class for deformers. Geometry filter nodes include clusters, ffds, nonlinears, user-defined deformers, sculpts, wires and blendShapes. The purpose of the geometry filter is to connect to the geometry that is deformed. The geometry filter is independent of any algorithm that calculates the deformation."
MFnSkinCluster
"...the function set for skinClusters"
MFnDagNode
"Provides methods for attaching Function Sets to, querying, and adding children to DAG Nodes (MDagPath
). Particularly useful when used in conjunction with the DAG Iterator class (MItDag
)."
*MFnDagNode()
: Creation with no dag path.
*MFnDagNode(MDagPath)
: Creation based on a dag path.
*Many methods for querying parents, querying children, duplication, node creation, parenting, unparenting, etc.
MFnMesh
"...provides access to polygonal meshes"
MFnTransform
"... provides access to transformation DAG nodes called transforms."
* Creation, transformation, value query, etc.
MFnIkHandle
"This is the function set for inverse kinematics (IK) handles. An ik handle specifies the joints in a skeleton that are effected by an attached ik solver."
MFnIkJoint
"...function set for joints."
MFnData
* "... is the parent class for all dependency graph data function sets. Conceptually, data objects are what flow through the connections in the dependency graph. Each node in the dependency graph has a data block associated with it. The data block holds the data objects for all of the node's attributes (seeMDataBlock
). The data block is only available during the compute method of a node. A data handle (MDataHandle
) can be created to access a particular attribute's data inside of the data block."
MFnMatrixData
*"...allows the creation and manipulation ofMMatrix
data objects for use in the dependency graph."
*This can be used within user-created nodes to access matrix data.
MIt
Notes:- Used for iterating though data (for looping through things). 'It' = 'Iterator'. They wrapper "iteration". These classes are iterators and work on
MObject
s similar to the way a function set (MFn
classes) does.
MItDag
"Use the DAG iterator to traverse the DAG either depth first or breadth first, visiting each node and, if desired, retrieving the node (as anMObject
)."See:
MItDependencyGraph
"Iterate over Dependency Graph (DG) Nodes or Plugs starting at a specified root Node or Plug."See:
MItDependencyNodes
"Use the dependency node iterator to traverse all the nodes in Maya's Dependency Graph."See:
MItGeometry
"... is the iterator class for geometry data, and can be used to loop over the CVs of NURBS, the points of subds & lattices, and the vertices of polygonal meshes."MItGeometry(MDagPath, MObject)
: Create a new object, passing in the path to the active node (MDagPath
) and anMObject
of the components to iterate over.index()
: Get the index of the current component.position(OpenMaya.MSpace.kWorld)
: Get the position of the current component as aMPoint
.setPosition(MPoing)
: Set the position of the current point.
MitMeshEdge
"...is the edge iterator for polygonal surfaces"MItMeshFaceVertex
"...is the iterator for face vertices on polygonal surfaces."MItMeshPolygon
"... is the iterator for polygonal surfaces (meshes)."- Good for querying or setting all verts on a mesh at once (for example)
MItMeshVertex
"...is the iterator for polygonal vertices."MItSelectionList
"Iterate over the items in the selection list."MItSelectionList(MSelectionList)
: Creation, based on a pre-existingMSelectionList
getDagPath(MDagPath, MObject)
: Get the path to the current object (MDagPath
) and aMObject
representing any selected components.
MItKeyframe
"Iterate over the keyframes of a particular Anim Curve Node..."MPx
Notes:- Used for creating custom plugins. 'Px' = 'Proxy'. They are API classes designed for you to derive from and create your own object types.