Alternatively, the MDGModifier class (explained in Complete Maya Programming) allows you to alter the DG without you having to manually implement undo functionality.
On Thu, Oct 15, 2009 at 4:34 PM, <[email protected]> wrote: > For the most part when writing a plug-in you have to specifically tell Maya > how to undo something. For example given a node named "mySphere" is renamed > to "yourSphere" (passed as an argument). Then the undo function will rename > "yourSphere" back to "mySphere". When you undo, Maya is in the exact state > as the doIt/redoIt, so you can assume what you did can be reversed using the > same varaibles that are stored globally to the MPxCommand. > > The MGlobal class has a method to execute MEL and Python command that 'can' > undo. I just used it to create a skinCluster since its easier the create a > skinCluster using MEL or Python then the Maya API. > > You don't have to compile Python plug-ins for them to run. Check out the > examples in the dev kit, in the scripted folder. > > -brian > www.meljunky.com > > -------- Original Message -------- > Subject: [Maya-Python] Undo/Redo > From: Brandon Harris <[email protected]> > Date: Thu, October 15, 2009 5:20 pm > To: python_inside_maya <[email protected]> > > > OK. So I have finished a small procedure for averaging weights on > components and I have come to a point where I would like to set it up > for undoing and redoing. The only information I have to describe how > it's done is with Complete Maya Programming, but in it, all of it is > written in C++ and it's written as a compiled plugin. So my question > is, what changes about that with this all being in Python and run as a > script rather than a plugin? > Would I need to convert my procedure into an object and have the > undoIt and redoIt methods, or do I need to build the whole thing up as > MPxCommand and run it as a plugin? Any information would be great! > > thanks! > > Brandon L. Harris > > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
