It seems like most aspects of Undo support for addon Operators remain troublesome, full of land mines, and generally ‘broken’ enough to stay away from entirely.
I’m attempting to write an Operator, typically invoked after the user is already in Edit mode, that performs several steps and Undo is completely broken for it.
The guidance seems to be to stick to native API calls as much as possible but that is quite the ordeal when there’s about 10 or so core bpy.ops which would have to be reimplemented and maintained etc. Is this still the case?
Additionally, even native API calls directly are problematic. Consider what the Undo stack looks like after attempting 1 Operator call:
- My Operator
- [several steps of inconsequential actions…]
- Toggle Editmode
In order for the user to Undo what is 1 logical operation (my operator), they have to hit Ctrl-Z as many times as it takes so they end up before the “magical” edit-model toggle which Blender seems to use as the restore point (erasing all their work in the meantime).
So what are my options?
- I plan to explore keeping track of state in my Addon directly and providing a MyUndo operator there which would reverse as much state as possible
- Is there a way to override that Toggle Editmode save-point somehow?