Add undo to preserve connections when changing parameter in param node
This commit is contained in:
@@ -13,6 +13,7 @@ using FlaxEditor.Scripting;
|
|||||||
using FlaxEditor.Surface.Elements;
|
using FlaxEditor.Surface.Elements;
|
||||||
using FlaxEngine;
|
using FlaxEngine;
|
||||||
using FlaxEngine.Utilities;
|
using FlaxEngine.Utilities;
|
||||||
|
using FlaxEditor.Surface.Undo;
|
||||||
|
|
||||||
namespace FlaxEditor.Surface.Archetypes
|
namespace FlaxEditor.Surface.Archetypes
|
||||||
{
|
{
|
||||||
@@ -92,7 +93,17 @@ namespace FlaxEditor.Surface.Archetypes
|
|||||||
var selected = GetSelected();
|
var selected = GetSelected();
|
||||||
var selectedID = selected?.ID ?? Guid.Empty;
|
var selectedID = selected?.ID ?? Guid.Empty;
|
||||||
if (selectedID != (Guid)Values[0])
|
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);
|
Set(selected, ref selectedID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user