Go to: Synopsis. Return value. Keywords. Related. Flags. Python examples.
applyAttrPattern([nodeType=string], [patternName=string])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
applyAttrPattern is undoable, NOT queryable, and NOT editable.
Take the attribute structure described by a pre-defined pattern and apply it either to a
node (as dynamic attributes) or a node type (as extension attributes). The same pattern
can be applied more than once to different nodes or node types as the operation duplicates
the attribute structure described by the pattern. See the 'createAttrPatterns' command
for a description of how to create a pattern.
int | Number of nodes or node types to which the attribute were added |
attribute, pattern
addAttr, addExtension, createAttrPatterns, deleteAttrPattern, listAttrPatterns
nodeType, patternName
Long name (short name) |
Argument types |
Properties |
patternName(pn)
|
string
|
|
|
The name of the pattern to apply. The pattern with this name must have been previously created using the createAttrPatterns command.
|
|
nodeType(nt)
|
string
|
|
|
Name of the node type to which the attribute pattern is to be applied. This flag
will cause a new extension attribute tree to be created, making the new attributes
available on all nodes of the given type. If it is not specified then either a node
name must be specified or a node must be selected for application of dynamic
attributes.
|
|
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
import maya.cmds as cmds
cmds.polySphere( name="sphere1" )
cmds.applyAttrPattern( patternName="myXMLPattern" )
// Result: 1 //
name2 = cmds.polySphere( name="sphere2" )
name3 = cmds.polySphere( name="sphere3" )
cmds.select( [name2, name3] )
cmds.applyAttrPattern( patternName="myXMLPattern" )
// Result: 2 //
cmds.applyAttrPattern( patternName="myXMLPattern", nodeType="transform" )
// Result: 1 //