public void PreloadNode(VTKNode node) { Debug.Log("Preload data for " + node.name); string objectName = VTK.GetGameObjectName(node); //Set filter if (node.isRoot) { if (dataType == VTK.DataType.PolyData) { polyDataReader = vtkXMLPolyDataReader.New(); polyDataReader.SetFileName(filepath); polyDataReader.Update(); node.filter.vtkFilter = polyDataReader; node.filter.outputType = VTK.DataType.PolyData; } if (dataType == VTK.DataType.UnstructuredGrid) { unstructuredGridReader = vtkXMLUnstructuredGridReader.New(); unstructuredGridReader.SetFileName(filepath); unstructuredGridReader.Update(); node.filter.vtkFilter = unstructuredGridReader; node.filter.outputType = VTK.DataType.UnstructuredGrid; } } else { node.filter.node = node; node.filter.UpdateInput(); node.filter.SetPlaymodeParameters(); } //Set properties node.properties.node = node; node.properties.SetPlaymodeParameters(); node.properties.Read(); //Set vtkToUnity VtkToUnity vtu; if (gameObjects.TryGetValue(objectName, out vtu)) { gameObjects.Set(objectName, new VtkToUnity(node.filter.vtkFilter.GetOutputPort(), FindGameObject(objectName))); node.UpdateProperties(); //Some filters need stuff from properties } //Set controller script ControllerGameObject cg = node.filter.gameObject.GetComponent <ControllerGameObject>(); if (cg != null) { cg.node = node; cg.Initialize(); } //Do it for the kids if (node.hasChildren) { foreach (VTKNode child in node.children) { //Set parent reference child.parent = node; PreloadNode(child); } } }
public void PreloadNode(VTKNode node) { Debug.Log ("Preload data for " + node.name); string objectName = VTK.GetGameObjectName(node); //Set filter if(node.isRoot) { if(dataType == VTK.DataType.PolyData) { polyDataReader = vtkXMLPolyDataReader.New (); polyDataReader.SetFileName(filepath); polyDataReader.Update(); node.filter.vtkFilter = polyDataReader; node.filter.outputType = VTK.DataType.PolyData; } if(dataType == VTK.DataType.UnstructuredGrid) { unstructuredGridReader = vtkXMLUnstructuredGridReader.New(); unstructuredGridReader.SetFileName(filepath); unstructuredGridReader.Update(); node.filter.vtkFilter = unstructuredGridReader; node.filter.outputType = VTK.DataType.UnstructuredGrid; } } else { node.filter.node = node; node.filter.UpdateInput(); node.filter.SetPlaymodeParameters(); } //Set properties node.properties.node = node; node.properties.SetPlaymodeParameters(); node.properties.Read (); //Set vtkToUnity VtkToUnity vtu; if(gameObjects.TryGetValue (objectName, out vtu)) { gameObjects.Set(objectName, new VtkToUnity(node.filter.vtkFilter.GetOutputPort(), FindGameObject(objectName))); node.UpdateProperties(); //Some filters need stuff from properties } //Set controller script ControllerGameObject cg = node.filter.gameObject.GetComponent<ControllerGameObject>(); if(cg != null) { cg.node = node; cg.Initialize(); } //Do it for the kids if(node.hasChildren) { foreach (VTKNode child in node.children) { //Set parent reference child.parent = node; PreloadNode(child); } } }
public void UpdateInput() { ValidateInput(); node.UpdateProperties(); }