Add undo to preserve connections when changing parameter in param node

This commit is contained in:
Wojtek Figat
2026-04-01 09:50:02 +02:00
parent f1796dc8c8
commit 9d9d582598

View File

@@ -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);
}
}
/// <summary>