1
0
mirror of https://github.com/Siccity/xNodeGroups.git synced 2025-12-20 01:06:02 +08:00

Merge pull request #7 from RomanZanevski/patch-2

Connection point fix addition
This commit is contained in:
Thor Brigsted 2022-03-25 08:19:33 +01:00 committed by GitHub
commit b76baaddaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,22 +46,29 @@ namespace XNodeEditor.NodeGroups {
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<Vector2> 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)
);
if (node != null)
{
foreach (NodePort port in node.Ports) {
for (int i = 0; i < port.ConnectionCount; i++) {
List<Vector2> 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)
);
}
}
}
}
else
{
continue;
}
}
Selection.objects = selection.Distinct().ToArray();
}