Go to: Synopsis. Return value. Keywords. Related. Flags. Python examples.
applyMetadata([format=string], [scene=boolean], [value=string])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
applyMetadata is undoable, NOT queryable, and NOT editable.
Define the values of a particular set of metadata on selected objects. This command is used in preservation of metadata through Maya file formats (.ma/.mb). If any metadata already exists it will be kept and merged with the new metadata, overwriting duplicate entries. (i.e. if this command specifies data at index N and you already have a value at index N then the one this command specifies will be the new value and the old one will cease to exist.)
Unlike the editMetadata command it is not necessary to first use the addMetadata command or API equivalent to attach a metadata stream to the object, this command will do both assignment of structure and of metadata values. You do have to use the dataStructure command or API equivalent to create the structure being assigned first though.
The formatted input will be in a form expected by the data associations serializer (see adsk::Data::AssociationsSerializer for more information). The specific serialization type will be the default 'raw' if the format flag is not used.
For example the "raw" format input string "channel face\n[STREAMDATA]\nendChannels\nendAssociations" with no flags is equivalent to the input "[STREAMDATA]\nendChannels" with the channel flag set to 'face'
Boolean | True if the application succeeded |
Long name (short name) | Argument types | Properties | ||
---|---|---|---|---|
format(fmt)
|
string
|
![]() |
||
|
||||
scene(scn)
|
boolean
|
![]() |
||
|
||||
value(v)
|
string
|
![]() |
||
|
![]() |
![]() |
![]() |
![]() |
import maya.cmds as cmds import maya.cmds as cmds pNode = cmds.polyPlane( name='p' ) # Create a sample structure cmds.dataStructure( format='raw', asString='name=IdStruct:int32=ID' ) # Apply some metadata based on the defined structure to the created mesh # Normally you'll only see these in Maya files but it can be used from the # command line. cmds.applyMetadata( pNode, value='channel\nname face\nstream\nname IdStream\nstructure IdStruct\n0\n99\n1\n999\n2\n9999\nendStream\nendChannel\nendAssociations' ) # Return: 1 #