C++ API Reference
MSpace Class Reference

Space transformation identifiers. More...

#include <MTypes.h>

Public Types

enum  Space {
  kInvalid = 0, kTransform = 1, kPreTransform = 2, kPostTransform = 3,
  kWorld = 4, kObject = kPreTransform, kLast = 5
}
 Transformation spaces. More...
 

Detailed Description

Space transformation identifiers.

MSpace encompasses all of the types of transformation possible. The MSpace identifiers are used to determine the space in which the user is applying or querying transformation or component (i.e. vertex positions) data of a Maya object.

Note that not all the MSpace types can be passed into all methods which take an MSpace as a parameter. The MSpace enumerated type can be split into two parts, types which can be passed into MFnTransform and MTransformationMatrix classes (kTransform, kPreTransform and kPostTransform) and types which can be passed into shape classes such as MFnMesh, MFnNurbsSurface and MFnCamera (kWorld and kObject).

The following is a description of each of the MSpace types.

kInvalid

There are currently no methods in the API that return a result of type MSpace. This may be used for user defined methods that return a result of type MSpace to signify an invalid result.

kTransform

The data applied or queried using the kTransform type represents a transform's local (or relative) coordinates system. This type is valid for methods of MFnTransform and MTransformationMatrix classes.

kPreTransform

The data applied or queried using the kPreTransform type represents pre-transformed matrix data. Given a matrix which has had other matrix operations applied to it, this type is used to obtain a matrix that does not taken into consideration any other matrix operations. This type is valid for methods of the MTransformationMatrix classes.

kPostTransform

The data applied or queried using the kPostTransform type represents post-transformed matrix data. Given a matrix which has had other matrix operations applied to it, this type is used to obtain a matrix that has taken into consideration all other matrix operations. This type is valid for methods of the MTransformationMatrix classes.

kWorld

The data applied or queried using the kWorld type represents the data for the objects world coordinates system. The results of this type will take into consideration all the transforms in the objects hierarchy. This type can be used with shape classes such as MFnMesh, MFnNurbsSurface and MFnCamera and the MFnTransform class. Note that to get the proper world space transformation data with MSpace::kWorld you MUST use the class constructor which initializes the function set with an MDagPath object.

kObject

The data applied or queried using the kObject type represents the data for the objects local coordinates system. The results of this type will be in the local space of the object (object space). This enum can only be used with shape classes such as MFnMesh, MFnNurbsSurface and MFnCamera.

kLast

This simply signifies the end of the MSpace enumerated types. All values that precede this value represent a coordinate system (with the exception of kInvalid which represents an invalid result.)

Comparative Description:

There are four spaces in which to apply a transformation.

  • World Space - This is the space that an object is in after it has had all of its transformations applied to it. A world space transformation is the the very last transformation that would be applied to the object.
  • Object Space - This is the space in which an object is defined. An object space transformation would be the first transformation that would be applied to an object. This is the same as pre-transform space.
  • Post Transform Space - This is the space in which the object lives after having the transformations of its transform node applied. For example, when a primitive object is created in Maya, there is a shape node which defined the geometry and a transform node which positions/orients the geometry. The space that the geometry is in is object space. After applying the transformations of the transform node to the geometry, the transformed geometry is in post transform space.
  • Transform Space - This space depends on the type of transformation being applied. Transform nodes define a fixed sequence of affine transformations. Basically, there is scale followed by rotation and finally translation. There are four spaces here:

    1) The space before applying the scale.
    2) The space after the scale but before the rotation.
    3) The space between the rotation and translation.
    4) The space after the translation.
    Space 1) is pre-transform space.
    Space 4) is post-transform space.
    Spaces 2) and 3) define transform spaces.

    If applying a transform space scale, this transform will be applied after the current scale but before the rotation (space 2). If applying a transform space rotation, this transform will be applied after the current rotation but before the translation. Applying a translation in transform space, the translation will be applied after the current translation.

Examples:
apiMeshShape/apiMeshCreator.cpp.

Member Enumeration Documentation

enum Space

Transformation spaces.

Enumerator
kInvalid 

Invalid value.

kTransform 

Transform matrix (relative) space.

kPreTransform 

Pre-transform matrix (geometry).

kPostTransform 

Post-transform matrix (world) space.

kWorld 

transform in world space.

kObject 

Same as pre-transform space.

kLast 

Last value, used for counting.


The documentation for this class was generated from the following file: