public PropertyGroupSearcherAdapter(Store store, PropertyGroupBaseNodeModel model) : base("Get/Set properties") { m_Store = store; m_PropertyGroupModel = model; m_ItemTemplate = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>( UICreationHelper.templatePath + "PropertyGroupSearcherItem.uxml"); }
internal static IEnumerable <SearcherItem> GetPropertySearcherItems(PropertyGroupBaseNodeModel model, int maxDepth) { var stencil = model.GraphModel.Stencil; TypeHandle instanceTypeRef = model.GetConnectedInstanceType(); if (instanceTypeRef == TypeHandle.ThisType) { instanceTypeRef = stencil.GetThisType(); } if (!instanceTypeRef.IsValid) { return(Enumerable.Empty <SearcherItem>()); } var existingMembers = new HashSet <int>(model.Members.Select(m => m.GetHashCode())); var propertySearcherItemsBuilder = new PropertySearcherItemsBuilder(maxDepth, instanceTypeRef, stencil.GraphContext.TypeMetadataResolver, existingMembers); return(propertySearcherItemsBuilder.Build()); }
internal void DisplayPropertySearcher(PropertyGroupBaseNodeModel model, Vector2 displayAtPosition) { var items = PropertyGroupSearcherAdapter.GetPropertySearcherItems(model, 4)?.ToList(); if (items == null) { return; } var adapter = new PropertyGroupSearcherAdapter(m_Store, model); SearcherService.ShowTransientData(this, items, adapter, item => { if (item == null) { return; } PropertyElement propertyElement = ((PropertySearcherItem)item).Element; adapter.EditModel(!propertyElement.Toggle.value, propertyElement.Item); }, displayAtPosition); }