Go to: Synopsis. Return value. Related. Flags. Python examples.
xform(
[objects...]
, [absolute=boolean], [boundingBox=boolean], [boundingBoxInvisible=boolean], [centerPivots=boolean], [euler=boolean], [matrix=double16], [objectSpace=boolean], [pivots=[double, double, double]], [preserve=boolean], [relative=boolean], [rotateAxis=[double, double, double]], [rotateOrder=string], [rotatePivot=[double, double, double]], [rotateTranslation=[double, double, double]], [rotation=[double, double, double]], [scale=[double, double, double]], [scalePivot=[double, double, double]], [scaleTranslation=[double, double, double]], [shear=[double, double, double]], [translation=[double, double, double]], [worldSpace=boolean], [worldSpaceDistance=boolean], [zeroTransformPivots=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
xform is undoable, queryable, and editable.
This command can be used query/set any element in a
transformation node. It can also be used to query some values
that cannot be set directly such as the transformation matrix
or the bounding box. It can also set both pivot points to
convenient values.
All values are specified in transformation coordinates.
(attribute-space)
In addition, the attributes are applied/returned in the order in
which they appear in the flags section. (which corresponds to the
order they appear in the transformation matrix as given below)
See also: move, rotate, scale
depends
on type of query
In query mode, return type is based on queried flag.
move, rotate, scale
absolute, boundingBox, boundingBoxInvisible, centerPivots, euler, matrix, objectSpace, pivots, preserve, relative, rotateAxis, rotateOrder, rotatePivot, rotateTranslation, rotation, scale, scalePivot, scaleTranslation, shear, translation, worldSpace, worldSpaceDistance, zeroTransformPivots
Long name (short name) |
argument types |
Properties |
absolute(a)
|
boolean
|
|
|
perform absolute transformation (default)
|
|
relative(r)
|
boolean
|
|
|
perform relative transformation
|
|
euler(eu)
|
boolean
|
|
|
modifer for -relative flag that specifies rotation
values should be added to current XYZ rotation values.
|
|
objectSpace(os)
|
boolean
|
|
|
treat values as object-space transformation values
(only works for pivots, translations, rotation, rotation
axis, matrix, and bounding box flags)
|
|
worldSpace(ws)
|
boolean
|
|
|
treat values as world-space transformation values
(only works for pivots, translations, rotation, rotation
axis, matrix, and bounding box flags)
|
|
worldSpaceDistance(wd)
|
boolean
|
|
|
Values for -sp, -rp, -st, -rt, -t, -piv flags
are treated as world space distances to move along the
local axis. (where the local axis depends on whether
the command is operating in local-space or object-space.
This flag has no effect for world space.
|
|
preserve(p)
|
boolean
|
|
|
preserve overall transformation. used to prevent object
from "jumping" when changing pivots or rotation order. the
default value is true. (used with -sp, -rp, -roo, -cp, -ra)
|
|
scalePivot(sp)
|
[double, double, double]
|
|
|
scale pivot point transformation (when used with
the -p flag the overall transformation is preserved
by modifying the scale translation)
|
|
scale(s)
|
[double, double, double]
|
|
|
shear(sh)
|
[double, double, double]
|
|
|
shear transformation.
The values represent the shear <xy,xz,yz>
|
|
scaleTranslation(st)
|
[double, double, double]
|
|
|
rotatePivot(rp)
|
[double, double, double]
|
|
|
rotate pivot point transformation (when used with
the -p flag the overall transformation is preserved
by modifying the rotation translation)
|
|
rotateOrder(roo)
|
string
|
|
|
rotation order (when used with the -p flag the
overall rotation is preserved by modifying the
local rotation to be quivalent to the old one)
Valid values for this flag are
<xyz | yzx | zxy | xzy | yxz | zyx>
|
|
rotateAxis(ra)
|
[double, double, double]
|
|
|
rotation axis orientation (when used with
the -p flag the overall rotation is preserved
by modifying the rotation to compensate for
the axis rotation)
|
|
rotation(ro)
|
[double, double, double]
|
|
|
rotateTranslation(rt)
|
[double, double, double]
|
|
|
translation(t)
|
[double, double, double]
|
|
|
matrix(m)
|
double16
|
|
|
Sets/returns the composite transformation matrix.
*Note* the matrix is represented by 16 double
arguments that are specified in row order.
|
|
boundingBox(bb)
|
boolean
|
|
|
Returns the bounding box of an object. The values
returned are in the following order:
xmin ymin zmin xmax ymax zmax.
|
|
boundingBoxInvisible(bbi)
|
boolean
|
|
|
Returns the bounding box of an object.
This includes the bounding boxes of all invisible
children which are not included using the
boundingBox flag. The values returned are in
following order: xmin ymin zmin xmax ymax zmax.
|
|
pivots(piv)
|
[double, double, double]
|
|
|
convenience method that changes both the rotate and
scale pivots simultaneously. (see -rp -sp flags for
more info)
|
|
centerPivots(cp)
|
boolean
|
|
|
Set pivot points to the center of the object's
bounding box. (see -p flag)
|
|
zeroTransformPivots(ztp)
|
boolean
|
|
|
reset pivot points and pivot translations without
changing the overall matrix by applying these values
into the translation channel.
|
|
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.
|
import maya.cmds as cmds
# create object to manipulate
cmds.sphere( n='sphere1' )
# set rotation of sphere
cmds.xform( r=True, ro=(0, 90, 0) )
# change the rotate order but preserve the overall transformation
cmds.xform( p=True, roo='yzx' )