pymel.core.animation.parentConstraint

parentConstraint(*args, **kwargs)

Constrain an object’s position and rotation so that it behaves as if it were a child of the target object(s). In the case of multiple targets, the overall position and rotation of the constrained object is the weighted average of each target’s contribution to the position and rotation of the object. A parentConstraint takes as input one or more targetDAG transform nodes at which to position and rotate the single constraint objectDAG transform node. The parentConstraint positions and rotates the constrained object at the weighted average of the world space position, rotation and scale target objects.

Maya Bug Fix:
  • when queried, upVector, worldUpVector, and aimVector returned the name of the constraint instead of the desired values
Modifications:
  • added new syntax for querying the weight of a target object, by passing the constraint first:

    aimConstraint( 'pCube1_aimConstraint1', q=1, weight ='pSphere1' )
    aimConstraint( 'pCube1_aimConstraint1', q=1, weight =['pSphere1', 'pCylinder1'] )
    aimConstraint( 'pCube1_aimConstraint1', q=1, weight =[] )
    
Flags:
  • createCache : cc (float, float) [edit]

    This flag is used to generate an animation curve that serves as a cache for the constraint. The two arguments define the start and end frames. The cache is useful if the constraint has multiple targets and the constraint’s interpolation type is set to no flip. The no flipmode prevents flipping during playback, but the result is dependent on the previous frame. Therefore in order to consistently get the same result on a specific frame, a cache must be generated. This flag creates the cache and sets the constraint’s interpolation type to cache. If a cache exists already, it will be deleted and replaced with a new cache.

  • deleteCache : dc (bool) [edit]

    Delete an existing interpolation cache. Flag can have multiple arguments, passed either as a tuple or a list.

  • layer : l (unicode) []

  • maintainOffset : mo (bool) [create]

    If this flag is specified the position and rotation of the constrained object will be maintained.

  • name : n (unicode) [create,query,edit]

    Sets the name of the constraint node to the specified name. Default name is constrainedObjectName_constraintType

  • remove : rm (bool) [edit]

    removes the listed target(s) from the constraint.

  • skipRotate : sr (unicode) [create]

    Causes the axis specified not to be considered when constraining rotation. Valid arguments are x, y, zand none.

  • skipTranslate : st (unicode) [create]

    Causes the axis specified not to be considered when constraining translation. Valid arguments are x, y, zand none.

  • targetList : tl (bool) [query]

    Return the list of target objects.

  • weight : w (float) [create,query,edit]

    Sets the weight value for the specified target(s). If not given at creation time, the default value of 1.0 is used.

  • weightAliasList : wal (bool) [query]

    Returns the names of the attributes that control the weight of the target objects. Aliases are returned in the same order as the targets are returned by the targetList flag

Derived from mel command maya.cmds.parentConstraint

Previous topic

pymel.core.animation.pairBlend

Next topic

pymel.core.animation.pasteKey

Core

Core Modules

Other Modules

This Page