pymel.core.nodetypes.Transform

Inheritance diagram of Transform

class Transform(*args, **kwargs)

class counterpart of mel function xform

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 In query mode, return type is based on queried flag.

LimitType = Enum( EnumValue('LimitType', 0, 'scaleMinX'), EnumValue('LimitType', 1, 'scaleMaxX'), EnumValue('LimitType', 2, 'scaleMinY'), EnumValue('LimitType', 3, 'scaleMaxY'), EnumValue('LimitType', 4, 'scaleMinZ'), EnumValue('LimitType', 5, 'scaleMaxZ'), EnumValue('LimitType', 6, 'shearMinXY'), EnumValue('LimitType', 7, 'shearMaxXY'), EnumValue('LimitType', 8, 'shearMinXZ'), EnumValue('LimitType', 9, 'shearMaxXZ'), EnumValue('LimitType', 10, 'shearMinYZ'), EnumValue('LimitType', 11, 'shearMaxYZ'), EnumValue('LimitType', 12, 'rotateMinX'), EnumValue('LimitType', 13, 'rotateMaxX'), EnumValue('LimitType', 14, 'rotateMinY'), EnumValue('LimitType', 15, 'rotateMaxY'), EnumValue('LimitType', 16, 'rotateMinZ'), EnumValue('LimitType', 17, 'rotateMaxZ'), EnumValue('LimitType', 18, 'translateMinX'), EnumValue('LimitType', 19, 'translateMaxX'), EnumValue('LimitType', 20, 'translateMinY'), EnumValue('LimitType', 21, 'translateMaxY'), EnumValue('LimitType', 22, 'translateMinZ'), EnumValue('LimitType', 23, 'translateMaxZ'))
attr(attr, checkShape=True)

when checkShape is enabled, if the attribute does not exist the transform but does on the shape, then the shape’s attribute will be returned.

Return type:Attribute
centerPivots(val=True, **kwargs)

Set pivot points to the center of the object’s bounding box. (see -p flag)

Flags:
  • preserve:

    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)

Derived from mel command maya.cmds.xform

clearRestPosition()

Clear the saved rest position of this transform. Derived from api method maya.OpenMaya.MFnTransform.clearRestPosition

Undo is not currently supported for this method

getBoundingBox(invisible=False, space='object')

xform -boundingBox and xform -boundingBoxInvisible

Return type:BoundingBox
getBoundingBoxInvisible(**kwargs)

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.

Flags:
  • objectSpace:

    treat values as object-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

  • worldSpace:

    treat values as world-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

Derived from mel command maya.cmds.xform

getBoundingBoxMax(invisible=False, space='object')
Return type:Vector
getBoundingBoxMin(invisible=False, space='object')
Return type:Vector
getLimit(type)

Determine the current value of the specified limit.

Parameters :
type : Transform.LimitType

type to query limit

values: ‘scaleMinX’, ‘scaleMaxX’, ‘scaleMinY’, ‘scaleMaxY’, ‘scaleMinZ’, ‘scaleMaxZ’, ‘shearMinXY’, ‘shearMaxXY’, ‘shearMinXZ’, ‘shearMaxXZ’, ‘shearMinYZ’, ‘shearMaxYZ’, ‘rotateMinX’, ‘rotateMaxX’, ‘rotateMinY’, ‘rotateMaxY’, ‘rotateMinZ’, ‘rotateMaxZ’, ‘translateMinX’, ‘translateMaxX’, ‘translateMinY’, ‘translateMaxY’, ‘translateMinZ’, ‘translateMaxZ’

Return type:

float

Derived from api method maya.OpenMaya.MFnTransform.limitValue

getMatrix(**kwargs)

Sets/returns the composite transformation matrix. *Note* the matrix is represented by 16 double arguments that are specified in row order.

Flags:
  • objectSpace:

    treat values as object-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

  • worldSpace:

    treat values as world-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

Derived from mel command maya.cmds.xform

getPivots(**kwargs)

convenience method that changes both the rotate and scale pivots simultaneously. (see -rp -sp flags for more info)

Flags:
  • objectSpace:

    treat values as object-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

  • worldSpace:

    treat values as world-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

  • worldSpaceDistance:

    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.

Derived from mel command maya.cmds.xform

getRestPosition()

Retrieve the saved rest position of this transform.

Return type:TransformationMatrix

