pymel.core.animation.scaleConstraint

scaleConstraint(*args, **kwargs)

Constrain an object’s scale to the scale of the target object or to the average scale of a number of targets. A scaleConstraint takes as input one or more targetDAG transform nodes to which to scale the single constraint objectDAG transform node. The scaleConstraint scales the constrained object at the weighted geometric mean of the world space target scale factors.

Maya Bug Fix:
  • when queried, angle offsets would be returned in radians, not current angle unit
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:

Long Name / Short Name Argument Types Properties
layer / l unicode ../../../_images/create.gif ../../../_images/edit.gif
  Specify the name of the animation layer where the constraint should be added.
maintainOffset / mo bool ../../../_images/create.gif
  The offset necessary to preserve the constrained object’s initial scale will be calculated and used as the offset.
name / n unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Sets the name of the constraint node to the specified name. Default name is constrainedObjectName_constraintType
offset / o float, float, float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  Sets or queries the value of the offset. Default is 1,1,1.
remove / rm bool ../../../_images/edit.gif
  removes the listed target(s) from the constraint.
scaleCompensate / sc bool ../../../_images/create.gif ../../../_images/edit.gif
  Used only when constraining a joint. It specify if a scaleCompensate will be applied on constrained joint. If true it will connect Tjoint.aCompensateForParentScale to scaleContraint.aConstraintScaleCompensate.
skip / sk unicode ../../../_images/create.gif ../../../_images/edit.gif
  Specify the axis to be skipped. Valid values are x, y, zand none. During creation, noneis the default. This flag is multi-use.
targetList / tl bool ../../../_images/query.gif
  Return the list of target objects.
weight / w float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
  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 ../../../_images/query.gif
  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 Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.scaleConstraint

Example:

import pymel.core as pm

# Scale cube1 at the scale of cone1.
pm.scaleConstraint( 'cone1', 'cube1' )

# Uses the average of the scale of cone1 and surf2.
pm.scaleConstraint( 'cone1', 'surf2', 'cube2', w=.1 )

# Sets the weight for cone1's effect on cube2 to 10.
pm.scaleConstraint( 'cone1', 'cube2', e=True, w=10.0 )

# Removes surf2 from cube2's scaleConstraint
pm.scaleConstraint( 'surf2', 'cube2', e=True, rm=True )

# Adds surf3 to cube2's scaleConstraint with the default weight
pm.scaleConstraint( 'surf3', 'cube2' )

# Constrain the x and z scale of sph2 to sph1
pm.scaleConstraint( 'sph1', 'sph2', skip="y" )