//Return child Scene node View if it equal argument scene node public SceneNodeView FindNodeInChildren(SceneNodeView item) { SceneNodeView output = null; if (this.node == item.node.parent) { output = this; } else { foreach (SceneNodeView child in this.children.ToList()) { if (child.node == item.node.parent) { output = child; } else { if (child.children.Count > 0) { output = child.FindNodeInChildren(item); } } } } return(output); }
public VRConfig() { clusterNodes = new List <ClusterNode>(); viewports = new List <Viewport>(); sceneNodes = new List <SceneNode>(); sceneNodes = new List <SceneNode>(); sceneNodesView = ConvertSceneNodeList(sceneNodes); screens = new List <Screen>(); inputs = new List <BaseInput>(); selectedSceneNodeView = new SceneNodeView(new SceneNode { id = string.Empty, locationX = string.Empty, locationY = string.Empty, locationZ = string.Empty, rotationP = string.Empty, rotationY = string.Empty, rotationR = string.Empty, tracker = new TrackerInput(), trackerCh = string.Empty, parent = null }); cameraLocationX = "0"; cameraLocationY = "0"; cameraLocationZ = "0"; cameraTracker = null; cameraTrackerCh = "0"; //Stereo settings eyeDist = "0.064"; eyeSwap = false; //Debug settings lagSimulation = false; lagMaxTime = "0"; drawStats = false; //Master node settings portCs = "00001"; portSs = "00000"; //General settings string defaultSwapSync = "1"; if (swapSyncPolicy.ContainsKey(defaultSwapSync)) { selectedSwapSync = swapSyncPolicy.FirstOrDefault(x => x.Key == defaultSwapSync); } }
public SceneNodeView FindParentNode(SceneNodeView item) { SceneNodeView parentNode = sceneNodesView.Find(x => x.node == item.node.parent); if (parentNode == null) { foreach (SceneNodeView node in sceneNodesView) { if (node.FindNodeInChildren(item) != null) { parentNode = node.FindNodeInChildren(item); } } } return(parentNode); }
public void DeleteSceneNode(SceneNodeView item) { if (item.children != null) { foreach (SceneNodeView child in item.children.ToList()) { DeleteSceneNode(child); } } if (item.node.parent == null) { sceneNodesView.Remove(item); } else { SceneNodeView parentNode = FindParentNode(item); if (parentNode != null) { parentNode.children.Remove(item); } } AppLogger.Add("Scene node " + item.node.id + " deleted"); sceneNodes.Remove(item.node); }