Derived from api method maya.OpenMaya.MFnTransform.restPosition

getRotateAxis(**kwargs)

rotation axis orientation (when used with the -p flag the overall rotation is preserved by modifying the rotation to compensate for the axis rotation)

Flags:
  • objectSpace:

    treat values as object-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

  • worldSpace:

    treat values as world-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

  • preserve:

    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)

Derived from mel command maya.cmds.xform

getRotatePivot(space='object', **kwargs)

Returns the pivot about which the rotation is applied.

Parameters :
space : Space.Space

space in which to get the pivot

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

Return type:

Point

Derived from api method maya.OpenMaya.MSpace.rotatePivot

getRotatePivotTranslation(space='object', **kwargs)

Return the rotate pivot translation in linear units. This component is used internally by maya when the user moves the rotate pivot, or when the balance flag is set to true in the MfnTransform::setRotatePivot method. It serves as a compensation that allows existing transformations to be preserved. For the precise mathematics, refer to the transformation matrix details in the description section of MFnTransform .

Parameters :
space : Space.Space

space in which to get the pivot translation

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

Return type:

Vector

Derived from api method maya.OpenMaya.MSpace.rotatePivotTranslation

getRotation(space='object', quaternion=False, **kwargs)
Modifications:
  • added ‘quaternion’ keyword arg, to specify whether the result be returned as a Quaternion object, as opposed to the default EulerRotation object
  • added ‘space’ keyword arg, which defaults to ‘object’

Retrieve the rotation component of this transformation. The rotation is retrieved in MSpace::kTransform space.

Return type:EulerRotation

Derived from api method maya.OpenMaya.MFnTransform.getRotation

getRotationOrder()

Returns the rotation order for the transform matrix - the order in which the Euler angles are applied to create the end rotation.

Return type:TransformationMatrix.RotationOrder

Derived from api method maya.OpenMaya.MFnTransform.rotationOrder

getScale()

Retrieve the scaling component of this transformation.

Return type:(float, float, float)

Derived from api method maya.OpenMaya.MFnTransform.getScale

getScalePivot(space='object', **kwargs)

Returns the pivot around which the scale is applied. The pivot will be in linear units.

Parameters :
space : Space.Space

space in which to get the pivot

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

Return type:

Point

Derived from api method maya.OpenMaya.MSpace.scalePivot

getScalePivotTranslation(space='object', **kwargs)

Returns the scale pivot translation in linear units. This component is used as a compensation by maya when the user moves the scale pivot, or when the balance flag is set to true in the MfnTransform::setScalePivot method. The scale pivot translation serves as a compensation that allows existing transformations to be preserved when the scale pivot is modified. For the precise mathematics, refer to the transformation matrix details in the description section of MFnTransform .

Parameters :
space : Space.Space

space in which to get the scale pivot translation

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

Return type:

Vector

Derived from api method maya.OpenMaya.MSpace.scalePivotTranslation

getShape(**kwargs)
Return type:DagNode
getShapes(**kwargs)
Return type:DagNode
getShear()

Retrieve the shearing component of this transformation.

Return type:(float, float, float)

Derived from api method maya.OpenMaya.MFnTransform.getShear

getTransformation()

Retrieve the transformation matrix represented by this transform.

Return type:TransformationMatrix

Derived from api method maya.OpenMaya.MFnTransform.transformation

getTranslation(space='object', **kwargs)

Retrieve the translation component of this transformation in linear units.

Parameters :
space : Space.Space

transform space in which to get the translation

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

Return type:

Vector

Derived from api method maya.OpenMaya.MSpace.getTranslation

isLimited(type)

Determine if the specified limit attribute is enabled or disabled.

Parameters :
type : Transform.LimitType

type to query limit

values: ‘scaleMinX’, ‘scaleMaxX’, ‘scaleMinY’, ‘scaleMaxY’, ‘scaleMinZ’, ‘scaleMaxZ’, ‘shearMinXY’, ‘shearMaxXY’, ‘shearMinXZ’, ‘shearMaxXZ’, ‘shearMinYZ’, ‘shearMaxYZ’, ‘rotateMinX’, ‘rotateMaxX’, ‘rotateMinY’, ‘rotateMaxY’, ‘rotateMinZ’, ‘rotateMaxZ’, ‘translateMinX’, ‘translateMaxX’, ‘translateMinY’, ‘translateMaxY’, ‘translateMinZ’, ‘translateMaxZ’

