Helper to manage UndoRedo in the editor or custom tools.
Helper to manage UndoRedo in the editor or custom tools. It works by storing calls to functions in both 'do' an 'undo' lists.
Common behavior is to create an action, then add do/undo calls to functions or property changes, then committing the action.
Set a property with a custom value.
Add a 'do' reference that will be erased if the 'do' history is lost. This is useful mostly for new nodes created for the 'do' call. Do not use for resources.
Undo setting of a property with a custom value.
Add an 'undo' reference that will be erased if the 'undo' history is lost. This is useful mostly for nodes removed with the 'do' call (not the 'undo' call!).
Clear the undo/redo history and associated references.
Commit the action. All 'do' methods/properties are called/set when this function is called.
Create a new action. After this is called, do all your calls to [method add_do_method], [method add_undo_method], [method add_do_property] and [method add_undo_property].
Get the name of the current action.
Get the version, each time a new action is committed, the version number of the UndoRedo is increased automatically.
This is useful mostly to check if something changed from a saved version.