Package mrv :: Package maya :: Module undo :: Class GenericOperationStack
[hide private]
[frames] | no frames]

Class GenericOperationStack

source code

object --+    
         |    
 Operation --+
             |
            GenericOperationStack

Operation able to undo generic callable commands (one or multiple). It would be used whenever a simple generic operatino is not sufficient

In your api command, create a GenericOperationStack operation instance, add your (mel) commands that should be executed in a row as Call. To apply them, call doIt once (and only once !). You can have only one command stored, or many if they should be executed in a row. The vital part is that with each do command, you supply an undo command. This way your operations can be undone and redone once undo / redo is requested


Notes:
Instance Methods [hide private]
 
__init__(self)
intiialize our variables
source code
 
doIt(self)
Call all doIt commands stored in our instance after temporarily disabling the undo queue
source code
 
undoIt(self)
Call all undoIt commands stored in our instance after temporarily disabling the undo queue
source code
 
addCmd(self, doCall, undoCall)
Add a command to the queue for later application
source code
 
addCmdAndCall(self, doCall, undoCall)
Add commands to the queue and execute it right away - either always use this way to add your commands or the addCmd method, never mix them !
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 
intiialize our variables
Overrides: object.__init__

doIt(self)

source code 
Call all doIt commands stored in our instance after temporarily disabling the undo queue
Overrides: Operation.doIt

undoIt(self)

source code 
Call all undoIt commands stored in our instance after temporarily disabling the undo queue
Overrides: Operation.undoIt

addCmd(self, doCall, undoCall)

source code 
Add a command to the queue for later application
Parameters:
  • doCall - instance supporting __call__ interface, called on doIt
  • undoCall - instance supporting __call__ interface, called on undoIt

addCmdAndCall(self, doCall, undoCall)

source code 
Add commands to the queue and execute it right away - either always use this way to add your commands or the addCmd method, never mix them !
Returns:
return value of the doCall

Note: use this method if you need the return value of the doCall right away