Querying an array attribute
Attributes within Maya can also be stored as array attributes.
For example, this code sample queries the vrts array
attribute on a mesh. This is an array of compound attributes describing
the vertex positions for a mesh.
The process involves first accessing the MPlug for the array
attribute. We can then use this plug to determine the number of
array elements, by using the numElements member function.
In order to access an array element, we can use the member function
elementByPhysicalIndex(). This will return an MPlug to the specified
Each array element in the vrts array, is a compound attribute
type (x,y,z). We therefore need to retrieve plugs from the compound
plug in order to get hold of the individual x,y and z components.