http://www.comet-cartoons.com/3ddocs/mayaAPI/
How do I create and access a MMatrix attribute?
// For creation: // #include <maya/MFnNumericAttribute.h> // Then inside of the initialize function for your plugin: MFnMatrixAttribute mAttr ; aMatrix = mAttr.create( "myMatrix", "m" ); // To access it from an MDataHandle inside of a compute or deform call // where the MDataBlock is called data: // MDataHandle hMatrix = data.inputValue(aMatrix, &stat ); MMatrix mat = hMatrix.asMatrix(); // Now get it MMatrix invmat = mat.inverse(); // and the inverse too. // To access it from an MPlug in a node, you must include // MPlug.h and MFnMatrixData.h and then do something as follows: // MObject thisNode = thisMObject(); // Get this actual plugin node's MObject...that's us! MPlug plugMat( thisNode, aMatrix ); // find our attribute plug on ourselves MObject oMat ; plugMat.getValue( oMat ); // For matrix plugs, have to get as MObject MFnMatrixData fnMat( oMat ); // Then take that to a MfnMatrix Data. MMatrix mat = fnMat.matrix() ; // Then finally get the matrix out from that. MMatrix invmat = mat.inverse() ; // and get inverse too...