Go to: Synopsis. Return value. Related. Python examples.

Synopsis

undo()

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

undo is undoable, NOT queryable, and NOT editable.

Takes the most recent command from the undo list and undoes it.

Return value

None

Related

flushUndo, redo, undoInfo

Python examples

import maya.cmds as cmds

# In this particular example, each line needs to be executed
# separately one after the other. Executing lines separately
# guaranties that commands are properly registered in the undo
# stack.

cmds.polyCube()
# Result: [u'pCube1', u'polyCube1'] #

cmds.polySphere()
# Result: [u'pSphere1', u'polySphere1'] #

cmds.undo()
# Undo: cmds.polySphere()
 #

cmds.undo()
# Undo: cmds.polyCube()
 #