godot icon indicating copy to clipboard operation
godot copied to clipboard

Fix for UndoRedo system not preserving Script Properties from Editor Inspector

Open TheSofox opened this issue 1 year ago • 1 comments

Fixes #79430

Previously if you removed a script from an object in the Editor Inspector, and then used "Undo", the script would be restored but all its custom properties would be lost. This Pull Request ensures that any properties of a script are saved to the Undo history when the script is changed or removed.

It should be noted that this only fixes this in the Editor Inspector. The Scene Tree has the exact same bug but since is a completely different code path, I'm keeping the fixes separate.

Also, some may be confused by what I did on line 3715. Godot has established behaviour that when you replace one script for another, properties that have the same name in both scripts have their values copied over from the older to the newer. That line is to preserve this behaviour in the redo queue.

TheSofox avatar Nov 17 '23 22:11 TheSofox