void OnGUI() { if (state == null) { state = new TreeViewState(); } if (entries == null) { entries = new List <UsageTreeEntry>(); } if (tree == null) { tree = new UsageTree(state, entries, rowHeight); } EditorGUILayout.BeginHorizontal(); tree.searchString = EditorGUILayout.TextField(tree.searchString); EditorGUI.BeginChangeCheck(); rowHeight = GUILayout.HorizontalSlider(rowHeight, 16, 80, GUILayout.Width(64)); if (EditorGUI.EndChangeCheck()) { tree.SetRowHeight(rowHeight); } EditorGUILayout.EndHorizontal(); tree.OnGUI(new Rect(0, 20, position.width, position.height)); }
void Init(IEnumerable <SearchNode <string> > search) { state = null; entries = new List <UsageTreeEntry>(search.Select(node => new UsageTreeEntry { AssetId = node.Value, Parent = node.Parent?.Index ?? -1, Depth = node.Depth })); tree = null; }