From 296c49d9048cd074037760af7f19c58ad8261c4b Mon Sep 17 00:00:00 2001 From: Thor Brigsted Date: Sun, 19 Apr 2020 20:40:37 +0200 Subject: [PATCH] Added reroute support --- Editor/NodeGroupEditor.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Editor/NodeGroupEditor.cs b/Editor/NodeGroupEditor.cs index 6a9df8f..8561807 100644 --- a/Editor/NodeGroupEditor.cs +++ b/Editor/NodeGroupEditor.cs @@ -42,7 +42,27 @@ namespace XNodeEditor.NodeGroups { // Select nodes inside the group if (Selection.Contains(target)) { List selection = Selection.objects.ToList(); + // Select Nodes selection.AddRange(group.GetNodes()); + // Select Reroutes + foreach (Node node in target.graph.nodes) { + foreach (NodePort port in node.Ports) { + for (int i = 0; i < port.ConnectionCount; i++) { + List reroutes = port.GetReroutePoints(i); + for (int k = 0; k < reroutes.Count; k++) { + Vector2 p = reroutes[k]; + if (p.x < group.position.x) continue; + if (p.y < group.position.y) continue; + if (p.x > group.position.x + group.width) continue; + if (p.y > group.position.y + group.height + 30) continue; + if (NodeEditorWindow.current.selectedReroutes.Any(x => x.port == port && x.connectionIndex == i && x.pointIndex == k)) continue; + NodeEditorWindow.current.selectedReroutes.Add( + new Internal.RerouteReference(port, i, k) + ); + } + } + } + } Selection.objects = selection.Distinct().ToArray(); } break;