MPlugs: Array Plug

An array MPlug consists of a list of plugs, each with its own data value. The catch is that all the plugs in the list have the same data type. This is unlike compound plugs, which can have a mix of data types for its children. You can read more about these here in the Maya documentation.

Creating an array MPlug is easy enough. We’ll start by creating a network node that will receive the attribute.

Next we’ll create the children plugs of the array. Here I’m using MFnUnitAttribute.

Now make the array plug. Notice that in the create() function that I pass in all the children plugs as MObjects. For all the various MFnAttribute types their create() function returns the attribute as an MObject.

Finally we add the array plug to our node.

Here’s the resulting array attribute as seen through Maya’s Attribute Editor.

And here’s all the code together.