protected override float GetCustomRowHeight(int row, TreeViewItem item) { float maxHeight = 0; if ((ShowParams.HasFlag(ShowParameters.Active) && IsSelected(item.id)) || ShowParams.HasFlag(ShowParameters.All)) { maxHeight = TypeDependantDrawer.GetTotalHeightOfProperties((item as TreeViewItem <BehaviorTreeElement>).data); } return(Math.Max(20f, maxHeight)); }
void CellGUI(Rect cellRect, TreeViewItem <BehaviorTreeElement> item, BTreeColumns column, ref RowGUIArgs args) { // Center cell rect vertically (makes it easier to place controls, icons etc in the cells) switch (column) { case BTreeColumns.State: CenterRectUsingSingleLineHeight(ref cellRect); //EditorGUI.DrawRect(cellRect, GetBehaviorStateColor((int)item.data.CurrentState)); break; case BTreeColumns.Name: // Do toggle CenterRectUsingSingleLineHeight(ref cellRect); Rect toggleRect = cellRect; toggleRect.x += GetContentIndent(item); toggleRect.width = kToggleWidth; // Default icon and label args.rowRect = cellRect; base.RowGUI(args); break; case BTreeColumns.Parameters: switch (ShowParams) { case ShowParameters.Active: if (IsSelected(item.id)) { cellRect.height = TypeDependantDrawer.GetTotalHeightOfProperties(item.data); TypeDependantDrawer.DrawAllFields(item.data, cellRect); } break; case ShowParameters.All: cellRect.height = TypeDependantDrawer.GetTotalHeightOfProperties(item.data); TypeDependantDrawer.DrawAllFields(item.data, cellRect); break; default: break; } args.rowRect = cellRect; break; } }