What does makeIdentity (Freeze Transforms) do under the hood?

673 views
Skip to first unread message

Michael Boon

unread,
Feb 12, 2019, 9:10:38 PM2/12/19
to Python Programming for Autodesk Maya
Can anyone tell me what makeIdentity does, under the hood? Are there operations I can perform using xform or OpenMaya that will get me the same result?

I think I knew this once, but Maya has so many different transformations making up the transformation of a node, I can't keep track. In particular, makeIdentity seems to affect some transformation that is hidden in the shape node, that I can't find.

My goal, really, is to find a reliable way to change a (non-instanced) shape node so that its local pivots are 0,0,0 and its transform node's translate attribute represents the actual translation the user sees in the viewport. I would rather not just use makeIdentity without understanding it, because then it'll break when someone uses it in a way I didn't expect.

simon.a...@wingnutar.com

unread,
Feb 13, 2019, 12:12:30 AM2/13/19
to Python Programming for Autodesk Maya
Hi Micheal,

I was just having a read over what the method does, and trying it out on a few different type of objects.

on an group, it just seems get the world matrix and apply it to the groups pivot.

on geo, it offsets all the points by the world position of that object and then sets the pivot to be the world position, making it look as if the object has stayed in the same place, and has the same pivot point, but in actual fact the pivot point has been moved to match the previous transform and the points have been moved.

It also does this resursivley, for any object that is a child of the object you are performing the identity of.

This is very doable in OM or OM2, you will have to update the points using

mesh = om2.MFnMesh('shape object here')

# gets all the points in the mesh
points = mesh.getPoints()

# loop over every point and perform your math on the point here

# sets the points of the mesh
mesh.setPoints('your point array')

Updating a pivot of an object:

trans = om2.MFnTransform()
trans.setRotatePivot()

I hope that helps,
Cheers Si

Michael Boon

unread,
Feb 13, 2019, 8:01:46 PM2/13/19
to Python Programming for Autodesk Maya
Good tip on the way it moves points. I thought there must be another offset value stored in the shape.
I guess the "apply" flag makes it move points. It could be slow, hence having a specific flag.

So an issue I've run into is that even when I run makeIdentity only on translation, it still resets shear values, which means that subsequent attempts to move the local rotation or scale pivots get messed up. I'm not sure why it behaves like that. It works fine on non-uniform scale only with multiples of 90 degree rotations, since those don't cause shear.
Reply all
Reply to author
Forward
0 new messages