Renamed all attributes and drawers to have postfix of either Attribute or AttributeDrawer
This commit is contained in:
parent
81bac32538
commit
dc15bfec81
161 changed files with 265 additions and 265 deletions
22
Editor/AccessModifiers/HideFieldAttributeDrawer.cs
Normal file
22
Editor/AccessModifiers/HideFieldAttributeDrawer.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using UnityEditor;
|
||||
|
||||
namespace Module.Inspector.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(HideFieldAttribute))]
|
||||
internal sealed class HideFieldAttributeDrawer : AccessModifierPropertyDrawer
|
||||
{
|
||||
public override EAccessType GetAccessType(AccessModifierPropertyAttribute attribute, SerializedProperty property, EAccessType currentAccessType)
|
||||
{
|
||||
if (currentAccessType != EAccessType.Hidden && GetHideValue(attribute, property))
|
||||
currentAccessType = EAccessType.Hidden;
|
||||
|
||||
return currentAccessType;
|
||||
}
|
||||
|
||||
private static bool GetHideValue(AccessModifierPropertyAttribute attribute, SerializedProperty sp)
|
||||
{
|
||||
var att = (HideFieldAttribute)attribute;
|
||||
return string.IsNullOrEmpty(att.fieldName) || sp.IsSiblingValue(att.fieldName, att.fieldValue, att.useFieldValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue