Go to: Synopsis. Return value. Keywords. Related. Flags. Python examples.

Synopsis

copyAttr([attribute=string], [containerParentChild=boolean], [inConnections=boolean], [keepSourceConnections=boolean], [outConnections=boolean], [renameTargetContainer=boolean], [values=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

copyAttr is undoable, queryable, and editable.

Given two nodes, transfer the connections and/or the values from the first node to the second for all attributes whose names and data types match. When values are transferred, they are transferred directly. They are not mapped or modified in any way. The transferAttributes command can be used to transfer and remap some mesh attributes. The attributes flag can be used to specify a list of attributes to be processed. If the attributes flag is unused, all attributes will be processed. For dynamic attributes, the values and/or connections will only be transferred if the attributes names on both nodes match. This command does not support geometry shape nodes such as meshes, subds and nurbs. This command does not support transfer of multi-attribute values such as weight arrays.

Return value

None

In query mode, return type is based on queried flag.

Keywords

node, connection, copy, container

Related

container, listAttr, transferAttributes

Flags

attribute, containerParentChild, inConnections, keepSourceConnections, outConnections, renameTargetContainer, values
Long name (short name) Argument types Properties
attribute(at) string createmultiuse
The name of the attribute(s) for which connections and/or values will be transferred. If no attributes are specified, then all attributes will be transferred.
containerParentChild(cpc) boolean create
For use when copying from one container to another only. This option indicates that the published parent and/or child relationships on the original container should be transferred to the target container if the published names match.
inConnections(ic) boolean create
Indicates that incoming connections should be transferred.
keepSourceConnections(ksc) boolean create
For use with the outConnections flag only. Indicates that the connections should be maintained on the first node, in addition to making them to the second node. If outConnections is used and keepSourceConnections is not used, the out connections on the source node will be broken and made to the target node.
outConnections(oc) boolean create
Indicates that outgoing connections should be transferred.
renameTargetContainer(rtc) boolean create
For use when copying from one container to another only. This option will rename the target container to the name of the original container, and rename the original container to its old name + "Orig". You would want to use this option if your original container was referenced and edited, and you want those edits from the main scene to now apply to the new container.
values(v) boolean create
Indicates that values should be transferred.

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.

Python examples

import maya.cmds as cmds

# transfer input connections and values from locator1 to locator2
#
cmds.copyAttr('locator1','locator2',inConnections=True,values=True)
# transfer only the translateX and translateY values
#
cmds.copyAttr('locator1','locator2',values=True,attribute=['tx','translateY'])