diff --git a/Source/Editor/Surface/Archetypes/Parameters.cs b/Source/Editor/Surface/Archetypes/Parameters.cs
index 5401ba840..f30a33090 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 System.Linq;
namespace FlaxEditor.Surface.Archetypes
{
@@ -425,6 +426,20 @@ namespace FlaxEditor.Surface.Archetypes
UpdateCombo();
}
+ ///
+ public bool IsParameterReferenced(SurfaceParameter param, VisjectSurface surface)
+ {
+ for (int i = 0; i < surface.Nodes.Count; i++)
+ {
+ if (surface.Nodes[i] is IParametersDependantNode node)
+ {
+ return (Guid)surface.Nodes[i].Values[0] == param.ID && surface.Nodes[i].GetBoxes().Any(b => b.Connections.Count > 0);
+ }
+ }
+
+ return false;
+ }
+
///
public override void OnLoaded(SurfaceNodeActions action)
{
@@ -942,6 +957,20 @@ namespace FlaxEditor.Surface.Archetypes
UpdateCombo();
}
+ ///
+ public bool IsParameterReferenced(SurfaceParameter param, VisjectSurface surface)
+ {
+ for (int i = 0; i < surface.Nodes.Count; i++)
+ {
+ if (surface.Nodes[i] is IParametersDependantNode node)
+ {
+ return (Guid)surface.Nodes[i].Values[0] == param.ID && surface.Nodes[i].GetBoxes().Any(b => b.Connections.Count > 0);
+ }
+ }
+
+ return false;
+ }
+
///
public override void OnLoaded(SurfaceNodeActions action)
{
diff --git a/Source/Editor/Surface/IParametersDependantNode.cs b/Source/Editor/Surface/IParametersDependantNode.cs
index 9683abd70..c424454d5 100644
--- a/Source/Editor/Surface/IParametersDependantNode.cs
+++ b/Source/Editor/Surface/IParametersDependantNode.cs
@@ -33,5 +33,13 @@ namespace FlaxEditor.Surface
///
/// The parameter.
void OnParamDeleted(SurfaceParameter param);
+
+ ///
+ /// Get if the parameter is referenced in a graph. Referenced in this case means in a graph and at least one node in-/output connected to another node.
+ ///
+ /// The parameter.
+ /// /// The visject surface.
+ /// How often the parameter is referenced.
+ bool IsParameterReferenced(SurfaceParameter param, VisjectSurface surface);
}
}
diff --git a/Source/Editor/Surface/VisjectSurfaceWindow.cs b/Source/Editor/Surface/VisjectSurfaceWindow.cs
index 57ec0d2c9..7c653a823 100644
--- a/Source/Editor/Surface/VisjectSurfaceWindow.cs
+++ b/Source/Editor/Surface/VisjectSurfaceWindow.cs
@@ -788,7 +788,7 @@ namespace FlaxEditor.Surface
{
if (nodes[i] is IParametersDependantNode node)
{
- if (displayWarning && (Guid)nodes[i].Values[0] == param.ID && nodes[i].GetBoxes().Any(b => b.Connections.Count > 0))
+ if (displayWarning && node.IsParameterReferenced(param, window.VisjectSurface))
connectedParameterNodeCount++;
}
}