#include <MFnTransform.h>
The MFnTransform function set provides access to transformation DAG nodes called transforms.
DAG nodes are separated into two types, transforms and geometry nodes. All DAG nodes that are not transform nodes must exist as a child of a transform node. Only transforms provide transformation information. Transforms are also commonly used as parent nodes for the purpose of hierarchical grouping.
The transformation in the node is represented as a 4x4 transformation matrix. This function set allows access to the whole matrix, or the individual components (eg scale, rotation, shear, etc) of the transformation. The transform node is made up of many components that make up the final transformation matrix. This breakdown provides animators fine control over the animation of these parameters. Therefore, it is necessary to describe the order in which these attributes are applied to build the final matrix attribute.
A transformation matrix is composed of the following components, all components with units will be in maya's internal units (radians for rotations and centimeters for translations):
The transformation matrix is then constructed as follows:
-1 -1 [Sp]x[S]x[Sh]x[Sp]x[St]x[Rp]x[Ro]x[R]x[Rp]x[Rt]x[T]
where 'x' denotes matrix multiplication and '-1' denotes matrix inversion
Sp = | 1 0 0 0 | St = | 1 0 0 0 | | 0 1 0 0 | | 0 1 0 0 | | 0 0 1 0 | | 0 0 1 0 | | spx spy spz 1 | | sptx spty sptz 1 | S = | sx 0 0 0 | Sh = | 1 0 0 0 | | 0 sy 0 0 | | shxy 1 0 0 | | 0 0 sz 0 | | shxz shyz 1 0 | | 0 0 0 1 | | 0 0 0 1 | Rp = | 1 0 0 0 | Rt = | 1 0 0 0 | | 0 1 0 0 | | 0 1 0 0 | | 0 0 1 0 | | 0 0 1 0 | | rpx rpy rpz 1 | | rptx rpty rptz 1 | Ro = AX * AY * AZ AX = | 1 0 0 0 | AY = | cy 0 -sy 0 | | 0 cx sx 0 | | 0 1 0 0 | | 0 -sx cx 0 | | sy 0 cy 0 | | 0 0 0 1 | | 0 0 0 1 | AZ = | cz sz 0 0 | sx = sin(rax), cx = cos(rax) | -sz cz 0 0 | sy = sin(ray), cx = cos(ray) | 0 0 1 0 | sz = sin(raz), cz = cos(raz) | 0 0 0 1 | R = RX * RY * RZ (Note: order is determined by rotateOrder) RX = | 1 0 0 0 | RY = | cy 0 -sy 0 | | 0 cx sx 0 | | 0 1 0 0 | | 0 -sx cx 0 | | sy 0 cy 0 | | 0 0 0 1 | | 0 0 0 1 | RZ = | cz sz 0 0 | sx = sin(rx), cx = cos(rx) | -sz cz 0 0 | sy = sin(ry), cx = cos(ry) | 0 0 1 0 | sz = sin(rz), cz = cos(rz) | 0 0 0 1 | T = | 1 0 0 0 | | 0 1 0 0 | | 0 0 1 0 | | tx ty tz 1 |
Note that internally the Maya transform does not store the individual component values in matrices. It stores them in the data structure which makes the most sense for that component. For example, translation is stored as a vector. The accessor methods on MFnTransform provide the data in their native structure rather than as a matrix.
Additionally, each transform can save a temporary "rest position" matrix using the setRestPosition method. 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.
closestPointOnNurbsSurfaceCmd.cpp, customAttrManip.cpp, footPrintManip.cpp, geometrySurfaceConstraint.cpp, intersectOnNurbsSurfaceCmd.cpp, lineManip.cpp, lineManipContainer.cpp, moveNumericTool.cpp, moveTool.cpp, simpleSolverNode.cpp, squareScaleManip.cpp, squareScaleManipContext.cpp, surfaceBumpManip.cpp, and swissArmyManip.cpp.
Limit types.
MFnTransform::~MFnTransform | ( | ) | [virtual] |
Destructor.
Class Destructor
Constructor.
Class constructor that initializes the function set to the given MObject.
[in] | object | The MObject to attach the function set to |
[out] | ReturnStatus | the return status |
Constructor.
Class constructor that initializes the function set to the given constant MDagPath object.
[in] | object | The const MDagPath to attach the function set to |
[out] | ReturnStatus | The return status |
Constructor.
Class constructor that initializes the function set to the given MObject.
[in] | object | The MObject to attach the function set to |
[out] | ReturnStatus | the return status |
MFn::Type MFnTransform::type | ( | ) | const [virtual] |
Function set type.
Return the class type : MFn::kTransform
Reimplemented from MFnDagNode.
Reimplemented in MFnCircleSweepManip, MFnCurveSegmentManip, MFnDirectionManip, MFnDiscManip, MFnDistanceManip, MFnFreePointTriadManip, MFnHikEffector, MFnIkEffector, MFnIkHandle, MFnIkJoint, MFnManip3D, MFnPointOnCurveManip, MFnPointOnSurfaceManip, MFnRotateManip, MFnScaleManip, MFnStateManip, and MFnToggleManip.
const char * MFnTransform::className | ( | ) | const [protected, virtual] |
Class name.
Return the class name : "MFnTransform"
Reimplemented from MFnDagNode.
Reimplemented in MFnCircleSweepManip, MFnCurveSegmentManip, MFnDirectionManip, MFnDiscManip, MFnDistanceManip, MFnFreePointTriadManip, MFnHikEffector, MFnIkEffector, MFnIkHandle, MFnIkJoint, MFnManip3D, MFnPointOnCurveManip, MFnPointOnSurfaceManip, MFnRotateManip, MFnScaleManip, MFnStateManip, and MFnToggleManip.
MObject MFnTransform::create | ( | MObject | parent = MObject::kNullObj , |
|
MStatus * | ReturnStatus = NULL | |||
) |
Creates a new transformation node. The new node is placed in the DAG.
[in] | parent | the parent of the transform to be created |
[out] | ReturnStatus | status code |
Reimplemented in MFnHikEffector, MFnIkEffector, and MFnIkJoint.
MTransformationMatrix MFnTransform::transformation | ( | MStatus * | ReturnStatus = NULL |
) | const |
Retrieve the transformation matrix represented by this transform.
[out] | ReturnStatus | status code |
MStatus MFnTransform::set | ( | const MTransformationMatrix & | transform | ) |
Change this transform to equal the given matrix.
[in] | transform | the matrix to copy |
MStatus MFnTransform::getScale | ( | double | scale[3] | ) | const |
Retrieve the scaling component of this transformation.
[out] | scale | Storage for the scale of the transform |
MStatus MFnTransform::setScale | ( | const double | scale[3] | ) |
Set the scaling component of this transformation.
[in] | scale | The scale of the transform |
MStatus MFnTransform::scaleBy | ( | const double | scale[3] | ) |
Relatively scale this transformation.
[in] | scale | The ratio by which to scale the transform |
MStatus MFnTransform::getShear | ( | double | shear[3] | ) | const |
Retrieve the shearing component of this transformation.
[out] | shear | Storage for the shear of the transform |
MStatus MFnTransform::setShear | ( | const double | shear[3] | ) |
Set the shearing component of this transformation.
[in] | shear | The shear of the transform |
MStatus MFnTransform::shearBy | ( | const double | shear[3] | ) |
Relatively shear this transformation.
[in] | shear | The ratio by which to shear the transform |
MStatus MFnTransform::getRotation | ( | MQuaternion & | quaternion, | |
MSpace::Space | space = MSpace::kTransform | |||
) | const |
Retrieve the rotation component of this transformation as 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.
[out] | quaternion | the quaternion |
[in] | space | transform space in which to get the rotation |
MStatus MFnTransform::setRotation | ( | const MQuaternion & | quaternion, | |
MSpace::Space | space = MSpace::kTransform | |||
) |
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.
[in] | quaternion | the quaternion |
[in] | space | transform space in which to perform the rotation |
MStatus MFnTransform::rotateBy | ( | const MQuaternion & | quaternion, | |
MSpace::Space | space = MSpace::kTransform | |||
) |
Relatively change the rotation of this transformation using a quaternion.
[in] | quaternion | the quaternion |
[in] | space | transform space in which to perform the rotation |
MStatus MFnTransform::getRotation | ( | MEulerRotation & | rotation | ) | const |
Retrieve the rotation component of this transformation. The rotation is retrieved in MSpace::kTransform space.
[out] | rotation | the euler rotation in radians |
MStatus MFnTransform::setRotation | ( | const MEulerRotation & | rotation | ) |
Change the rotation component of this transformation. The rotation is set in MSpace::kTransform space.
[in] | rotation | the euler rotation |
MStatus MFnTransform::rotateBy | ( | const MEulerRotation & | rotation, | |
MSpace::Space | space = MSpace::kTransform | |||
) |
Relatively change the rotation component of this transformation.
[in] | rotation | the euler rotation |
MStatus MFnTransform::getRotationQuaternion | ( | double & | x, | |
double & | y, | |||
double & | z, | |||
double & | w, | |||
MSpace::Space | space = MSpace::kTransform | |||
) | const |
Retrieve the rotation component of this transformation as 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.
[out] | x | storage for the x component of the quaternion |
[out] | y | storage for the y component of the quaternion |
[out] | z | storage for the z component of the quaternion |
[out] | w | storage for the w component of the quaternion |
[in] | space | transform space in which to get the rotation |
MStatus MFnTransform::setRotationQuaternion | ( | double | x, | |
double | y, | |||
double | z, | |||
double | w, | |||
MSpace::Space | space = MSpace::kTransform | |||
) |
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.
[in] | x | x component of the quaternion |
[in] | y | y component of the quaternion |
[in] | z | z component of the quaternion |
[in] | w | w component of the quaternion |
[in] | space | transform space in which to perform the rotation |
MStatus MFnTransform::rotateByQuaternion | ( | double | x, | |
double | y, | |||
double | z, | |||
double | w, | |||
MSpace::Space | space = MSpace::kTransform | |||
) |
Relatively change the rotation of this transformation using a quaternion.
[in] | x | x component of the quaternion |
[in] | y | y component of the quaternion |
[in] | z | z component of the quaternion |
[in] | w | w component of the quaternion |
[in] | space | transform space in which to perform the rotation |
MStatus MFnTransform::getRotation | ( | double | rotation[3], | |
MTransformationMatrix::RotationOrder & | order | |||
) | const |
Retrieve the rotation component of this transformation. The rotation is retrieved in MSpace::kTransform space.
[out] | rotation | storage for the rotation components |
[in] | order | storage for the order of rotation |
MStatus MFnTransform::setRotation | ( | const double | rotation[3], | |
MTransformationMatrix::RotationOrder | order | |||
) |
Change the rotation component of this transformation. The rotation is set in MSpace::kTransform space.
[in] | rotation | the new rotation components |
[in] | order | the order in which to apply the rotations |
MStatus MFnTransform::rotateBy | ( | const double | rotation[3], | |
MTransformationMatrix::RotationOrder | order, | |||
MSpace::Space | space = MSpace::kTransform | |||
) |
Relatively change the rotation component of this transformation.
[in] | rotation | the relative rotation components |
[in] | order | the order in which to apply the rotations |
[in] | space | transform space in which to perform the rotation |
MVector MFnTransform::getTranslation | ( | MSpace::Space | space, | |
MStatus * | ReturnStatus = NULL | |||
) | const |
Retrieve the translation component of this transformation in centimeters.
[in] | space | transform space in which to get the translation |
[out] | ReturnStatus | return status |
MStatus MFnTransform::setTranslation | ( | const MVector & | vector, | |
MSpace::Space | space | |||
) |
Change the translation component of this transformation.
[in] | vector | the new translation vector in centimeters |
[in] | space | transform space in which to perform the translation |
MStatus MFnTransform::translateBy | ( | const MVector & | vector, | |
MSpace::Space | space | |||
) |
Relatively change the translation component of this transformation.
[in] | vector | the relative translation vector |
[in] | space | transform space in which to perform the translation |
MPoint MFnTransform::scalePivot | ( | MSpace::Space | space, | |
MStatus * | ReturnStatus = NULL | |||
) | const |
Returns the pivot around which the scale is applied. The pivot will be in centimeters.
[in] | space | space in which to get the pivot |
[out] | ReturnStatus | return status |
MStatus MFnTransform::setScalePivot | ( | const MPoint & | point, | |
MSpace::Space | space, | |||
bool | balance | |||
) |
Set the pivot around which the scale is applied in centimeters.
If balance if true, then the overall transformation matrix will not change and a compensating transformation will be added to the scale pivot translation to to compensate for the new scale pivot.
[in] | point | new scale pivot in centimeters |
[in] | space | transform space in which to set the scale pivot |
[in] | balance | whether to balance the matrix |
MVector MFnTransform::scalePivotTranslation | ( | MSpace::Space | space, | |
MStatus * | ReturnStatus = NULL | |||
) | const |
Returns the scale pivot translation in centimeters. 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.
[in] | space | space in which to get the scale pivot translation |
[out] | ReturnStatus | return status |
MStatus MFnTransform::setScalePivotTranslation | ( | const MVector & | vector, | |
MSpace::Space | space | |||
) |
Set the scale pivot translation in centimeters. 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.
[in] | vector | new scale pivot translation in centimeters |
[in] | space | transform space in which to set the scale translation |
MPoint MFnTransform::rotatePivot | ( | MSpace::Space | space, | |
MStatus * | ReturnStatus = NULL | |||
) | const |
Returns the pivot about which the rotation is applied.
[in] | space | space in which to get the pivot |
[out] | ReturnStatus | return status |
MStatus MFnTransform::setRotatePivot | ( | const MPoint & | point, | |
MSpace::Space | space, | |||
bool | balance | |||
) |
Set the rotate pivot in centimeters about which rotation is applied.
If balance if true, then the overall transformation matrix will not change and a compensating transformation will be added to the rotate translate pivot to compensate for the pivot modification.
[in] | point | new rotation pivot in centimeters |
[in] | space | transform space in which to set the pivot |
[in] | balance | whether to balance the matrix |
MVector MFnTransform::rotatePivotTranslation | ( | MSpace::Space | space, | |
MStatus * | ReturnStatus = NULL | |||
) | const |
Return the rotate pivot translation in centimeters. 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.
[in] | space | space in which to get the pivot translation |
[out] | ReturnStatus | return status |
MStatus MFnTransform::setRotatePivotTranslation | ( | const MVector & | vector, | |
MSpace::Space | space | |||
) |
Set the rotate pivot translation in centimeters. 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.
[in] | vector | new rotation pivot translation in centimeters |
[in] | space | transform space in which to set the rotation pivot translation |
MQuaternion MFnTransform::rotateOrientation | ( | MSpace::Space | space, | |
MStatus * | ReturnStatus = NULL | |||
) | const |
Returns the rotation used to orient the local rotation space. For the precise mathematics, refer to the transformation matrix details in the description section of MFnTransform.
[in] | space | space in which to get the rotation orientation. This argument is currently ignored. The rotateOrientation is always returned in local space: MSpace::kTransform. |
[out] | ReturnStatus | return status |
MStatus MFnTransform::setRotateOrientation | ( | const MQuaternion & | quat, | |
MSpace::Space | space, | |||
bool | balance | |||
) |
Set the rotation used to orient the local rotation space. For the precise mathematics, refer to the transformation matrix details in the description section of MFnTransform.
If balance if true, then the overall transformation matrix will not change and the rotation will be modified to achieve this.
[in] | quat | new orientation as a quaternion |
[in] | space | transform space in which to set the rotateOrientation. This argument is currently ignored. The rotateOrientation always set in local space: MSpace::kTransform. |
[in] | balance | whether to balance the overall transformation matrix |
MTransformationMatrix::RotationOrder MFnTransform::rotationOrder | ( | MStatus * | ReturnStatus = NULL |
) | const |
Returns the rotation order for the transform matrix - the order in which the Euler angles are applied to create the end rotation.
[out] | ReturnStatus | return status |
MStatus MFnTransform::setRotationOrder | ( | MTransformationMatrix::RotationOrder | order, | |
bool | reorder | |||
) |
Change the rotation order for the transform - the order in which the Euler angles are applied to create the end rotation.
[in] | order | the order in which to apply rotations |
[in] | reorder | flag indicating whether or not rotations should be reordered. |
MTransformationMatrix MFnTransform::restPosition | ( | MStatus * | ReturnStatus | ) | const |
Retrieve the saved rest position of this transform.
[out] | ReturnStatus | status code |
MStatus MFnTransform::setRestPosition | ( | const MTransformationMatrix & | 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.
[in] | matrix | the new rest position for this transform |
MStatus MFnTransform::resetFromRestPosition | ( | ) |
Reset the transform to its rest position.
MStatus MFnTransform::clearRestPosition | ( | ) |
Clear the saved rest position of this transform.
MStatus MFnTransform::getRotation | ( | double | rotation[3], | |
MTransformationMatrix::RotationOrder & | order, | |||
MSpace::Space | space | |||
) | const |
This method is obsolete.
Retrieve the rotation component of this transformation.
[out] | rotation | Storage for the rotation components. |
[in] | order | Storage for the order of rotation. |
[in] | space | Ingored. |
MStatus MFnTransform::setRotation | ( | const double | rotation[3], | |
MTransformationMatrix::RotationOrder | order, | |||
MSpace::Space | space | |||
) |
This method is obsolete.
Change the rotation component of this transformation.
[in] | rotation | The new rotation components. |
[in] | order | The order in which to apply the rotations. |
[in] | space | Ignored. |
MVector MFnTransform::translation | ( | MSpace::Space | space, | |
MStatus * | ReturnStatus = NULL | |||
) | const |
This method is obsolete.
[in] | space | Transform space in which to get the translation. |
[out] | ReturnStatus | Return status. |
bool MFnTransform::isLimited | ( | MFnTransform::LimitType | type, | |
MStatus * | ReturnStatus = NULL | |||
) | const |
Determine if the specified limit attribute is enabled or disabled.
[in] | type | type to query limit |
[out] | ReturnStatus | status code |
double MFnTransform::limitValue | ( | MFnTransform::LimitType | type, | |
MStatus * | ReturnStatus = NULL | |||
) | const |
Determine the current value of the specified limit.
[in] | type | type to query limit |
[out] | ReturnStatus | status code |
MStatus MFnTransform::setLimit | ( | MFnTransform::LimitType | type, | |
double | value | |||
) |
Change the limit value for the specified limit type, and automatically enable the limit to be true.
[in] | type | type to apply a limit |
[in] | value | new limit value as internal unit |
MStatus MFnTransform::enableLimit | ( | MFnTransform::LimitType | type, | |
bool | flag | |||
) |
Enable or disable the limit value for the specified limit type.
[in] | type | type to apply a limit |
[in] | flag | true or false to enable |
Autodesk® Maya® 2009 © 1997-2008 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |