mirror of
https://github.com/blender/blender
synced 2026-11-22 03:45:13 +03:00
24 lines
855 B
Python
24 lines
855 B
Python
"""
|
|
.. _operator-undo:
|
|
|
|
Undo
|
|
----
|
|
|
|
The optional second positional argument is a boolean that controls whether the
|
|
operator call is pushed onto the undo stack.
|
|
|
|
It defaults to ``False``, so operators run from a script do not add to the undo
|
|
history. Pass ``True`` when you want the call to be undoable, for instance when
|
|
a script performs an edit the user should be able to undo interactively.
|
|
|
|
If this call happens while nested inside another operator call, the argument
|
|
has no effect: the outer call already suppresses undo for everything nested
|
|
inside it, and that only lifts once the outer call returns.
|
|
|
|
Like the execution context this argument is optional, but the positional order
|
|
must be kept, so the execution context is given first.
|
|
"""
|
|
|
|
# Add a cube as an undoable operator call.
|
|
import bpy
|
|
bpy.ops.mesh.primitive_cube_add('EXEC_DEFAULT', True)
|