-
Notifications
You must be signed in to change notification settings - Fork 36
Creating Custom Search Providers
Chase edited this page Aug 16, 2020
·
1 revision
You may register one or more Search Providers with a Graph to control what nodes are available in the search dialog.
By default, a DefaultSearchProvider
is included that includes all nodes found in the project through reflection and organizes/filters them based on their path, [Tags]
, and the [IncludeTags]
rules of the Graph. But you can hook up your own search provider for special use cases - such as procedurally generating preconfigured nodes on the fly based on search parameters.
Inherit from BlueGraph.Editor.ISearchProvider
and provide two methods:
-
GetSearchResults
to return an enumerable list of results to populate the search dialog in response to the incomingSearchFilters
(things like the source port the user is dragging from and the list of allowed tags on the Graph) -
Instantiate
to create a new instance of aNode
once the user picks aSearchResult
from the search dialog. The node will be persisted to the Graph asset and a view will be added to the canvas.
TODO - Example here (and in samples). CanvasView adds a search provider to m_Search
but I don't think I'm exposing that functionality anywhere yet for someone to hook into.