diff --git a/Source/Editor/Surface/SurfaceNode.cs b/Source/Editor/Surface/SurfaceNode.cs
index 5dedd604f..97ecab1d0 100644
--- a/Source/Editor/Surface/SurfaceNode.cs
+++ b/Source/Editor/Surface/SurfaceNode.cs
@@ -40,6 +40,11 @@ namespace FlaxEditor.Surface
[HideInEditor]
public class SurfaceNode : SurfaceControl
{
+ ///
+ /// The box to draw a highlight around. Drawing will be skipped if null.
+ ///
+ internal Box highlightBox;
+
///
/// Flag used to discard node values setting during event sending for node UI flushing.
///
@@ -1102,6 +1107,9 @@ namespace FlaxEditor.Surface
Render2D.DrawSprite(icon, new Rectangle(-7, -7, 16, 16), new Color(0.9f, 0.9f, 0.9f));
Render2D.DrawSprite(icon, new Rectangle(-6, -6, 14, 14), new Color(0.894117647f, 0.0784313725f, 0.0f));
}
+
+ if (highlightBox != null)
+ Render2D.DrawRectangle(highlightBox.Bounds, style.BorderHighlighted, 2f);
}
///
diff --git a/Source/Editor/Surface/VisjectSurface.ContextMenu.cs b/Source/Editor/Surface/VisjectSurface.ContextMenu.cs
index 84055aaf0..b1af9589b 100644
--- a/Source/Editor/Surface/VisjectSurface.ContextMenu.cs
+++ b/Source/Editor/Surface/VisjectSurface.ContextMenu.cs
@@ -427,7 +427,7 @@ namespace FlaxEditor.Surface
_cmDistributeNodesHorizontallyButton = _cmFormatNodesMenu.ContextMenu.AddButton("Distribute horizontally", Editor.Instance.Options.Options.Input.NodesDistributeHorizontal, () => { DistributeNodes(SelectedNodes, false); });
_cmDistributeNodesVerticallyButton = _cmFormatNodesMenu.ContextMenu.AddButton("Distribute vertically", Editor.Instance.Options.Options.Input.NodesDistributeVertical, () => { DistributeNodes(SelectedNodes, true); });
- _cmRemoveNodeConnectionsButton = menu.AddButton("Remove all connections to that node(s)", () =>
+ _cmRemoveNodeConnectionsButton = menu.AddButton("Remove all connections", () =>
{
var nodes = ((List)menu.Tag);
@@ -453,8 +453,10 @@ namespace FlaxEditor.Surface
MarkAsEdited();
});
- _cmRemoveNodeConnectionsButton.Enabled = CanEdit;
- _cmRemoveBoxConnectionsButton = menu.AddButton("Remove all connections to that box", () =>
+ bool anyConnection = SelectedNodes.Any(n => n.GetBoxes().Any(b => b.HasAnyConnection));
+ _cmRemoveNodeConnectionsButton.Enabled = CanEdit && anyConnection;
+
+ _cmRemoveBoxConnectionsButton = menu.AddButton("Remove all socket connections", () =>
{
var boxUnderMouse = (Box)_cmRemoveBoxConnectionsButton.Tag;
if (Undo != null)
@@ -475,6 +477,16 @@ namespace FlaxEditor.Surface
var boxUnderMouse = GetChildAtRecursive(location) as Box;
_cmRemoveBoxConnectionsButton.Enabled = boxUnderMouse != null && boxUnderMouse.HasAnyConnection;
_cmRemoveBoxConnectionsButton.Tag = boxUnderMouse;
+
+ if (boxUnderMouse != null)
+ {
+ boxUnderMouse.ParentNode.highlightBox = boxUnderMouse;
+ menu.VisibleChanged += (c) =>
+ {
+ if (!c.Visible)
+ boxUnderMouse.ParentNode.highlightBox = null;
+ };
+ }
}
controlUnderMouse?.OnShowSecondaryContextMenu(menu, controlUnderMouse.PointFromParent(location));