diff --git a/Source/Editor/Surface/Archetypes/Animation.MultiBlend.cs b/Source/Editor/Surface/Archetypes/Animation.MultiBlend.cs index 4d3239205..9773e9695 100644 --- a/Source/Editor/Surface/Archetypes/Animation.MultiBlend.cs +++ b/Source/Editor/Surface/Archetypes/Animation.MultiBlend.cs @@ -542,9 +542,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); UpdateUI(); } diff --git a/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs b/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs index f044cd6ff..a540ab697 100644 --- a/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs +++ b/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs @@ -174,17 +174,17 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); UpdateUI(); } /// - public override void OnSpawned() + public override void OnSpawned(SurfaceNodeActions action) { - base.OnSpawned(); + base.OnSpawned(action); // Ensure to have unique name var title = StateMachineTitle; @@ -741,9 +741,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); LoadTransitions(); @@ -1432,9 +1432,9 @@ namespace FlaxEditor.Surface.Archetypes public override int TransitionsDataIndex => 2; /// - public override void OnSpawned() + public override void OnSpawned(SurfaceNodeActions action) { - base.OnSpawned(); + base.OnSpawned(action); // Ensure to have unique name var title = StateTitle; @@ -1452,9 +1452,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); UpdateTitle(); } diff --git a/Source/Editor/Surface/Archetypes/Animation.cs b/Source/Editor/Surface/Archetypes/Animation.cs index 6364106e4..16b7993de 100644 --- a/Source/Editor/Surface/Archetypes/Animation.cs +++ b/Source/Editor/Surface/Archetypes/Animation.cs @@ -49,9 +49,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); if (Surface != null) UpdateTitle(); @@ -162,9 +162,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); // Peek deserialized boxes _blendPoses.Clear(); diff --git a/Source/Editor/Surface/Archetypes/Comparisons.cs b/Source/Editor/Surface/Archetypes/Comparisons.cs index dc90c2123..a0efbd92f 100644 --- a/Source/Editor/Surface/Archetypes/Comparisons.cs +++ b/Source/Editor/Surface/Archetypes/Comparisons.cs @@ -50,9 +50,9 @@ namespace FlaxEditor.Surface.Archetypes { } - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); // Restore saved input boxes layout if (Values[0] is byte[] data) @@ -62,9 +62,9 @@ namespace FlaxEditor.Surface.Archetypes } } - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); UpdateBoxes(); GetBox(0).CurrentTypeChanged += box => UpdateBoxes(); diff --git a/Source/Editor/Surface/Archetypes/Constants.cs b/Source/Editor/Surface/Archetypes/Constants.cs index 72a77ea4d..cbe7822e3 100644 --- a/Source/Editor/Surface/Archetypes/Constants.cs +++ b/Source/Editor/Surface/Archetypes/Constants.cs @@ -43,9 +43,9 @@ namespace FlaxEditor.Surface.Archetypes box.CurrentType = new ScriptType(Values[0].GetType()); } - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); var box = (OutputBox)GetBox(0); if (Values[0] == null) @@ -100,9 +100,9 @@ namespace FlaxEditor.Surface.Archetypes base.OnValuesChanged(); } - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); _output = (OutputBox)Elements[0]; _typePicker = new TypePickerControl @@ -238,9 +238,9 @@ namespace FlaxEditor.Surface.Archetypes base.OnValuesChanged(); } - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); _output = (OutputBox)Elements[0]; _keyTypePicker = new TypePickerControl diff --git a/Source/Editor/Surface/Archetypes/Flow.cs b/Source/Editor/Surface/Archetypes/Flow.cs index 11eec534a..b0922b1b7 100644 --- a/Source/Editor/Surface/Archetypes/Flow.cs +++ b/Source/Editor/Surface/Archetypes/Flow.cs @@ -25,9 +25,9 @@ namespace FlaxEditor.Surface.Archetypes { } - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); // Restore saved output boxes layout var count = (int)Values[0]; @@ -35,9 +35,9 @@ namespace FlaxEditor.Surface.Archetypes AddBox(true, i + 1, i, string.Empty, new ScriptType(typeof(void)), true); } - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); _removeButton = new Button(0, 0, 20, 20) { @@ -107,9 +107,9 @@ namespace FlaxEditor.Surface.Archetypes { } - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); // Restore saved output boxes layout if (Values[0] is byte[] data) @@ -119,9 +119,9 @@ namespace FlaxEditor.Surface.Archetypes } } - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); UpdateBoxes(); GetBox(1).CurrentTypeChanged += box => UpdateBoxes(); diff --git a/Source/Editor/Surface/Archetypes/Function.cs b/Source/Editor/Surface/Archetypes/Function.cs index cffb2ad6f..54b561e4c 100644 --- a/Source/Editor/Surface/Archetypes/Function.cs +++ b/Source/Editor/Surface/Archetypes/Function.cs @@ -54,9 +54,9 @@ namespace FlaxEditor.Surface.Archetypes protected abstract Asset LoadSignature(Guid id, out string[] types, out string[] names); /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); FlaxEngine.Content.AssetReloading += OnAssetReloading; FlaxEngine.Content.AssetDisposing += OnContentAssetDisposing; @@ -275,17 +275,17 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); _nameField.Text = SignatureName; } /// - public override void OnSpawned() + public override void OnSpawned(SurfaceNodeActions action) { - base.OnSpawned(); + base.OnSpawned(action); // Ensure to have unique name var name = SignatureName; @@ -397,9 +397,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); _outputBox = GetBox(0); _outputBox.CurrentType = SignatureType; @@ -466,9 +466,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); _inputBox = GetBox(0); _inputBox.CurrentType = SignatureType; @@ -634,18 +634,18 @@ namespace FlaxEditor.Surface.Archetypes protected override Color FooterColor => new Color(200, 11, 112); /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); Title = SurfaceUtils.GetMethodDisplayName((string)Values[0]); UpdateSignature(); } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); // Update the boxes connection types to match the signature // Do it after surface load so connections can receive update on type changes of the method parameter @@ -663,9 +663,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSpawned() + public override void OnSpawned(SurfaceNodeActions action) { - base.OnSpawned(); + base.OnSpawned(action); var method = GetMethod(); _parameters = null; @@ -999,9 +999,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSpawned() + public override void OnSpawned(SurfaceNodeActions action) { - base.OnSpawned(); + base.OnSpawned(action); var method = GetMethod(out _, out _, out var parameters); if (method && parameters != null) @@ -1028,18 +1028,18 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); Title = SurfaceUtils.GetMethodDisplayName((string)Values[1]); UpdateSignature(); } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); // Update the boxes connection types to match the signature // Do it after surface load so connections can receive update on type changes of the method parameter @@ -1182,9 +1182,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); UpdateSignature(); } @@ -1700,9 +1700,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); LoadSignature(); @@ -1715,9 +1715,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSpawned() + public override void OnSpawned(SurfaceNodeActions action) { - base.OnSpawned(); + base.OnSpawned(action); // Setup initial signature var defaultSignature = _signature.Node == null; @@ -1743,7 +1743,7 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnDeleted() + public override void OnDeleted(SurfaceNodeActions action) { // Send event for (int i = 0; i < Surface.Nodes.Count; i++) @@ -1752,7 +1752,7 @@ namespace FlaxEditor.Surface.Archetypes node.OnFunctionDeleted(this); } - base.OnDeleted(); + base.OnDeleted(action); } /// @@ -1906,9 +1906,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); Title = "Get " + SurfaceUtils.GetMethodDisplayName((string)Values[1]); UpdateSignature(); @@ -1959,9 +1959,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); Title = "Set " + SurfaceUtils.GetMethodDisplayName((string)Values[1]); UpdateSignature(); @@ -2135,9 +2135,9 @@ namespace FlaxEditor.Surface.Archetypes UpdateUI(); } - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); // Find reflection information about event _signature = null; @@ -2193,11 +2193,11 @@ namespace FlaxEditor.Surface.Archetypes { } - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { Title = "Bind " + (string)Values[1]; - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); } } @@ -2208,11 +2208,11 @@ namespace FlaxEditor.Surface.Archetypes { } - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { Title = "Unbind " + (string)Values[1]; - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); } } diff --git a/Source/Editor/Surface/Archetypes/Material.cs b/Source/Editor/Surface/Archetypes/Material.cs index 1a797c67d..b85d1c9d4 100644 --- a/Source/Editor/Surface/Archetypes/Material.cs +++ b/Source/Editor/Surface/Archetypes/Material.cs @@ -197,9 +197,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); // Fix emissive box (it's a strange error) GetBox(3).CurrentType = new ScriptType(typeof(Float3)); diff --git a/Source/Editor/Surface/Archetypes/Packing.cs b/Source/Editor/Surface/Archetypes/Packing.cs index 5a5e9cd5b..0abae2d0b 100644 --- a/Source/Editor/Surface/Archetypes/Packing.cs +++ b/Source/Editor/Surface/Archetypes/Packing.cs @@ -30,9 +30,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); _in0 = (InputBox)GetBox(0); _in1 = (InputBox)GetBox(1); @@ -111,9 +111,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); // Update title and the tooltip var typeName = (string)Values[0]; diff --git a/Source/Editor/Surface/Archetypes/Parameters.cs b/Source/Editor/Surface/Archetypes/Parameters.cs index c7f343cfb..59987f0aa 100644 --- a/Source/Editor/Surface/Archetypes/Parameters.cs +++ b/Source/Editor/Surface/Archetypes/Parameters.cs @@ -426,9 +426,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); if (Surface != null) { @@ -438,9 +438,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); UpdateTitle(); } @@ -832,9 +832,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); if (Surface != null) UpdateCombo(); @@ -842,9 +842,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); if (Surface != null) { diff --git a/Source/Editor/Surface/Archetypes/ParticleModules.cs b/Source/Editor/Surface/Archetypes/ParticleModules.cs index ad5b45eab..e5be3d35d 100644 --- a/Source/Editor/Surface/Archetypes/ParticleModules.cs +++ b/Source/Editor/Surface/Archetypes/ParticleModules.cs @@ -268,20 +268,20 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { _enabled.Checked = ModuleEnabled; _enabled.StateChanged += OnEnabledStateChanged; - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); ParticleSurface?.ArrangeModulesNodes(); } /// - public override void OnSpawned() + public override void OnSpawned(SurfaceNodeActions action) { - base.OnSpawned(); + base.OnSpawned(action); ParticleSurface.ArrangeModulesNodes(); } @@ -295,11 +295,11 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnDeleted() + public override void OnDeleted(SurfaceNodeActions action) { ParticleSurface.ArrangeModulesNodes(); - base.OnDeleted(); + base.OnDeleted(action); } /// @@ -324,9 +324,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); UpdateOutputBoxType(); } @@ -381,9 +381,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); UpdateInputBox(); } @@ -416,9 +416,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); UpdateTextBox(); } diff --git a/Source/Editor/Surface/Archetypes/Particles.cs b/Source/Editor/Surface/Archetypes/Particles.cs index dd861d4af..e49921bec 100644 --- a/Source/Editor/Surface/Archetypes/Particles.cs +++ b/Source/Editor/Surface/Archetypes/Particles.cs @@ -214,9 +214,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); if (Surface == null) return; @@ -265,9 +265,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); UpdateOutputBoxType(); } diff --git a/Source/Editor/Surface/Archetypes/Textures.cs b/Source/Editor/Surface/Archetypes/Textures.cs index 258bfd41a..18c21ecea 100644 --- a/Source/Editor/Surface/Archetypes/Textures.cs +++ b/Source/Editor/Surface/Archetypes/Textures.cs @@ -38,9 +38,9 @@ namespace FlaxEditor.Surface.Archetypes UpdateUI(); } - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); UpdateUI(); } diff --git a/Source/Editor/Surface/Archetypes/Tools.cs b/Source/Editor/Surface/Archetypes/Tools.cs index d6c5d8c30..ac7341cd6 100644 --- a/Source/Editor/Surface/Archetypes/Tools.cs +++ b/Source/Editor/Surface/Archetypes/Tools.cs @@ -193,9 +193,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); var upperLeft = GetBox(0).BottomLeft; var upperRight = GetBox(1).BottomRight; @@ -477,9 +477,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); var upperLeft = GetBox(0).BottomLeft; var upperRight = GetBox(1).BottomRight; @@ -657,9 +657,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); UpdateCombo(); } @@ -682,9 +682,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); var type = ScriptType.Null; if (Context.Surface is VisualScriptSurface visjectSurface) @@ -710,9 +710,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); UpdateOutputBox(); } @@ -763,9 +763,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); UpdateOutputBox(); } @@ -822,9 +822,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); if (Surface != null) _picker.ValueTypeName = (string)Values[0]; @@ -881,9 +881,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); if (Surface != null) _picker.ValueTypeName = (string)Values[0]; @@ -932,9 +932,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); if (Surface != null) _picker.ValueTypeName = (string)Values[0]; @@ -984,9 +984,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnLoaded() + public override void OnLoaded(SurfaceNodeActions action) { - base.OnLoaded(); + base.OnLoaded(action); if (Surface != null) _picker.ValueTypeName = (string)Values[0]; @@ -1047,9 +1047,9 @@ namespace FlaxEditor.Surface.Archetypes } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); _input = (InputBox)GetBox(0); _output = (OutputBox)GetBox(1); diff --git a/Source/Editor/Surface/SurfaceComment.cs b/Source/Editor/Surface/SurfaceComment.cs index 4256fa17f..ff38b1aa8 100644 --- a/Source/Editor/Surface/SurfaceComment.cs +++ b/Source/Editor/Surface/SurfaceComment.cs @@ -59,9 +59,9 @@ namespace FlaxEditor.Surface } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); // Read node data Title = TitleValue; @@ -70,9 +70,9 @@ namespace FlaxEditor.Surface } /// - public override void OnSpawned() + public override void OnSpawned(SurfaceNodeActions action) { - base.OnSpawned(); + base.OnSpawned(action); // Randomize color Color = ColorValue = Color.FromHSV(new Random().NextFloat(0, 360), 0.7f, 0.25f, 0.8f); diff --git a/Source/Editor/Surface/SurfaceControl.cs b/Source/Editor/Surface/SurfaceControl.cs index 8c207676c..56e2ee8f6 100644 --- a/Source/Editor/Surface/SurfaceControl.cs +++ b/Source/Editor/Surface/SurfaceControl.cs @@ -122,14 +122,14 @@ namespace FlaxEditor.Surface /// /// Called when control gets loaded and added to surface. /// - public virtual void OnLoaded() + public virtual void OnLoaded(SurfaceNodeActions action) { } /// /// Called when surface gets loaded and nodes boxes are connected. /// - public virtual void OnSurfaceLoaded() + public virtual void OnSurfaceLoaded(SurfaceNodeActions action) { UpdateRectangles(); } @@ -137,14 +137,14 @@ namespace FlaxEditor.Surface /// /// Called after adding the control to the surface after user spawn (eg. add comment, add new node, etc.). /// - public virtual void OnSpawned() + public virtual void OnSpawned(SurfaceNodeActions action) { } /// /// Called on removing the control from the surface after user delete/cut operation (eg. delete comment, cut node, etc.). /// - public virtual void OnDeleted() + public virtual void OnDeleted(SurfaceNodeActions action) { Dispose(); } diff --git a/Source/Editor/Surface/SurfaceNode.cs b/Source/Editor/Surface/SurfaceNode.cs index 1ebc1c1c5..4f628b6af 100644 --- a/Source/Editor/Surface/SurfaceNode.cs +++ b/Source/Editor/Surface/SurfaceNode.cs @@ -884,9 +884,9 @@ namespace FlaxEditor.Surface } /// - public override void OnSurfaceLoaded() + public override void OnSurfaceLoaded(SurfaceNodeActions action) { - base.OnSurfaceLoaded(); + base.OnSurfaceLoaded(action); UpdateBoxesTypes(); @@ -898,11 +898,11 @@ namespace FlaxEditor.Surface } /// - public override void OnDeleted() + public override void OnDeleted(SurfaceNodeActions action) { RemoveConnections(); - base.OnDeleted(); + base.OnDeleted(action); } /// diff --git a/Source/Editor/Surface/Undo/AddRemoveNodeAction.cs b/Source/Editor/Surface/Undo/AddRemoveNodeAction.cs index b529ea3c0..ba6770287 100644 --- a/Source/Editor/Surface/Undo/AddRemoveNodeAction.cs +++ b/Source/Editor/Surface/Undo/AddRemoveNodeAction.cs @@ -67,8 +67,8 @@ namespace FlaxEditor.Surface.Undo else if (_nodeValues != null && _nodeValues.Length != 0) throw new InvalidOperationException("Invalid node values."); node.Location = _nodeLocation; - context.OnControlLoaded(node); - node.OnSurfaceLoaded(); + context.OnControlLoaded(node, SurfaceNodeActions.Undo); + node.OnSurfaceLoaded(SurfaceNodeActions.Undo); context.MarkAsModified(); } @@ -89,7 +89,7 @@ namespace FlaxEditor.Surface.Undo // Remove node context.Nodes.Remove(node); - context.OnControlDeleted(node); + context.OnControlDeleted(node, SurfaceNodeActions.Undo); context.MarkAsModified(); } diff --git a/Source/Editor/Surface/VisjectSurface.CopyPaste.cs b/Source/Editor/Surface/VisjectSurface.CopyPaste.cs index 7df90f298..fd27315e6 100644 --- a/Source/Editor/Surface/VisjectSurface.CopyPaste.cs +++ b/Source/Editor/Surface/VisjectSurface.CopyPaste.cs @@ -373,7 +373,7 @@ namespace FlaxEditor.Surface } } - Context.OnControlLoaded(node); + Context.OnControlLoaded(node, SurfaceNodeActions.Paste); } // Setup connections @@ -413,11 +413,11 @@ namespace FlaxEditor.Surface // Post load foreach (var node in nodes) { - node.Value.OnSurfaceLoaded(); + node.Value.OnSurfaceLoaded(SurfaceNodeActions.Paste); } foreach (var node in nodes) { - node.Value.OnSpawned(); + node.Value.OnSpawned(SurfaceNodeActions.Paste); } // Add undo action diff --git a/Source/Editor/Surface/VisjectSurface.cs b/Source/Editor/Surface/VisjectSurface.cs index 012d98778..2b965dfbb 100644 --- a/Source/Editor/Surface/VisjectSurface.cs +++ b/Source/Editor/Surface/VisjectSurface.cs @@ -772,7 +772,7 @@ namespace FlaxEditor.Surface } else { - Context.OnControlDeleted(control); + Context.OnControlDeleted(control, SurfaceNodeActions.User); } } if (selectionChanged) @@ -787,7 +787,7 @@ namespace FlaxEditor.Surface { node.RemoveConnections(); Nodes.Remove(node); - Context.OnControlDeleted(node); + Context.OnControlDeleted(node, SurfaceNodeActions.User); } } else diff --git a/Source/Editor/Surface/VisjectSurfaceContext.Serialization.cs b/Source/Editor/Surface/VisjectSurfaceContext.Serialization.cs index f2059c581..7d75e006b 100644 --- a/Source/Editor/Surface/VisjectSurfaceContext.Serialization.cs +++ b/Source/Editor/Surface/VisjectSurfaceContext.Serialization.cs @@ -13,6 +13,32 @@ using Utils = FlaxEditor.Utilities.Utils; namespace FlaxEditor.Surface { + /// + /// Types of surface actions. + /// + public enum SurfaceNodeActions + { + /// + /// Node has been created by surface load. + /// + Load, + + /// + /// Node has been created/deleted by user action. + /// + User, + + /// + /// Node has been created/deleted via undo. + /// + Undo, + + /// + /// Node has been pasted. + /// + Paste, + } + /// /// The missing node. Cached the node group, type and stored values information. /// @@ -135,7 +161,7 @@ namespace FlaxEditor.Surface if (comment == null) throw new InvalidOperationException("Failed to create comment."); - OnControlLoaded(comment); + OnControlLoaded(comment, SurfaceNodeActions.Load); } } } @@ -144,7 +170,7 @@ namespace FlaxEditor.Surface for (int i = 0; i < RootControl.Children.Count; i++) { if (RootControl.Children[i] is SurfaceControl control) - control.OnSurfaceLoaded(); + control.OnSurfaceLoaded(SurfaceNodeActions.Load); } RootControl.UnlockChildrenRecursive(); @@ -650,7 +676,7 @@ namespace FlaxEditor.Surface // Meta node.Meta.Load(stream); - OnControlLoaded(node); + OnControlLoaded(node, SurfaceNodeActions.Load); } } else if (version == 7000) @@ -813,7 +839,7 @@ namespace FlaxEditor.Surface // Meta node.Meta.Load(stream); - OnControlLoaded(node); + OnControlLoaded(node, SurfaceNodeActions.Load); } } else @@ -856,9 +882,10 @@ namespace FlaxEditor.Surface /// Called when control gets added to the surface as spawn operation (eg. add new comment or add new node). /// /// The control. - public virtual void OnControlSpawned(SurfaceControl control) + /// The action node. + public virtual void OnControlSpawned(SurfaceControl control, SurfaceNodeActions action) { - control.OnSpawned(); + control.OnSpawned(action); ControlSpawned?.Invoke(control); if (Surface != null && control is SurfaceNode node) Surface.OnNodeSpawned(node); @@ -868,10 +895,11 @@ namespace FlaxEditor.Surface /// Called when control gets removed from the surface as delete/cut operation (eg. remove comment or cut node). /// /// The control. - public virtual void OnControlDeleted(SurfaceControl control) + /// The action node. + public virtual void OnControlDeleted(SurfaceControl control, SurfaceNodeActions action) { ControlDeleted?.Invoke(control); - control.OnDeleted(); + control.OnDeleted(action); if (control is SurfaceNode node) Surface.OnNodeDeleted(node); } @@ -880,16 +908,17 @@ namespace FlaxEditor.Surface /// Called when control gets loaded and should be added to the surface. Handles surface nodes initialization. /// /// The control. - public virtual void OnControlLoaded(SurfaceControl control) + /// The action node. + public virtual void OnControlLoaded(SurfaceControl control, SurfaceNodeActions action) { if (control is SurfaceNode node) { // Initialize node - OnNodeLoaded(node); + OnNodeLoaded(node, action); } // Link control - control.OnLoaded(); + control.OnLoaded(action); control.Parent = RootControl; if (control is SurfaceComment) @@ -903,7 +932,8 @@ namespace FlaxEditor.Surface /// Called when node gets loaded and should be added to the surface. Creates node elements from the archetype. /// /// The node. - public virtual void OnNodeLoaded(SurfaceNode node) + /// The action node. + public virtual void OnNodeLoaded(SurfaceNode node, SurfaceNodeActions action) { // Create child elements of the node based on it's archetype int elementsCount = node.Archetype.Elements?.Length ?? 0; diff --git a/Source/Editor/Surface/VisjectSurfaceContext.cs b/Source/Editor/Surface/VisjectSurfaceContext.cs index 1c8754325..36e811c48 100644 --- a/Source/Editor/Surface/VisjectSurfaceContext.cs +++ b/Source/Editor/Surface/VisjectSurfaceContext.cs @@ -315,9 +315,9 @@ namespace FlaxEditor.Surface } // Initialize - OnControlLoaded(comment); - comment.OnSurfaceLoaded(); - OnControlSpawned(comment); + OnControlLoaded(comment, SurfaceNodeActions.User); + comment.OnSurfaceLoaded(SurfaceNodeActions.User); + OnControlSpawned(comment, SurfaceNodeActions.User); MarkAsModified(); @@ -389,10 +389,10 @@ namespace FlaxEditor.Surface throw new InvalidOperationException("Invalid node custom values."); } node.Location = location; - OnControlLoaded(node); + OnControlLoaded(node, SurfaceNodeActions.User); beforeSpawned?.Invoke(node); - node.OnSurfaceLoaded(); - OnControlSpawned(node); + node.OnSurfaceLoaded(SurfaceNodeActions.User); + OnControlSpawned(node, SurfaceNodeActions.User); // Undo action if (Surface != null) diff --git a/Source/Editor/Windows/AssetReferencesGraphWindow.cs b/Source/Editor/Windows/AssetReferencesGraphWindow.cs index de5b86f96..d49896e2e 100644 --- a/Source/Editor/Windows/AssetReferencesGraphWindow.cs +++ b/Source/Editor/Windows/AssetReferencesGraphWindow.cs @@ -127,9 +127,9 @@ namespace FlaxEditor.Windows Nodes.AddRange(nodes); foreach (var node in nodes) { - Context.OnControlLoaded(node); - node.OnSurfaceLoaded(); - Context.OnControlSpawned(node); + Context.OnControlLoaded(node, SurfaceNodeActions.Load); + node.OnSurfaceLoaded(SurfaceNodeActions.Load); + Context.OnControlSpawned(node, SurfaceNodeActions.Load); } ShowWholeGraph(); UnlockChildrenRecursive();