Are you sure that those transform matrices you're plugging are valid? As in, i know they're a valid 4x4 construct, but in terms of what they represent in terms of a transform I have a feeling that they aren't coherent which is why as soon as you try go from a generic 4x4 to a transform matrix that means something, things get munged in order to keep it sane.
Case in point, i'm getting your results running your code, but I'm also happily able to apply a (trivial) custom matrix: # create a cube, translate it 1/2/3 directly. the_cube = pm.polyCube() the_cube[0].translateBy([1,2,3]) clean_xform = the_cube[0].xformMatrix.get() print "known valid transform matrix:" print clean_xform.formated() # it assigns cleanly to spam's transformation matrix spam = pm.datatypes.TransformationMatrix(clean_xform) print "\nspam should be a duplicate of this" print spam.formated() # okay, lets add in an arbitrary value clean_xform.a01 = 1 print "\ncorrupting a01 of the matrix... " print clean_xform.formated() eggs = pm.datatypes.TransformationMatrix(clean_xform) # eggs will do its best to absorb the data, but it has to # make sure it makes some kind of sense still as a transform matrix print "\n...and assigning it to eggs gives us:" print eggs.formated() print eggs.euler print eggs.translate # it's not however, due to us poking the matrix, if i was to assign the following to do a 45 deg rot # around (1,0,0) it should work. clean_xform.a11 = 0.7071 clean_xform.a12 = 0.7071 clean_xform.a21 = -0.7071 clean_xform.a22 = 0.7071 clean_xform.a01 = 0 # clear out the original corruption print "\nmanual build of a 45 rotation around [1,0,0]" print clean_xform.formated() fish = pm.datatypes.TransformationMatrix(clean_xform) print "\nfish reports:" print fish.formated() print fish.euler print fish.translate On 22 Dec 2012, at 13:42, Murphy Randle wrote: > Hello there! > I've been going crazy all evening trying to simply set the > TransformationMatrix of a node. For the life of me, I can't get any changes I > make to stick. The node always reverts to the identity matrix. > > After some digging I discovered that the TransformationMatrix node is not at > all behaving how I would expect it to. I've detailed what I mean here: > > https://gist.github.com/4357628 > > Am I just going crazy? Is this a bug with PyMel? > > I'm running Maya 2013 on Mac (Mountain Lion, 10.8.2). PyMel version is > whatever is bundled with 2013 (1.0.0?) > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected].
