Historical · current compatibility unverified Original context: PME 1.19.0, Blender 4.5.4, 2025. Undo behavior is operator- and release-specific.
Check what Blender records
A sequence that appears to be one action can create several Blender undo entries, and sculpt or paint tools may behave differently from object operations.
Choose EXEC_DEFAULT or INVOKE_DEFAULT for the interaction you need, then inspect undo separately. INVOKE guide covers that first choice; this page starts with Blender’s Undo History.
Recipe
-
Run each intended operator manually and inspect Edit → Undo History.
-
Run the PME sequence once and undo it step by step.
-
If the resulting boundaries are confusing, make the sequence explicit with immediate operators and deliberate undo pushes where appropriate:
bpy.ops.paint.visibility_invert("EXEC_DEFAULT") bpy.ops.ed.undo_push(message="visibility_invert") -
Give the undo entry a message that identifies the completed step.
-
Test undo and redo from the actual mode and data type used in production.
Pitfalls
EXEC_DEFAULTalone does not control the undo stack.- Add an undo push only after inspecting Undo History; extra entries can make a simple operation harder to reverse.
- If a sequence of operators remains unreliable, changing the data directly through Blender’s API may be a better implementation.
Related answers
- Execute an operator without reopening its interaction
- Build a Macro from a Blender operator
- Diagnose Blender context failures