I don’t remember the exact circumstances when Maya decides to do it for you or not, but you could explicitly define an undo chunk:
cmds.undoInfo(openChunk=True)
try:
testLoop()
finally:
cmds.undoInfo(closeChunk=True)
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/4b20c166-e487-4b7c-b7d3-0eb754494cbf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The use with caution bit is about making sure you always close the chunk. That's why I wrap it in a try.. finally. It ensures that even if the code inside crashes, the chunk will get closed. You could wrap it into a fancier context using the contextlib module. That would let you do something like
with undoChunk():
...
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/8638ace8-9a81-412b-a770-ddf527711b56%40googlegroups.com.