Add OnPasted to Visject Surface nodes for custom post-paste logic

This commit is contained in:
Wojtek Figat
2023-08-24 10:43:59 +02:00
parent 952fe61515
commit 5f581bf156
2 changed files with 12 additions and 0 deletions

View File

@@ -395,6 +395,14 @@ namespace FlaxEditor.Surface
/// </summary>
public virtual SurfaceNode[] SealedNodes => null;
/// <summary>
/// Called after adding the control to the surface after paste.
/// </summary>
/// <param name="idsMapping">The nodes IDs mapping (original node ID to pasted node ID). Can be sued to update internal node's data after paste operation from the original data.</param>
public virtual void OnPasted(System.Collections.Generic.Dictionary<uint, uint> idsMapping)
{
}
/// <summary>
/// Gets a value indicating whether this node uses dependent boxes.
/// </summary>

View File

@@ -419,6 +419,10 @@ namespace FlaxEditor.Surface
{
node.Value.OnSpawned(SurfaceNodeActions.Paste);
}
foreach (var node in nodes)
{
node.Value.OnPasted(idsMapping);
}
// Add undo action
if (Undo != null && nodes.Count > 0)