Return type:

bool

Derived from api method maya.OpenMaya.MFnTransform.isLimited

resetFromRestPosition()

Reset the transform to its rest position. Derived from api method maya.OpenMaya.MFnTransform.resetFromRestPosition

Undo is not currently supported for this method

rotateBy(rotation, space='object', **kwargs)

Relatively change the rotation of this transformation using a quaternion.

Parameters :
quaternion : Quaternion

the quaternion

space : Space.Space

transform space in which to perform the rotation

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

Derived from api method maya.OpenMaya.MSpace.rotateBy

scaleBy(scale, **kwargs)

Relatively scale this transformation.

Parameters :
scale : (float, float, float)

The ratio by which to scale the transform

Derived from api method maya.OpenMaya.MFnTransform.scaleBy

setLimit(type, value)

Change the limit value for the specified limit type, and automatically enable the limit to be true.

Parameters :
type : Transform.LimitType

type to apply a limit

values: ‘scaleMinX’, ‘scaleMaxX’, ‘scaleMinY’, ‘scaleMaxY’, ‘scaleMinZ’, ‘scaleMaxZ’, ‘shearMinXY’, ‘shearMaxXY’, ‘shearMinXZ’, ‘shearMaxXZ’, ‘shearMinYZ’, ‘shearMaxYZ’, ‘rotateMinX’, ‘rotateMaxX’, ‘rotateMinY’, ‘rotateMaxY’, ‘rotateMinZ’, ‘rotateMaxZ’, ‘translateMinX’, ‘translateMaxX’, ‘translateMinY’, ‘translateMaxY’, ‘translateMinZ’, ‘translateMaxZ’

value : float

new limit value as internal unit

Derived from api method maya.OpenMaya.MFnTransform.setLimit

setLimited(type, flag)

Enable or disable the limit value for the specified limit type.

Parameters :
type : Transform.LimitType

type to apply a limit

values: ‘scaleMinX’, ‘scaleMaxX’, ‘scaleMinY’, ‘scaleMaxY’, ‘scaleMinZ’, ‘scaleMaxZ’, ‘shearMinXY’, ‘shearMaxXY’, ‘shearMinXZ’, ‘shearMaxXZ’, ‘shearMinYZ’, ‘shearMaxYZ’, ‘rotateMinX’, ‘rotateMaxX’, ‘rotateMinY’, ‘rotateMaxY’, ‘rotateMinZ’, ‘rotateMaxZ’, ‘translateMinX’, ‘translateMaxX’, ‘translateMinY’, ‘translateMaxY’, ‘translateMinZ’, ‘translateMaxZ’

flag : bool

true or false to enable

Derived from api method maya.OpenMaya.MFnTransform.enableLimit

setMatrix(val, **kwargs)

rotation axis orientation (when used with the -p flag the overall rotation is preserved by modifying the rotation to compensate for the axis rotation)

Flags:
  • objectSpace:

    treat values as object-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

  • worldSpace:

    treat values as world-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

  • preserve:

    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)

Derived from mel command maya.cmds.xform

setPivots(val=True, **kwargs)

convenience method that changes both the rotate and scale pivots simultaneously. (see -rp -sp flags for more info)

Flags:
  • objectSpace:

    treat values as object-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

  • worldSpace:

    treat values as world-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

  • worldSpaceDistance:

    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.

Derived from mel command maya.cmds.xform

setRestPosition(matrix)

Change the saved rest position of this transform. The rest position is not used internally by Maya. It is exclusively for use from the API as a temporary cache, which can be set and restored within a single Maya session. Note that the rest position is not saved with the scene.

Parameters :
matrix : TransformationMatrix

the new rest position for this transform

Derived from api method maya.OpenMaya.MFnTransform.setRestPosition

setRotateAxis(val=True, **kwargs)

rotation axis orientation (when used with the -p flag the overall rotation is preserved by modifying the rotation to compensate for the axis rotation)

Flags:
  • objectSpace:

    treat values as object-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

  • worldSpace:

    treat values as world-space transformation values (only works for pivots, translations, rotation, rotation axis, matrix, and bounding box flags)

  • preserve:

    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)

Derived from mel command maya.cmds.xform

setRotatePivot(point, space='object', balance=True, **kwargs)

Set the rotate pivot in linear units about which rotation is applied.

Parameters :
point : Point

