Attributes and plugs
 
 
 

A node by itself without any means to affect it is not very useful. Modification of a node is done through attributes and plugs.

The attributes of a node define a data interface for the node to the rest of the graph. The only data that nodes pass to one another during evaluation comes and goes through this interface. They indicate what type of data can be accepted, what the name for that data will be (in a long form, or a short form), whether the data can be made into a list, and how the data is allowed to move in and out of the node. Types of data include simple data types such as integer and floating point values, and more complex data types such as points, whole polygonal meshes, and NURBS surfaces.

Plugs are constructs which contain the data for a given attribute. All data access for the attribute is done through the plug. The attribute itself only defines the data type and name for the attribute. Plugs also are the ports for making connections between nodes.

Attribute names must be unique across the entire node hierarchy, that is, across all derived and parent classes, but can be reused between unrelated nodes.

Attributes may have a default value assigned to them. This will be the value that a plug on that attribute will have if its value has not been set. For example, a numeric attribute always has a default value of zero, though this can be changed when creating the attribute. Any of the typed attributes will have a default value equal to the default value of the data type they accept—numeric data defaults to zero, matrix data defaults to the identity matrix, etc.

By default, Maya will automatically arrange the attributes of a node in the attribute editor. If you desire a special arrangement of the attributes of your node, you can write an attribute editor template for the node. This is a MEL file on your MAYA_SCRIPT_PATH whose name is of the form AE{nodeName}Template.mel that contains a MEL procedure with the name AE{nodeName}Template. This procedure contains editorTemplate commands that instruct the attribute editor how to alter the default layout for the attributes in the node.