Install Asset
Install via Godot
To maintain one source of truth, Godot Asset Library is just a mirror of the old asset library so you can download directly on Godot via the integrated asset library browser
Quick Information
Undo / Redo nodes based on Memento pattern
Undo / Redo node based on Memento pattern
https://medium.com/design-patterns-in-python/memento-pattern-eba610b3b59c
Usage
Add an Undoer node to your scene and set the target to the node you want to track (by default this is the current parent node).
To save state call call $Undoer.save_state
with a dictionary of properties you want to save
To undo call $Undoer.undo
this will apply the previous state to your target node
To redo call $Undoer.redo
this will apply the next saved sate to your target node
To clear all state call $Undoer.clear
Events
The Undoer also emits undone
and redone
events with the state that has been applied.
Examples
There are 2 example scenes in res://addons/undoredo/Examples, these demonstrate some different approaches you can use.
Restrictions
This is currently intended to handle properties on the parent object, method calls or properties on child nodes won't work at this time, but may be added later.
Undo / Redo nodes based on Memento pattern
Reviews
Quick Information
Undo / Redo nodes based on Memento pattern