diff --git a/Editor/Elements/TriPropertyElement.cs b/Editor/Elements/TriPropertyElement.cs index e7b7b34..76b144d 100644 --- a/Editor/Elements/TriPropertyElement.cs +++ b/Editor/Elements/TriPropertyElement.cs @@ -26,12 +26,6 @@ namespace TriInspector.Elements { var drawer = drawers[index]; - if (_property.IsArrayElement && !drawer.ApplyOnArrayElement || - _property.IsArray && drawer.ApplyOnArrayElement) - { - continue; - } - var canDrawMessage = drawer.CanDraw(_property); if (!string.IsNullOrEmpty(canDrawMessage)) { diff --git a/Editor/TriPropertyDefinition.cs b/Editor/TriPropertyDefinition.cs index e297fc1..75eab99 100644 --- a/Editor/TriPropertyDefinition.cs +++ b/Editor/TriPropertyDefinition.cs @@ -88,7 +88,9 @@ namespace TriInspector if (_hideProcessorsBackingField == null) { _hideProcessorsBackingField = - TriDrawersUtilities.CreateHideProcessorsFor(Attributes).ToList(); + TriDrawersUtilities.CreateHideProcessorsFor(Attributes) + .Where(it => CanApplyOn(this, applyOnArrayElement: false)) + .ToList(); } return _hideProcessorsBackingField; @@ -102,7 +104,9 @@ namespace TriInspector if (_disableProcessorsBackingField == null) { _disableProcessorsBackingField = - TriDrawersUtilities.CreateDisableProcessorsFor(Attributes).ToList(); + TriDrawersUtilities.CreateDisableProcessorsFor(Attributes) + .Where(it => CanApplyOn(this, applyOnArrayElement: false)) + .ToList(); } return _disableProcessorsBackingField; @@ -118,6 +122,7 @@ namespace TriInspector _drawersBackingField = Enumerable.Empty() .Concat(TriDrawersUtilities.CreateValueDrawersFor(FieldType)) .Concat(TriDrawersUtilities.CreateAttributeDrawersFor(Attributes)) + .Where(it => CanApplyOn(this, it.ApplyOnArrayElement)) .OrderBy(it => it.Order) .ToList(); } @@ -135,6 +140,7 @@ namespace TriInspector _validatorsBackingField = Enumerable.Empty() .Concat(TriDrawersUtilities.CreateValueValidatorsFor(FieldType)) .Concat(TriDrawersUtilities.CreateAttributeValidatorsFor(Attributes)) + .Where(it => CanApplyOn(this, it.ApplyOnArrayElement)) .ToList(); } @@ -230,5 +236,16 @@ namespace TriInspector { return (self, obj, value) => { }; } + + private static bool CanApplyOn(TriPropertyDefinition definition, bool applyOnArrayElement) + { + if (definition.IsArrayElement && !applyOnArrayElement || + definition.IsArray && applyOnArrayElement) + { + return false; + } + + return true; + } } } \ No newline at end of file