[Maya-Python] Multi level undo in one go
Hi, I am changing the values of attributes on multiple objects in the maya scene. Now, if I have to go to the previous state(before the setting of the attributes), it takes lots of Undo. Is thee is a way to undone all the changes at once. Also, if I run the setting of the attributes from a function or procedure, all the changes get undone at once. But, I am not able to attain the same functionality from my script. Thanks. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com.
Re: [Maya-Python] Multi level undo in one go
Blue pencil plug? Anyone? El 23/01/2013 15:08, DayDreamer day.dreamer.m...@gmail.com escribió: Hi, I am changing the values of attributes on multiple objects in the maya scene. Now, if I have to go to the previous state(before the setting of the attributes), it takes lots of Undo. Is thee is a way to undone all the changes at once. Also, if I run the setting of the attributes from a function or procedure, all the changes get undone at once. But, I am not able to attain the same functionality from my script. Thanks. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com.
Re: [Maya-Python] Multi level undo in one go
Hi, What you can try is an open and close chunk of your undo queue. ## Opens a new undo chunk cmds.undoInfo(openChunk = True) ## Closes the chunk again cmds.undoInfo(closeChunk = True) Keep in mind though that if you have an error in your script halfway you might lose your entire undo stack. Maybe make a button that closes the undo chunk. so you can always preserve your undo stack. if you really want to make your life easy make a decorator function out of it. That way you can use it for every function you want to wrap in one undo call. Hope that helps. 2013/1/23 blindtresddd blindtres...@gmail.com Blue pencil plug? Anyone? El 23/01/2013 15:08, DayDreamer day.dreamer.m...@gmail.com escribió: Hi, I am changing the values of attributes on multiple objects in the maya scene. Now, if I have to go to the previous state(before the setting of the attributes), it takes lots of Undo. Is thee is a way to undone all the changes at once. Also, if I run the setting of the attributes from a function or procedure, all the changes get undone at once. But, I am not able to attain the same functionality from my script. Thanks. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com.
Re: [Maya-Python] Multi level undo in one go
The decorator is a nice suggestion. You could also create a context using contextlib (http://docs.python.org/2/library/contextlib.html) so that you can wrap sections of code in something that first starts the chunk and then closes it regardless of an exception: with undoable(): func1() # maybe calls 10 other things func2() # ah, raises an exception! On Thu, Jan 24, 2013 at 8:38 AM, Jan: jan@gmail.com wrote: Hi, What you can try is an open and close chunk of your undo queue. ## Opens a new undo chunk cmds.undoInfo(openChunk = True) ## Closes the chunk again cmds.undoInfo(closeChunk = True) Keep in mind though that if you have an error in your script halfway you might lose your entire undo stack. Maybe make a button that closes the undo chunk. so you can always preserve your undo stack. if you really want to make your life easy make a decorator function out of it. That way you can use it for every function you want to wrap in one undo call. Hope that helps. 2013/1/23 blindtresddd blindtres...@gmail.com Blue pencil plug? Anyone? El 23/01/2013 15:08, DayDreamer day.dreamer.m...@gmail.com escribió: Hi, I am changing the values of attributes on multiple objects in the maya scene. Now, if I have to go to the previous state(before the setting of the attributes), it takes lots of Undo. Is thee is a way to undone all the changes at once. Also, if I run the setting of the attributes from a function or procedure, all the changes get undone at once. But, I am not able to attain the same functionality from my script. Thanks. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com . To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com. -- You received this message because you are subscribed to the Google Groups Python Programming for Autodesk Maya group. To post to this group, send email to python_inside_maya@googlegroups.com. To unsubscribe from this group, send email to python_inside_maya+unsubscr...@googlegroups.com.