Exemplo n.º 1
0
        public override VisualElement CreatePropertyGUI(SerializedProperty prop)
        {
            var searchContextAttribute = (SearchContextAttribute)attribute;

            ObjectField obj = new ObjectField()
            {
                name            = kVisualElementName,
                label           = prop.localizedDisplayName,
                bindingPath     = prop.propertyPath,
                objectType      = fieldInfo.FieldType,
                searchViewFlags = searchContextAttribute.flags,
                searchContext   = CreateContextFromAttribute(searchContextAttribute)
            };

            return(obj);
        }
Exemplo n.º 2
0
            public ObjectFieldDisplay(ObjectField objectField)
            {
                AddToClassList(ussClassName);
                m_ObjectIcon = new Image {
                    scaleMode = ScaleMode.ScaleAndCrop, pickingMode = PickingMode.Ignore
                };
                m_ObjectIcon.AddToClassList(iconUssClassName);
                m_ObjectLabel = new Label {
                    pickingMode = PickingMode.Ignore
                };
                m_ObjectLabel.AddToClassList(labelUssClassName);
                m_ObjectField = objectField;

                Update();

                Add(m_ObjectIcon);
                Add(m_ObjectLabel);
            }
Exemplo n.º 3
0
        void OnEnable()
        {
            m_TransactionManager = new ReadOnlyTransactionManager();

            m_TransactionAssetField            = new ObjectField("Transaction Database");
            m_TransactionAssetField.objectType = typeof(DefaultAsset);
            m_TransactionAssetField.RegisterValueChangedCallback(evt =>
            {
                var assetPath = AssetDatabase.GetAssetPath(evt.newValue);
                LoadDatabase(assetPath, TimeRange.All(), true);
            });
            rootVisualElement.Add(m_TransactionAssetField);


            m_TransactionListView                 = new UnityEngine.UIElements.ListView();
            m_TransactionListView.itemsSource     = Transactions;
            m_TransactionListView.fixedItemHeight = k_TransactionRowHeight;
            m_TransactionListView.makeItem        = MakeRowItem;
            m_TransactionListView.bindItem        = BindRowItem;
            m_TransactionListView.style.flexGrow  = 1.0f;
            rootVisualElement.Add(m_TransactionListView);
        }
Exemplo n.º 4
0
 public ObjectFieldSelector(ObjectField objectField)
 {
     m_ObjectField = objectField;
 }