Ejemplo n.º 1
0
        public override VisualElement Build(InspectorContext <Color> context)
        {
            var element = base.Build(context);
            var usage   = context.Attributes.GetAttribute <ColorUsageAttribute>();

            m_Field.hdr       = usage.hdr;
            m_Field.showAlpha = usage.showAlpha;
            return(element);
        }
Ejemplo n.º 2
0
        public override VisualElement Build(InspectorContext <Gradient> context)
        {
            var element = base.Build(context);

            // GradientField.hdr is not yet supported.
            //var usage = context.Attributes.GetAttribute<GradientUsageAttribute>();
            //m_Field.hdr = usage.hdr;
            return(element);
        }
Ejemplo n.º 3
0
        public override VisualElement Build(InspectorContext <TValue> context)
        {
            base.Build(context);
            var range = context.Attributes.GetAttribute <RangeAttribute>();

            m_Field.lowValue  = TypeConversion.Convert <float, TFieldType>(Mathf.Max(range.min, LowValue));
            m_Field.highValue = TypeConversion.Convert <float, TFieldType>(Mathf.Min(range.max, HighValue));
            return(m_Field);
        }
        public VisualElement Build(InspectorContext <DirectoryInfo> context)
        {
            m_TextField = new TextField(context.PrettyName);
            m_TextField.RegisterValueChangedCallback(evt =>
            {
                context.Data = new DirectoryInfo(evt.newValue);
            });

            return(m_TextField);
        }
Ejemplo n.º 5
0
 public VisualElement Build(InspectorContext <GUID> context)
 {
     m_Field = new TextField
     {
         label   = context.PrettyName,
         tooltip = context.Tooltip
     };
     m_Field.SetValueWithoutNotify(context.Data.ToString());
     m_Field.SetEnabled(false);
     return(m_Field);
 }
Ejemplo n.º 6
0
        private static bool TryGetInspector <TValue>(
            InspectorVisitor <T> visitor,
            IProperty property,
            PropertyPath propertyPath,
            string propertyName,
            InspectorVisitLevel visitLevel)
        {
            var inspector = CustomInspectorDatabase.GetInspector <TValue>(property);

            if (null == inspector)
            {
                return(false);
            }
            var proxy           = new InspectorContext <TValue>(visitor.VisitorContext.Binding, property, propertyPath, propertyName, visitLevel);
            var customInspector = new CustomInspectorElement <TValue>(inspector, proxy);

            visitor.VisitorContext.Parent.contentContainer.Add(customInspector);
            inspector.Update(proxy);
            return(true);
        }
Ejemplo n.º 7
0
 public virtual VisualElement Build(InspectorContext <TValue> context)
 {
     m_Field = new TField
     {
         label   = context.PrettyName,
         tooltip = context.Tooltip
     };
     m_Field.RegisterValueChangedCallback(evt =>
     {
         var input = m_Field as TextInputBaseField <TFieldValue>;
         if (null != input)
         {
             input.isDelayed = false;
         }
         OnChanged(evt, context);
         Update(context);
         if (null != input)
         {
             input.isDelayed = context.IsDelayed;
         }
     });
     return(m_Field);
 }
        public VisualElement Build(InspectorContext <GlobalObjectId> context)
        {
            var root = new Foldout
            {
                text    = context.PrettyName,
                tooltip = context.Tooltip
            };
            var id = context.Data;

            m_IdentifierType = new EnumField(ObjectNames.NicifyVariableName(nameof(GlobalObjectId.identifierType)), (IdentifierType)id.identifierType);
            m_IdentifierType.SetEnabled(false);
            root.contentContainer.Add(m_IdentifierType);
            m_Guid = new TextField(ObjectNames.NicifyVariableName(nameof(GlobalObjectId.assetGUID)));
            m_Guid.SetValueWithoutNotify(context.Data.assetGUID.ToString());
            m_Guid.SetEnabled(false);
            root.contentContainer.Add(m_Guid);

            m_FileId = new TextField("File Id");
            m_FileId.SetValueWithoutNotify(context.Data.targetObjectId.ToString());
            m_FileId.SetEnabled(false);
            root.contentContainer.Add(m_FileId);
            return(root);
        }
Ejemplo n.º 9
0
 protected virtual void OnChanged(ChangeEvent <TFieldValue> evt, InspectorContext <TValue> context)
 {
     context.Data = Connector.ToValue(evt.newValue);
 }
Ejemplo n.º 10
0
 public virtual void Update(InspectorContext <TValue> context)
 {
     m_Field.SetValueWithoutNotify(Connector.ToField(context.Data));
 }
 protected override void OnChanged(ChangeEvent <TFieldValue> evt, InspectorContext <TValue> context)
 {
     context.Data = Connector.ToValue(
         TypeConversion.Convert <float, TFieldValue>(
             Mathf.Max(m_MinValue, TypeConversion.Convert <TFieldValue, float>(evt.newValue))));
 }
 public override VisualElement Build(InspectorContext <TValue> context)
 {
     base.Build(context);
     m_MinValue = context.Attributes.GetAttribute <MinAttribute>().min;
     return(m_Field);
 }
 public void Update(InspectorContext <GlobalObjectId> context)
 {
 }
Ejemplo n.º 14
0
 public void Update(InspectorContext <GUID> context)
 {
     // Nothing to do..
 }
 public void Update(InspectorContext <DirectoryInfo> context)
 {
     m_TextField.SetValueWithoutNotify(context.Data.GetRelativePath());
 }