Forcing a GUI repaint after Undo / Redo

On my system, there is some unpredictable delay between hitting Undo and seeing the created or deleted Node appear/disappear. Sometimes the deleted Node doesn’t actually reappear until I click off-window or drag another node or something. If it bothers you too, it is possible to force a GUI repaint with the following code in ProcessEvents():

if (Event.current.commandName == "UndoRedoPerformed")
{
    GUI.changed = true;
}

There’s also an event you can subscribe to if you prefer this approach:

Undo.undoRedoPerformed += MyForceGUIChangedCallback;
6 Likes

Nice job with figuring it out and leaving a tip for others. Thank you for this.

Oh great, I used this

Privacy & Terms