pymel.core.general.applyAttrPattern

applyAttrPattern(*args, **kwargs)

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.

Flags:
Long name (short name) Argument Types Properties
nodeType (nt) unicode ../../../_images/create.gif
 

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 commandFlag can have multiple arguments, passed either as a tuple or a list.

patternName (pn) unicode ../../../_images/create.gif
 
The name of the pattern to apply. The pattern with this name must have been previously created using the createAttrPatterns command.

Derived from mel command maya.cmds.applyAttrPattern

Example:

import pymel.core as pm

import maya.cmds as cmds

import maya.cmds as cmds
pm.polySphere( name="sphere1" )
# Result: [nt.Transform(u'sphere1'), nt.PolySphere(u'polySphere1')] #
pm.applyAttrPattern( patternName="myXMLPattern" )
// Result: 1 //
name2 = pm.polySphere( name="sphere2" )
name3 = pm.polySphere( name="sphere3" )
pm.select( [name2, name3] )
pm.applyAttrPattern( patternName="myXMLPattern" )
// Result: 2 //
pm.applyAttrPattern( patternName="myXMLPattern", nodeType="transform" )
// Result: 1 //

Previous topic

pymel.core.general.align

Next topic

pymel.core.general.artAttrTool

Core

Core Modules

Other Modules

This Page