title: Maya Python: Apply Transformation Matrix
body: <p>I have been looking for thi answer but i don't seem to figure it out anywhere, so i hope i could get my answer here...</p>
  
  <p>I'm in Maya Python API and i want to apply a transformation Matrix to a mesh.</p>
  
  <p>This is how i made the mesh:</p>
  
  <pre><code>    mesh = om.MFnMesh()
      ShapeMesh = cmds.group(em=True)
      parentOwner = get_mobject( ShapeMesh )
      meshMObj = mesh.create(NumVerts, len(FaceCount), VertArray, FaceCount, FaceArray ,parentOwner)
      cmds.sets( ShapeMesh, e=True,forceElement='initialShadingGroup')
      defaultUVSetName = ''
      defaultUVSetName = mesh.currentUVSetName(-1)
      mesh.setUVs ( UArray, VArray, defaultUVSetName )
      mesh.assignUVs ( FaceCount,  FaceArray, defaultUVSetName )
  </code></pre>
  
  <p>This is how i create the TFM:</p>
  
  <pre><code>m = struct.unpack("&lt;16f",f.read(64))
  mm = om.MMatrix()
  om.MScriptUtil.createMatrixFromList(m,mm)
  mt = om.MTransformationMatrix(mm)
  </code></pre>
  
  <p>Basically i read 16 floats and convert them into a Transformation Matrix, however i don't know how to apply the mt matrix to my mesh...</p>
  
  <p>I managed to get the Position,Rotation and Scale from this though, maybe it helps, this way:</p>
  
  <pre><code>    translate = mt.translation(om.MSpace.kWorld)
      rotate = mt.rotation().asEulerRotation()
      scaleUtil = om.MScriptUtil()
      scaleUtil.createFromList([0,0,0],3)
      scaleVec = scaleUtil.asDoublePtr()
      mt.getScale(scaleVec,om.MSpace.kWorld)
      scale = [om.MScriptUtil.getDoubleArrayItem(scaleVec,i) for i in range(0,3)]
  </code></pre>
  
  <p>Now my last step comes in applying this Matrix to the mesh, but i can't find a good way to do it, does someone know how to do this on maya?</p>
  
  <p>Thanks in advance:
  Seyren.</p>