Dynamic attributes allow you to add or delete attributes on a particular node. Dynamic attributes are different from static attributes in that they are only married to a specific instance of a node type.
Extension attributes allow you to add or delete attributes, at run time, on all nodes of a given type. For example, you can add an attribute to a transform type instead of an instance of a transform. All nodes of type transform that currently exist or that will be created will contain the extension attribute, until that extension attribute is deleted.
See the Nodes reference documentation for the parent of each node. For example, surfaceShape is the parent of mesh; therefore, all attributes that exist in surfaceShape, both static and extension, also exist in mesh.
The addExtension command has the same parameters as the addAttr command with one exception. When using the addAttr command, you must specify the name of the node to which you are adding the dynamic attribute. However, when using the addExtension command, you use the -nodeType flag to specify the type of node to which you are adding the extension attribute.
In Maya 2014, there is no explicit serialization of extension attributes. In other words, there is no addition of an addExtension command to the Maya ASCII file, nor the addition of the binary equivalent to the Maya Binary file.
Extension attributes created by a plug-in rely on the plug-in requirements in the file in which they are used, including any referenced files. If the plug-in fails to load, or fails to add the extension attributes, they will not be available and the file may be missing that information.
Similarly, any extension attributes created via script or user command do not have any information in the files regarding the definition of those attributes, only their connections and values set. Extension attribute values saved in this way rely on the user to run the same script that created them initially before any file using them is loaded. It is good coding practice to confirm that extensions don't already exist before adding them in again; this way, multiple runs of the setup script will succeed every time.
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License