private void AddInfoList(TreeViewItem rootItem, IEnumerable <IEditorTableItemInfo> list) { if (list != null) { foreach (var info in list) { var child = new EditorTableItem(info, rootItem.depth + 1); child.icon = info.assetIcon; rootItem.AddChild(child); if (info.children != null && info.children.Count > 0) { AddInfoList(child, info.children); } } } }
private void CellGUI(Rect cellRect, EditorTableItem item, int column, ref RowGUIArgs args) { CenterRectUsingSingleLineHeight(ref cellRect); if (column == 0) { if (item.Info.itemSelected) { var iconRect = new Rect(cellRect.x + 1, cellRect.y + 1, cellRect.height - 2, cellRect.height - 2); GUI.DrawTexture(iconRect, Styles.selected, ScaleMode.ScaleToFit); cellRect.x += cellRect.height - 2; } if (item.hasChildren || item.depth > 0) { cellRect.x += 16; } if (item.depth > 0) { cellRect.x += 14 * item.depth; } if (showIcon) { var iconRect = new Rect(cellRect.x + 1, cellRect.y + 1, cellRect.height - 2, cellRect.height - 2); if (item.icon != null) { GUI.DrawTexture(iconRect, item.icon, ScaleMode.ScaleToFit); } cellRect = new Rect(cellRect.x + iconRect.width + 1, cellRect.y, cellRect.width - iconRect.width, cellRect.height); } using (new EditorGUI.DisabledGroupScope(item.Info.itemDisabled)) { DefaultGUI.Label(cellRect, item.Info.GetColumnString(column), args.selected, args.focused); } } else { DefaultGUI.Label(cellRect, item.Info.GetColumnString(column), args.selected, args.focused); } }