Helper to manage UndoRedo in the editor or custom tools.
|Variant||add_do_method ( Object object, String method ) vararg|
|void||add_do_property ( Object object, String property, Variant value )|
|void||add_do_reference ( Object object )|
|Variant||add_undo_method ( Object object, String method ) vararg|
|void||add_undo_property ( Object object, String property, Variant value )|
|void||add_undo_reference ( Object object )|
|void||clear_history ( )|
|void||commit_action ( )|
|void||create_action ( String name, int merge_mode=0 )|
|String||get_current_action_name ( ) const|
|int||get_version ( ) const|
|void||redo ( )|
|void||undo ( )|
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.
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.
© 2014–2018 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.