private void DisplayItem(BuildTreeViewItem item, int c, Rect rc) { BuildManagerTreeState.Columns column = (BuildManagerTreeState.Columns)c; var props = item.BuildInstructions; EditorGUI.BeginChangeCheck(); switch (column) { case BuildManagerTreeState.Columns.BuildConfiguration: var pipeline = props.BuildConfiguration.GetBuildPipeline(); if (GUI.Button(rc, props.BuildConfiguration.name + " with " + pipeline.GetType().Name, Styles.buildConfigurationButton)) { EditorGUIUtility.PingObject(props.BuildConfiguration); } break; case BuildManagerTreeState.Columns.Build: props.Build = EditorGUI.Toggle(rc, props.Build); break; case BuildManagerTreeState.Columns.Run: props.Run = EditorGUI.Toggle(rc, props.Run); break; } if (EditorGUI.EndChangeCheck()) { this.SetSelection(new List <int>(new[] { props.BuildConfiguration.GetInstanceID() })); } }
protected override IList <TreeViewItem> BuildRows(TreeViewItem root) { var tempRoot = new BuildTreeViewItem(-1); var data = m_DataCallback(); foreach (var d in data) { tempRoot.AddChild(d); } var items = new List <TreeViewItem>(); AddChildrenRecursive(tempRoot, -1, items); SetupParentsAndChildrenFromDepths(root, items); return(items); }
void AddChildrenRecursive(TreeViewItem parent, int depth, IList <TreeViewItem> newRows) { if (parent == null || !parent.hasChildren) { return; } foreach (BuildTreeViewItem child in parent.children) { var item = new BuildTreeViewItem(child.depth, child.BuildInstructions); newRows.Add(child); if (child.hasChildren) { if (IsExpanded(child.id)) { AddChildrenRecursive(child, depth + 1, newRows); } else { item.children = CreateChildListForCollapsedParent(); } } } }