public ElementProperty(int index, TElementValue value, bool isContainer, IPropertyAttributeCollection attributes = null)
 {
     m_Value      = value;
     m_Attributes = attributes;
     m_Index      = index;
     IsContainer  = isContainer;
 }
Exemple #2
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;
     }
 }
Exemple #3
0
 public static void SetTooltip(IPropertyAttributeCollection attributes, VisualElement element)
 {
     if (null != attributes && attributes.HasAttribute <TooltipAttribute>())
     {
         element.tooltip = attributes.GetAttribute <TooltipAttribute>().tooltip;
     }
 }
 public Property(string name, Getter getter, Setter setter = null, IPropertyAttributeCollection attributes = null)
 {
     m_Name     = name;
     m_Getter   = getter;
     m_Setter   = setter;
     Attributes = attributes;
 }
            public CollectionElementProperty(ArrayProperty <TContainer, TElement> property, int index, IPropertyAttributeCollection attributes = null)
            {
                m_Property  = property;
                IsContainer = RuntimeTypeInfoCache <TElement> .IsContainerType();

                Attributes = attributes;
                Index      = index;
            }
Exemple #6
0
        public UnmanagedProperty(string name, int offset, bool readOnly = false, IPropertyAttributeCollection attributes = null)
        {
            m_Name      = name;
            Offset      = offset;
            IsReadOnly  = readOnly;
            IsContainer = RuntimeTypeInfoCache <TValue> .IsContainerType();

            Attributes = attributes;
        }
Exemple #7
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;
        }
Exemple #8
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;
        }
            public SerializedArrayViewProperty(SerializedStringView name, SerializedArrayView value, IPropertyAttributeCollection attributes = null)
            {
                m_Name       = name;
                m_Value      = value;
                m_Attributes = attributes;

                // @HACK
                // Since we don't have an efficient indexer. We will pay the allocation cost on creation of the property.
                m_Elements = m_Value.ToArray();
            }
        public ListProperty(string name, Getter getter, Setter setter, IPropertyAttributeCollection attributes = null)
        {
            m_Name       = name;
            m_Getter     = getter;
            m_Setter     = setter;
            m_Attributes = attributes;

            if (RuntimeTypeInfoCache <TElement> .IsArray())
            {
                throw new Exception("ArrayProperty`2 does not support array of array");
            }
        }
Exemple #11
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>();
        }
Exemple #12
0
 public BooleanProperty(string name, JsonObject value, IPropertyAttributeCollection attributes = null)
 {
     m_Name       = name;
     m_Value      = value;
     m_Attributes = attributes;
 }
 public EntityProperty(params Attribute[] attributes)
 {
     Attributes = new PropertyAttributeCollection(attributes);
 }
 public CollectionElementProperty(ListProperty <TContainer, TElement> property, int index, IPropertyAttributeCollection attributes = null)
 {
     m_Property   = property;
     m_Attributes = attributes;
     m_Index      = index;
 }
 public ReflectedListProperty(FieldInfo fieldInfo)
 {
     m_FieldInfo  = fieldInfo;
     m_Attributes = new PropertyAttributeCollection(fieldInfo.GetCustomAttributes().ToArray());
 }
 public ReflectedListElementProperty(ReflectedArrayProperty <TContainer, TElement> property, int index, IPropertyAttributeCollection attributes = null)
 {
     m_Property   = property;
     m_Attributes = attributes;
     m_Index      = index;
 }
 public ReflectedArrayProperty(IMemberInfo info)
 {
     m_Info     = info;
     Attributes = new PropertyAttributeCollection(info.GetCustomAttributes().ToArray());
     IsReadOnly = Attributes.HasAttribute <ReadOnlyAttribute>() || !info.CanWrite();
 }
 public UnmanagedProperty(string name, int offset, IPropertyAttributeCollection attributes = null)
 {
     m_Name       = name;
     m_Offset     = offset;
     m_Attributes = attributes;
 }
Exemple #19
0
 public NullProperty(string name, IPropertyAttributeCollection attributes = null)
 {
     m_Name       = name;
     m_Attributes = attributes;
 }
 public UInt64Property(SerializedStringView name, SerializedValueView value, IPropertyAttributeCollection attributes = null)
 {
     m_Name       = name;
     m_Value      = value;
     m_Attributes = attributes;
 }