Commonly, when a user executes an operator in Blender, this event is automatically recorded in the “Undo History” list so that in the future he can quickly undo the execution of the operator (Ctrl + z) or execute it again – redo the operator execution (Ctrl + shift + z). However, this does not always work.
Author: Andrej.
Let’s execute the simplest “Add Cube” operator to add the cube mesh to the scene in the Python Console:
1 |
bpy.ops.mesh.primitive_cube_add() |
Then, if we check the Undo History list (Edit – Undo History in the main menu), we will see that the execution of the operator itself was not included in the undo list, but only the general “Console Execute” action.
If we need for the statement itself to also be included in the Undo History list, we need to execute it by passing the “True” value to its first implicit parameter:
1 |
bpy.ops.mesh.primitive_cube_add(True) |
Now, the call of the operator itself is also recorded in the Undo History list.