Add metadata to Maya nodes


You can use the Maya Metadata API to create an arbitrary number of metadata structures that can be attached directly to any Maya node as well as the components (vertices, faces, and edges, and vertex faces) of Maya mesh objects. Metadata can be also added the Maya scene as a whole, meaning it does not need to be attached to any particular node. A small set of MEL commands provide access to the metadata from within Maya.

Using the Metadata classes, you can create data structures for the component-level metadata, and combine it into a single data stream that lets the metadata flow through operations in the Maya DG, while maintaining its attachment to the nodes. This includes adding component-level metadata to mesh node that have construction history. Since metadata can be attached to any node with an arbitrary named association, you can extend the API for uses such as attaching metadata to points in a point cloud, particles in a simulation, or a vertex on a NURBS surface. The metadata can later be examined or modified by MEL commands or through the API, and is preserved in Maya files across sessions. An example in the adsk::Data::Association class reference shows how to store vertex velocity and acceleration data on a simulated mesh. See the Maya API Documentation.

Metadata index values do not change through construction history. If the mesh topology is altered, the mesh component metadata may no longer be associated with its original component. The editMetadata command can help insert tweaks into construction history to fix any problems this might create

Metadata API classes

The Metadata API includes the following most commonly used classes: adsk::Data::Association, adsk::Data::Channel, adsk::Data::Stream, adsk::Data::Structure, and adsk::Data::Handle.

Association, Channel, Stream, and Structure each have equivalent XXIterator classes to facilitate walking through all members of the class.

Metadata MEL commands

From Maya, you can use the following MEL commands to access and manipulate data structures created from Metadata API.

If you want to use other index types, they can be implemented via plug-in through the Maya API. The metadata commands can use those types everywhere the native index types appear.

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License