crack matrix DGnode

41 views
Skip to first unread message

calin

unread,
Feb 1, 2008, 10:16:24 AM2/1/08
to python_inside_maya
Hi,

I'm trying to learn maya's python API and I thought of a crack matrix
node.
It will take a matrix as input, for example the world matrix from
another node and it will have translates, rotates, scales and maybe
sheers.
I'm having trouble extracting the translates. I know I could access
the components of the matrix and extract the last row for the
translates but I was wondering if there is another way, using a
function or something.

cheers
calin

calin

unread,
Feb 1, 2008, 10:18:48 AM2/1/08
to python_inside_maya
I forgot to attach my code

def compute(self,plug,dataBlock):

if ( plug == crackMatrixNode.tOutput ):
# read imput values

dataHandle = dataBlock.inputValue( crackMatrixNode.input )
inputMatrix = dataHandle.asMatrix()

# compute the output values
tm = OpenMaya.MTransformationMatrix(inputMatrix)
result = tm.getTranslation(OpenMaya.MSpace.kTransform)
print result[0], result[1], result[2]


# store them on the output plugs
outputHandle = dataBlock.outputValue( crackMatrixNode.tOutput )
outputHandle.set3Float( result[0], result[1], result[2] )
dataBlock.setClean( plug )

Ofer Koren

unread,
Feb 1, 2008, 11:23:01 AM2/1/08
to python_in...@googlegroups.com
This exists already as DecomposeMatrix.mll in your maya installation...
--


- Ofer
www.mrbroken.com

Calin Casian

unread,
Feb 1, 2008, 11:26:45 AM2/1/08
to python_in...@googlegroups.com

thx for pointing out. Sorry I wasn't more clear I want to write one as an exercise to get familiar with python API

Emre Tekinalp

unread,
Jan 24, 2014, 4:27:09 PM1/24/14
to python_in...@googlegroups.com
Hey calin!

If you are still searching for an answer here is the solution:

https://groups.google.com/forum/#!msg/python_inside_maya/gqT0E3NU13E/APkpe_zjPoIJ

I had the same issue in C++. I saw your post first while searching here and wanted to share with you the solution!
I hope it helps!!

Cheerio
turkish engineer

Paul Molodowitch

unread,
Jan 25, 2014, 8:08:29 PM1/25/14
to python_inside_maya

Thanks for the response! Will keep it in mind if I ever need to do this again...

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/a9a93b15-9cb8-4ad9-a047-9b93e9feabc2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

elrond79

unread,
Jan 25, 2014, 8:10:44 PM1/25/14
to python_in...@googlegroups.com
Oh, oops... Sorry, thought this was a different thread... Please ignore...
Reply all
Reply to author
Forward
0 new messages