Add Visject per-node custom search and use it for Multi Blend nodes to filter animations used

This commit is contained in:
Wojtek Figat
2025-03-31 14:12:32 +02:00
parent c00876fa94
commit ed3ec55561
3 changed files with 27 additions and 1 deletions

View File

@@ -937,6 +937,22 @@ namespace FlaxEditor.Surface.Archetypes
UpdateUI(); UpdateUI();
} }
/// <inheritdoc />
public override bool Search(string text)
{
FlaxEngine.Json.JsonSerializer.ParseID(text, out var id);
if (id != Guid.Empty)
{
for (int i = 5; i < Values.Length; i += 2)
{
if ((Guid)Values[i] == id)
return true;
}
}
return base.Search(text);
}
} }
/// <summary> /// <summary>

View File

@@ -862,6 +862,16 @@ namespace FlaxEditor.Surface
} }
} }
/// <summary>
/// Custom function to check if node matches a given search query.
/// </summary>
/// <param name="text">Text to check.</param>
/// <returns>True if node contains a given value.</returns>
public virtual bool Search(string text)
{
return false;
}
private string GetTooltip() private string GetTooltip()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -617,7 +617,7 @@ namespace FlaxEngine.Windows.Search
} }
var nodeSearchText = node.ContentSearchText; var nodeSearchText = node.ContentSearchText;
if (newTreeNodes.Count != 0 || (nodeSearchText != null && IsSearchMatch(ref nodeSearchText))) if (newTreeNodes.Count != 0 || (nodeSearchText != null && IsSearchMatch(ref nodeSearchText)) || node.Search(_searchText))
{ {
AddAssetSearchResult(ref assetTreeNode, asset); AddAssetSearchResult(ref assetTreeNode, asset);
var nodeTreeNode = new SearchResultTreeNode var nodeTreeNode = new SearchResultTreeNode