You can look at undoInfo, open and close chunk could be useful here.
On Fri, Apr 15, 2011 at 3:09 PM, Chad_Fox <[email protected]> wrote: > Hi all, > > when I run a matchTransform function/script made with pymel I can't > undo the action I performed. Undo just seems to 'skip' my function. > > rotation as an example: > > ________________________________ > import pymel as pym > > if pym.selected() < 2: > print '--ERROR: Select source object followed by 1 or more > targets' > else: > print '--Found Source: ' + str(pym.selected()[0]) + '\n--Found > Target(s): ' + str(pym.selected()[1:]) > for obj in pym.selected()[1:]: > try: > obj.setRotation(pym.selected() > [0].getRotation(space='world'),space='world') > print '--Matched rotation of: ' + str(obj) + ' to: ' + > str(pym.selected()[0]) > except: > print '--ERROR: Failed to set rotation on: ' + str(obj) > ___________________________________ > > When I run this on two or more objects, the target(s) will rotate to > match the source, but if I undo, it undoes whatever i did BEFORE the > match rotation. > > > Any thoughts as to why this is happening and how to make it undo-able? > > Thanks > > Chad Fox > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
