From 9d9d58259886247f6b482bfb859aa00fc1f791ca Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 1 Apr 2026 09:50:02 +0200 Subject: [PATCH] Add undo to preserve connections when changing parameter in param node --- Source/Editor/Surface/Archetypes/Parameters.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Source/Editor/Surface/Archetypes/Parameters.cs b/Source/Editor/Surface/Archetypes/Parameters.cs index 905f793c9..61d3b3617 100644 --- a/Source/Editor/Surface/Archetypes/Parameters.cs +++ b/Source/Editor/Surface/Archetypes/Parameters.cs @@ -13,6 +13,7 @@ using FlaxEditor.Scripting; using FlaxEditor.Surface.Elements; using FlaxEngine; using FlaxEngine.Utilities; +using FlaxEditor.Surface.Undo; namespace FlaxEditor.Surface.Archetypes { @@ -92,7 +93,17 @@ namespace FlaxEditor.Surface.Archetypes var selected = GetSelected(); var selectedID = selected?.ID ?? Guid.Empty; if (selectedID != (Guid)Values[0]) + { + if (Surface.Undo != null && Surface.Undo.Enabled) + { + // Capture node connections to support undo + var action = new EditNodeConnections(Context, this); + RemoveConnections(); + action.End(); + Surface.AddBatchedUndoAction(action); + } Set(selected, ref selectedID); + } } ///