Background info: I am creating an addon with an 'Editor' mode. The mode is initiated by an Operator, and while the Modal is running, the user can add/remove/edit objects in the scene. The modal ends when the user toggles a boolean, exiting the 'Editor' mode.

Goal: I would like to bundle all actions that the user takes while in 'Editor' mode into one undo step once the editor is exited.

Question: Is there a way to achieve this goal in Python using Blender's undo system?

I've tried adding 'UNDO' to the bl_options property of the operator, but this only bundles the operations done in the execute function. I am currently using bpy.ops.ed.undo_push(message="Edit Assets") to push a step to the undo stack when the modal 'Editor' state is exited, but there are many steps left over in the undo stack from where the user added/removed objects in 'Editor' mode.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.