mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 08:18:49 -05:00
Rework drawer target
This commit is contained in:
parent
bfaf46f661
commit
2e2bacb490
@ -4,8 +4,7 @@ using TriInspector;
|
|||||||
using TriInspector.Drawers;
|
using TriInspector.Drawers;
|
||||||
using TriInspector.Elements;
|
using TriInspector.Elements;
|
||||||
|
|
||||||
[assembly: RegisterTriAttributeDrawer(typeof(ShowDrawerChainDrawer), TriDrawerOrder.System,
|
[assembly: RegisterTriAttributeDrawer(typeof(ShowDrawerChainDrawer), TriDrawerOrder.System)]
|
||||||
Target = TriTargetPropertyType.SelfAndArrayElements)]
|
|
||||||
|
|
||||||
namespace TriInspector.Drawers
|
namespace TriInspector.Drawers
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace TriInspector
|
|||||||
|
|
||||||
public Type DrawerType { get; }
|
public Type DrawerType { get; }
|
||||||
public int Order { get; }
|
public int Order { get; }
|
||||||
public TriTargetPropertyType Target { get; set; } = TriTargetPropertyType.SelfAndArrayElements;
|
public TriTargetPropertyType Target { get; set; } = TriTargetPropertyType.Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
|
@ -17,8 +17,8 @@ namespace TriInspector.Elements
|
|||||||
var drawers = property.AllDrawers;
|
var drawers = property.AllDrawers;
|
||||||
for (var index = drawers.Count - 1; index >= 0; index--)
|
for (var index = drawers.Count - 1; index >= 0; index--)
|
||||||
{
|
{
|
||||||
if (_property.IsArrayElement && (drawers[index].Target & TriTargetPropertyType.ArrayElements) == 0 ||
|
if (_property.IsArray && (drawers[index].Target & TriTargetPropertyType.Array) == 0 ||
|
||||||
!_property.IsArrayElement && (drawers[index].Target & TriTargetPropertyType.Self) == 0)
|
!_property.IsArray && (drawers[index].Target & TriTargetPropertyType.Self) == 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,9 @@ namespace TriInspector
|
|||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public bool IsArrayElement => _definition.IsArrayElement;
|
public bool IsArrayElement => _definition.IsArrayElement;
|
||||||
|
|
||||||
|
[PublicAPI]
|
||||||
|
public bool IsArray => _definition.IsArray;
|
||||||
|
|
||||||
public int IndexInArray => IsArrayElement
|
public int IndexInArray => IsArrayElement
|
||||||
? _propertyIndex
|
? _propertyIndex
|
||||||
: throw new InvalidOperationException("Cannot read IndexInArray for !IsArrayElement");
|
: throw new InvalidOperationException("Cannot read IndexInArray for !IsArrayElement");
|
||||||
|
@ -6,7 +6,7 @@ namespace TriInspector
|
|||||||
public enum TriTargetPropertyType
|
public enum TriTargetPropertyType
|
||||||
{
|
{
|
||||||
Self = 1 << 0,
|
Self = 1 << 0,
|
||||||
ArrayElements = 1 << 2,
|
Array = 1 << 2,
|
||||||
SelfAndArrayElements = Self | ArrayElements,
|
SelfAndArray = Self | Array,
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user