// 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 static void SetTooltip(IPropertyAttributeCollection attributes, VisualElement element) { if (null != attributes && attributes.HasAttribute <TooltipAttribute>()) { element.tooltip = attributes.GetAttribute <TooltipAttribute>().tooltip; } }
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; }
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; }