this simple code
import maya.cmds as cmd
circle1 = cmd.circle(nr=(0, 0, 1), c=(0, -1.1, 0), ch=1)
circle2 = cmd.duplicate(circle1[0], ic=1)
circle3 = cmd.duplicate(circle1[0], ic=1)
cmd.setAttr(circle2[0] + '.rotateZ', 120)
cmd.setAttr(circle3[0] + '.rotateZ', -120)
allCurves = circle1[0], circle2[0], circle3[0]
cmd.select(allCurves)
cmd.makeIdentity(apply=True, t=1, r=1, s=1, n=0)
works perfectly in Maya 2012, giving me this result:
Instead, in Maya 2015 the result of the same code is this:
All circles moves to the origin.
It seems the command cmd.makeIdentity
work differently, but reading maya docs the command is the same. Also construction history settings are the same. I can't understand what Maya does behind the lines.
Why this lines of code works differently?
The real problem is because of a probable bug in the way the new Maya (2015) is performing preparations for
makeIdentity
when the nodes have shared history/connections/nodes (in this case themakeNurbCircle
node). It seems to be creating interimtransformGeometry
nodes to compensate for the to-be frozen transforms in the wrong order in the chain. This wasn't the case in Maya 2012, when the order seems to be right. If you look at the comparison below, you'll see why.2012 on the left; 2015 on the right:
Either ways, if you want to preserve this shared history and do the freeze transform this way for whatever reason, you might have to manually do what
makeIdentity
attempts to, but in the cleaner way you want it to; i.e. connect up thetransformGeometry
nodes properly in the right order before manually freezing transformations on the transforms (usingxform
).Here is something I just whipped up to do just that: (I will update the answer with comments and explanation when I find time later)
If above code is used:
Disclaimer: Theoretically, this should work in any version of Maya; But I have tested it only on Maya 2015.