Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

EditorUndoRedoManager

Inherits: Object

Manages undo history of scenes opened in the editor.

Description

EditorUndoRedoManager is a manager for UndoRedo objects associated with edited scenes. Each scene has its own undo history and EditorUndoRedoManager ensures that each action performed in the editor gets associated with a proper scene. For actions not related to scenes (ProjectSettings edits, external resources, etc.), a separate global history is used.

The usage is mostly the same as UndoRedo. You create and commit actions and the manager automatically decides under-the-hood what scenes it belongs to. The scene is deduced based on the first operation in an action, using the object from the operation. The rules are as follows:

  • If the object is a Node, use the currently edited scene;

  • If the object is a built-in resource, use the scene from its path;

  • If the object is external resource or anything else, use global history.

This guessing can sometimes yield false results, so you can provide a custom context object when creating an action.

EditorUndoRedoManager is intended to be used by Godot editor plugins. You can obtain it using EditorPlugin.get_undo_redo. For non-editor uses or plugins that don't need to integrate with the editor's undo history, use UndoRedo instead.

The manager's API is mostly the same as in UndoRedo, so you can refer to its documentation for more examples. The main difference is that EditorUndoRedoManager uses object + method name for actions, instead of Callable.

Methods

void

add_do_method ( Object object, StringName method, ... ) vararg

void

add_do_property ( Object object, StringName property, Variant value )

void

add_do_reference ( Object object )

void

add_undo_method ( Object object, StringName method, ... ) vararg

void

add_undo_property ( Object object, StringName property, Variant value )

void

add_undo_reference ( Object object )

void

commit_action ( bool execute=true )

void

create_action (