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 “target” DAG transform nodes to which to scale the single “constraint object” DAG transform node. The scaleConstraint scales the constrained object at the weighted geometric mean of the world space target scale factors.
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 =[] )
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
layer (l) | unicode | ||
|
|||
maintainOffset (mo) | bool | ||
|
|||
name (n) | unicode | ||
|
|||
offset (o) | float, float, float | ||
|
|||
remove (rm) | bool | ||
|
|||
skip (sk) | unicode | ||
Specify the axis to be skipped. Valid values are “x”, “y”, “z” and “none”. During creation, “none” is the default. This flag is multi-use.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
targetList (tl) | bool | ||
|
|||
weight (w) | float | ||
|
|||
weightAliasList (wal) | bool | ||
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.scaleConstraint
Example:
import pymel.core as pm
import maya.cmds as cmds
# 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" )