1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 09:16:01 +08:00

optimized linq function

This commit is contained in:
Simon Rodriguez 2019-11-13 01:14:09 +01:00
parent 71023e1d58
commit ec9c5a99de

View File

@ -372,6 +372,8 @@ namespace XNodeEditor {
//Save guiColor so we can revert it
Color guiColor = GUI.color;
List<XNode.NodePort> removeEntries = new List<XNode.NodePort>();
if (e.type == EventType.Layout) culledNodes = new List<XNode.Node>();
for (int n = 0; n < graph.nodes.Count; n++) {
// Skip null nodes. The user could be in the process of renaming scripts, so removing them at this point is not advisable.
@ -389,7 +391,10 @@ namespace XNodeEditor {
} else if (culledNodes.Contains(node)) continue;
if (e.type == EventType.Repaint) {
_portConnectionPoints = _portConnectionPoints.Where(x => x.Key.node != node).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
removeEntries.Clear();
foreach (var kvp in _portConnectionPoints)
if (kvp.Key.node == node) removeEntries.Add(kvp.Key);
foreach (var k in removeEntries) _portConnectionPoints.Remove(k);
}
NodeEditor nodeEditor = NodeEditor.GetEditor(node, this);