/* * Creates tree entries for a given node and its children * */ private void CreateSubTree(VTKNode n, int space) { //Change color of the node if it is the selected one if (script.activeNode == n) { treeNodeStyle.normal.textColor = Color.green; } EditorGUILayout.BeginHorizontal(); GUILayout.Space(space); if (GUILayout.Button(n.name, treeNodeStyle)) { script.SetActiveNode(n); } GameObject go = script.FindGameObject(VTK.GetGameObjectName(n)); if (go != null) { ControllerGameObject cgo = go.GetComponent <ControllerGameObject>(); if (cgo != null) { cgo.showGameObject = EditorGUILayout.Toggle(cgo.showGameObject); if (cgo.showGameObject) { go.renderer.enabled = true; } else { go.renderer.enabled = false; } } } EditorGUILayout.EndHorizontal(); //Reset color for other nodes if (script.activeNode == n) { treeNodeStyle.normal.textColor = Color.black; } //Show children if (n.hasChildren) { for (int i = 0; i < n.children.Count; i++) { CreateSubTree(n.children[i], space + 20); } } }