new rotation pivot in centimeters

space : Space.Space

transform space in which to set the pivot

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

balance : bool

whether to balance the matrix

Derived from api method maya.OpenMaya.MSpace.setRotatePivot

setRotatePivotTranslation(vector, space='object', **kwargs)

Set the rotate pivot translation in linear units. This component is used internally by maya when the user moves the rotate pivot, or when the balance flag is true in the MFnTransform::setRotatePivot method. It serves as a compensation that allows existing transformations to be preserved when the rotate pivot is modified. For the precise mathematics, refer to the transformation matrix details in the description section of MFnTransform .

Parameters :
vector : Vector

new rotation pivot translation in centimeters

space : Space.Space

transform space in which to set the rotation pivot translation

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

Derived from api method maya.OpenMaya.MSpace.setRotatePivotTranslation

setRotation(rotation, space='object', **kwargs)

Change the rotation component of this transformation using a quaternion. The only valid transformation spaces for this method are MSpace::kTransform and MSpace::kWorld . All other spaces are treated as being equivalent to MSpace::kTransform .

Parameters :
quaternion : Quaternion

the quaternion

space : Space.Space

transform space in which to perform the rotation

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

Derived from api method maya.OpenMaya.MSpace.setRotation

setRotationOrder(order, reorder)

Change the rotation order for the transform - the order in which the Euler angles are applied to create the end rotation.

Parameters :
order : TransformationMatrix.RotationOrder

the order in which to apply rotations

values: ‘XYZ’, ‘YZX’, ‘ZXY’, ‘XZY’, ‘YXZ’, ‘ZYX’

reorder : bool

flag indicating whether or not rotations should be reordered.

Derived from api method maya.OpenMaya.MTransformationMatrix.setRotationOrder

setScale(scale, **kwargs)

Set the scaling component of this transformation.

Parameters :
scale : (float, float, float)

The scale of the transform

Derived from api method maya.OpenMaya.MFnTransform.setScale

setScalePivot(point, space='object', balance=True, **kwargs)

Set the pivot around which the scale is applied in linear units.

Parameters :
point : Point

new scale pivot in centimeters

space : Space.Space

transform space in which to set the scale pivot

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

balance : bool

whether to balance the matrix

Derived from api method maya.OpenMaya.MSpace.setScalePivot

setScalePivotTranslation(vector, space='object', **kwargs)

Set the scale pivot translation in linear units. This component is used internally by maya when the user moves the scale pivot, or when the balance flag is set to true in the MfnTransform::setScalePivot method. It serves as a compensation that allows existing transformations to be preserved when the scale pivot is modified. For the precise mathematics, refer to the transformation matrix details in the description section of MFnTransform .

Parameters :
vector : Vector

new scale pivot translation in centimeters

space : Space.Space

transform space in which to set the scale translation

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

Derived from api method maya.OpenMaya.MSpace.setScalePivotTranslation

setShear(shear, **kwargs)

Set the shearing component of this transformation.

Parameters :
shear : (float, float, float)

The shear of the transform

Derived from api method maya.OpenMaya.MFnTransform.setShear

setTransformation(transform)

Change this transform to equal the given matrix.

Parameters :
transform : TransformationMatrix

the matrix to copy

Derived from api method maya.OpenMaya.MFnTransform.set

setTranslation(vector, space='object', **kwargs)

Change the translation component of this transformation.

Parameters :
vector : Vector

the new translation vector in centimeters

space : Space.Space

transform space in which to perform the translation

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

Derived from api method maya.OpenMaya.MSpace.setTranslation

shearBy(shear, **kwargs)

Relatively shear this transformation.

Parameters :
shear : (float, float, float)

The ratio by which to shear the transform

Derived from api method maya.OpenMaya.MFnTransform.shearBy

translateBy(vector, space='object', **kwargs)

Relatively change the translation component of this transformation.

Parameters :
vector : Vector

the relative translation vector

space : Space.Space

transform space in which to perform the translation

values: ‘transform’, ‘preTransform’, ‘object’, ‘world’

Derived from api method maya.OpenMaya.MSpace.translateBy

ungroup(**kwargs)
zeroTransformPivots(val=True, **kwargs)

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 commandFlag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.xform

Previous topic

pymel.core.nodetypes.TransferAttributes

Next topic

pymel.core.nodetypes.TransformGeometry

Core

Core Modules

Other Modules

This Page