Godot Version
Godot 4.8 rc1
Question
Hi ! I would like to implement a “Reset island” action, similar to the one found in A Monster’s Expedition.
Here is a clip to show what I mean :
I know that there is a UndoRedo class in Godot, but I do not know if it can be used for such an action.
Can you give me some hints please ?
Store the initial position and properties of each node in themselves, then have a function that goes through them all and calls a function to set them back.
I think in this case the question should not be “can it be used?” but do you really need to?
I use the EditorUndoRedoManager a lot and it creates a huge stack of all your changes. For editing this is fine, even though even there it’s pretty error-prone (because for every do step you need an undo step and the counts need to match exactly at all times or your you get scary memory leaks).
I’d follow @tibaverus advice and only consider adding a whole undo/redo stack if you’re making something like a full-blown level editor… (maybe that’s what’s in the clip; in that case, sorry I didn’t watch it).
I’ll try creating a method called “reset_node” and and connect them to an autoload signal.