예제 #1
0
 public static void SetDelayed <TFieldValue>(IPropertyAttributeCollection attributes, BaseField <TFieldValue> element)
 {
     if (null != attributes && attributes.HasAttribute <DelayedAttribute>() && element is TextInputBaseField <TFieldValue> textInput)
     {
         textInput.isDelayed = true;
     }
 }
예제 #2
0
 public static void SetTooltip(IPropertyAttributeCollection attributes, VisualElement element)
 {
     if (null != attributes && attributes.HasAttribute <TooltipAttribute>())
     {
         element.tooltip = attributes.GetAttribute <TooltipAttribute>().tooltip;
     }
 }
예제 #3
0
        public static void SetLabel(IPropertyAttributeCollection attributes, Foldout element, string prettyName)
        {
            var label = prettyName;

            if (null != attributes && attributes.HasAttribute <InspectorNameAttribute>())
            {
                label = attributes.GetAttribute <InspectorNameAttribute>().displayName;
            }
            element.text = label;
        }
예제 #4
0
        public static void SetLabel <TValue>(IPropertyAttributeCollection attributes, BaseField <TValue> element, string prettyName)
        {
            var label = prettyName;

            if (null != attributes && attributes.HasAttribute <InspectorNameAttribute>())
            {
                label = attributes.GetAttribute <InspectorNameAttribute>().displayName;
            }
            element.label = label;
        }
예제 #5
0
        // TODO: Cache the result of ObjectNames.NicifyVariableName

        internal InspectorContext(PropertyElement propertyElement, IProperty property, PropertyPath propertyPath, string name, InspectorVisitLevel visitLevel)
        {
            m_PropertyElement = propertyElement;
            m_PropertyPath    = propertyPath;
            Name       = name;
            VisitLevel = visitLevel;
            m_Property = property;
            Attributes = m_Property.Attributes ?? Empty;
            Tooltip    = Attributes.GetAttribute <TooltipAttribute>()?.tooltip;
            PrettyName = Attributes.GetAttribute <InspectorNameAttribute>()?.displayName ??
                         (!string.IsNullOrEmpty(Name) ? ObjectNames.NicifyVariableName(Name) : Name);
            IsDelayed = Attributes.HasAttribute <DelayedAttribute>();
        }
 public ReflectedArrayProperty(IMemberInfo info)
 {
     m_Info     = info;
     Attributes = new PropertyAttributeCollection(info.GetCustomAttributes().ToArray());
     IsReadOnly = Attributes.HasAttribute <ReadOnlyAttribute>() || !info.CanWrite();
 }