Go to: Synopsis. Return value. Flags. Python examples.
attrCompatibility(
[string [string]]
, [addAttr=boolean], [clear=boolean], [dumpTable=boolean], [enable=boolean], [nodeRename=string], [pluginNode=string], [removeAttr=boolean], [renameAttr=string], [type=string], [version=string])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
attrCompatibility is undoable, NOT queryable, and NOT editable.
This command is used by Maya to handle compatibility issues between file format
versions by providing a mechanism to describe differences between two
versions. Plug-in writers can make use of this command to handle attribute
compatibility changes to files.
The first optional command argument argument is a node type name and the
second optional command argument is the short name of an attribute.
Warning: Only use this command to describe changes in names or
attributes of nodes that you have written as plugins. Do
not use this command to change information about builtin dependency
graph nodes.
Removing attributes on a plug-in node is a special case. Use a separate
attrCompatibility call with pluginNode flag and name so that these
attributes can be tracked even though the plug-in may not be loaded.
Only one flag may be used per invocation of the command. If multiple flags
are provided one will arbitrarily be chosen as the action to perform and
the others will be silently ignored.
None
addAttr, clear, dumpTable, enable, nodeRename, pluginNode, removeAttr, renameAttr, type, version
Long name (short name) |
Argument types |
Properties |
|
addAttr(a)
|
boolean
|
|
|
Add the given attribute to the named node.
|
|
clear(clr)
|
boolean
|
|
|
Clear out the compatibility table.
This is only used internally for debugging purposes.
|
|
dumpTable(dmp)
|
boolean
|
|
|
Dump the current contents of the compatibility table.
This is only used internally for debugging purposes.
|
|
enable(e)
|
boolean
|
|
|
Enable or disable the compatibility table.
This is only used internally for debugging purposes.
|
|
nodeRename(nr)
|
string
|
|
|
Replace all uses of the node type 'nodeName' with given string.
|
|
pluginNode(pn)
|
string
|
|
|
Registers the string argument as a plug-in node type. This is
necessary for subsequent attrCompatibility calls that
reference node attributes of unloaded plug-ins. Specifically, this
works in the case when attributes are being removed.
|
|
removeAttr(rm)
|
boolean
|
|
|
Remove the given attribute from the named node.
|
|
renameAttr(r)
|
string
|
|
|
Change the short name of the attribute specified in the command's arguments
to the new short name provided as a parameter to this flag. Once the mapping
between short names has been established, Maya will handle the long names
automatically.
|
|
type(typ)
|
string
|
|
|
Change the type of the given attribute to the given type.
|
|
version(v)
|
string
|
|
|
Set the version target for subsequent commands to the given
string.
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can have multiple arguments, passed either as a tuple or a list.
|
import maya.cmds as cmds
# Rename '.x' attributes in old files to '.tx' for all nodes
# of type 'transform'
#
cmds.attrCompatibility( 'transform', 'x', r='tx' )
# Rename the old 'group' node to the new 'transform' node
#
cmds.attrCompatibility( 'group', nr='transform' )
# This will cause all subsequent attrCompatibility calls to translate
# files from older versions to version 1.0.
#
cmds.attrCompatibility( v='1.0' )