pymel.core.general.duplicate

duplicate(*args, **kwargs)

This command duplicates the given objects. If no objects are given, then the selected list is duplicated. The smart transform feature allows duplicate to transform newly duplicated objects based on previous transformations between duplications. Example: Duplicate an object and move it to a new location. Duplicate it again with the smart duplicate flag. It should have moved once again the distance you had previously moved it. Note: changing the selected list between smart duplications will cause the transform information to be deleted The upstream Nodes option forces duplication of all upstream nodes leading upto the selected objects.. Upstream nodes are defined as all nodes feeding into selected nodes. During traversal of Dependency graph, if another dagObject is encountered, then that node and all it’s parent transforms are also duplicated. The inputConnections option forces the duplication of input connections to the nodes that are to be duplicated. This is very useful especially in cases where two nodes that are connected to each other are specified as nodes to be duplicated. In that situation, the connection between the nodes is also duplicated. See also:instance

Modifications:
  • new option: addShape

    If addShape evaluates to True, then all arguments fed in must be shapes, and each will be duplicated and added under the existing parent transform, instead of duplicating the parent transform. The following arguments are incompatible with addShape, and will raise a ValueError if enabled along with addShape:

    renameChildren (rc), instanceLeaf (ilf), parentOnly (po), smartTransform (st)

  • returns wrapped classes

  • returnRootsOnly is forced on. This is because the duplicate command does not use full paths when returning the names of duplicated objects and will fail if the name is not unique. Rather than return a mixed list of PyNodes and strings, I thought it best to give more predictable results.

Flags:
  • inputConnections : ic (bool) [create]

    Input connections to the node to be duplicated, are also duplicated. This would result in a fan-out scenario as the nodes at the input side are not duplicated (unlike the -un option).

  • instanceLeaf : ilf (bool) [create]

    instead of duplicating leaf DAG nodes, instance them.

  • name : n (unicode) [create]

    name to give duplicated object(s)

  • parentOnly : po (bool) [create]

    Duplicate only the specified DAG node and not any of its children. Flag can have multiple arguments, passed either as a tuple or a list.

  • renameChildren : rc (bool) [create]

    rename the child nodes of the hierarchy, to make them unique.

  • returnRootsOnly : rr (bool) [create]

    return only the root nodes of the new hierarchy. When used with upstreamNodes flag, the upstream nodes will be omitted in the result. This flag controls only what is returned in the output string[], and it does NOT change the behaviour of the duplicate command.

  • smartTransform : st (bool) [create]

    remembers last transformation and applies it to duplicated object(s)

  • upstreamNodes : un (bool) [create]

    the upstream nodes leading upto the selected nodes (along with their connections) are also duplicated.

Derived from mel command maya.cmds.duplicate

Previous topic

pymel.core.general.distanceDimension

Next topic

pymel.core.general.editDisplayLayerGlobals

Core

Core Modules

Other Modules

This Page