TransformationMatrix

class cgp_maya_utils.api.TransformationMatrix(matrix=None, translate=None, rotate=None, scale=None, shear=None, rotateOrder=None)

Bases: maya.api.OpenMaya.MTransformationMatrix

MTransformationMatrix with custom functionalities

classmethod fromAttribute(attribute, rotateOrder=None)

get the transformationMatrix from the specified attribute

Parameters:
  • attribute (str or cgp_maya_utils.scene.Attribute) – attribute to get the matrix from - transform.matrix
  • rotateOrder (str) – rotateOrder of the transformationMatrix to get - use transform one if nothing specified
Returns:

the transformationMatrix

Return type:

cgp_maya_utils.api.TransformationMatrix

classmethod fromMatrix(matrix, rotateOrder=None)

get the transformationMatrix from the specified matrix

Parameters:
  • matrix (list[int, float] or maya.api.OpenMaya.MMatrix) – MMatrix or 16 numbers list used to initialize the transformationMatrix
  • rotateOrder (str) – rotateOrder of the transformationMatrix to get
Returns:

the transformationMatrix

Return type:

cgp_maya_utils.api.TransformationMatrix

classmethod fromTransforms(translate=None, rotate=None, scale=None, shear=None, rotateOrder=None)

get the transformationMatrix from the specified transforms

Parameters:
  • translate (list[int, float]) – value of translation of the transformationMatrix
  • rotate (list[int, float]) – value of rotation of the transformationMatrix
  • scale (list[int, float]) – value of scale of the transformationMatrix
  • shear (list[int, float]) – value of shear of the transformationMatrix
  • rotateOrder (str) – rotateOrder of the transformationMatrix to get
Returns:

the transformationMatrix

Return type:

cgp_maya_utils.api.TransformationMatrix

rotateOrder()

the rotateOrder of the transformationMatrix

Returns:the rotateOrder
Return type:str
setRotateOrder(rotateOrder)

set the rotateOrder of the transformationMatrix

Parameters:rotateOrder (str) – new rotateOrder of the transformationMatrix
transformValues()

the transform values stored in the transformation matrix

Returns:the transform values of the transformation matrix
Return type:dict