mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 08:18:49 -05:00
Rework TableList drawer
This commit is contained in:
parent
e02acee95d
commit
38b7dc062a
@ -5,6 +5,7 @@ using TriInspector;
|
||||
using TriInspector.Drawers;
|
||||
using TriInspector.Elements;
|
||||
using TriInspector.Utilities;
|
||||
using UnityEditor;
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
using UnityEngine;
|
||||
|
||||
@ -112,7 +113,11 @@ namespace TriInspector.Drawers
|
||||
|
||||
foreach (var cellValueProperty in tableItem.Property.ChildrenProperties)
|
||||
{
|
||||
var cellIndex = _cellIndexByName[cellValueProperty.RawName];
|
||||
if (!_cellIndexByName.TryGetValue(cellValueProperty.RawName, out var cellIndex))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var cellRect = args.GetCellRect(cellIndex);
|
||||
|
||||
if (!_cellElements.ContainsKey(cellValueProperty))
|
||||
@ -131,14 +136,12 @@ namespace TriInspector.Drawers
|
||||
|
||||
private static MultiColumnHeader BuildHeader(TriProperty property)
|
||||
{
|
||||
var columns = property
|
||||
.ArrayElementProperties
|
||||
.SelectMany(it => it.ChildrenProperties)
|
||||
.GroupBy(it => it.RawName)
|
||||
.Select(it => it.First())
|
||||
var columns = TriTypeDefinition
|
||||
.GetCached(property.ArrayElementType)
|
||||
.Properties
|
||||
.Select(it => new MultiColumnHeaderState.Column
|
||||
{
|
||||
headerContent = it.DisplayNameContent,
|
||||
headerContent = new GUIContent(ObjectNames.NicifyVariableName(it.Name)),
|
||||
autoResize = true,
|
||||
canSort = false,
|
||||
allowToggleVisibility = false,
|
||||
|
@ -9,7 +9,7 @@ using UnityEngine;
|
||||
|
||||
namespace TriInspector
|
||||
{
|
||||
internal class TriPropertyDefinition
|
||||
public class TriPropertyDefinition
|
||||
{
|
||||
private readonly Func<TriProperty, object, object> _valueGetter;
|
||||
[CanBeNull] private readonly Action<TriProperty, object, object> _valueSetter;
|
||||
|
@ -6,7 +6,7 @@ using TriInspector.Utilities;
|
||||
|
||||
namespace TriInspector
|
||||
{
|
||||
internal class TriTypeDefinition
|
||||
public class TriTypeDefinition
|
||||
{
|
||||
private static readonly Dictionary<Type, TriTypeDefinition> Cache =
|
||||
new Dictionary<Type, TriTypeDefinition>();
|
||||
|
Loading…
Reference in New Issue
Block a user