private void PopulateConnections(GUIGenericMenu contextMenu) { SceneNodeCollection nodes = SerializedManager.SceneNodes; List <TransitionConnector> madeTransitions = new List <TransitionConnector>(); foreach (SceneNode node in nodes.SceneNodes) { foreach (SceneTransition transition in node.SceneInfo.Transitions) { TransitionConnector existingOut = madeTransitions.Find((x) => { return(((SceneNode)x.GetStartNode()).SceneId == node.SceneId && ((SceneNode)x.GetEndNode()).SceneId == transition.DestinationSceneId); }); if (existingOut != null) { existingOut.ConnectionCount++; continue; } TransitionConnector existingIn = madeTransitions.Find((x) => { return(((SceneNode)x.GetStartNode()).SceneId == transition.DestinationSceneId && ((SceneNode)x.GetEndNode()).SceneId == node.SceneId); }); TransitionConnector newConnection = new TransitionConnector(); newConnection.ContextMenu = contextMenu; newConnection.AddNode(node); if (node.SceneId == transition.DestinationSceneId) { AddSelfTransitionNodes(newConnection, node); } newConnection.AddNode(nodes.SceneNodes.Find((x) => x.SceneId == transition.DestinationSceneId)); if (existingIn != null) { newConnection.ShiftOver = true; existingIn.ShiftOver = true; } NodeEditor.AddConnector(newConnection); madeTransitions.Add(newConnection); } } }