Optimize Content Finder popup

This commit is contained in:
Wojtek Figat
2021-08-23 10:54:19 +02:00
parent ba5997683b
commit bee117f86b
2 changed files with 25 additions and 10 deletions

View File

@@ -153,17 +153,16 @@ namespace FlaxEditor.Modules
};
}
}
Profiler.BeginEvent("ContentFinding.Search");
string type = ".*";
string name = charsToFind.Trim();
if (charsToFind.Contains(':'))
{
var args = charsToFind.Split(':');
type = ".*" + args[1].Trim() + ".*";
name = ".*" + args[0].Trim() + ".*";
}
if (name.Equals(string.Empty))
name = ".*";
@@ -173,17 +172,28 @@ namespace FlaxEditor.Modules
foreach (var project in Editor.Instance.ContentDatabase.Projects)
{
Profiler.BeginEvent(project.Project.Name);
ProcessItems(nameRegex, typeRegex, project.Folder.Children, matches);
Profiler.EndEvent();
}
//ProcessSceneNodes(nameRegex, typeRegex, Editor.Instance.Scene.Root, matches);
ProcessActors(nameRegex, typeRegex, Editor.Instance.Scene.Root, matches);
_quickActions.ForEach(action =>
{
if (nameRegex.Match(action.Name).Success && typeRegex.Match("Quick Action").Success)
matches.Add(new SearchResult { Name = action.Name, Type = "Quick Action", Item = action });
});
Profiler.BeginEvent("Actors");
ProcessActors(nameRegex, typeRegex, Editor.Instance.Scene.Root, matches);
Profiler.EndEvent();
}
{
Profiler.BeginEvent("QuickActions");
_quickActions.ForEach(action =>
{
if (nameRegex.Match(action.Name).Success && typeRegex.Match("Quick Action").Success)
matches.Add(new SearchResult { Name = action.Name, Type = "Quick Action", Item = action });
});
Profiler.EndEvent();
}
Profiler.EndEvent();
return matches;
}

View File

@@ -107,14 +107,18 @@ namespace FlaxEditor.Surface.ContextMenu
private void BuildList(List<SearchResult> items)
{
_resultPanel.DisposeChildren();
LockChildrenRecursive();
var dpiScale = DpiScale;
var window = RootWindow.Window;
if (items.Count == 0)
{
Height = _searchBox.Height + 1;
_resultPanel.ScrollBars = ScrollBars.None;
RootWindow.Window.ClientSize = new Vector2(RootWindow.Window.ClientSize.X, Height * dpiScale);
window.ClientSize = new Vector2(window.ClientSize.X, Height * dpiScale);
UnlockChildrenRecursive();
PerformLayout();
return;
}
@@ -148,8 +152,9 @@ namespace FlaxEditor.Surface.ContextMenu
MatchedItems.Add(searchItem);
}
RootWindow.Window.ClientSize = new Vector2(RootWindow.Window.ClientSize.X, Height * dpiScale);
window.ClientSize = new Vector2(window.ClientSize.X, Height * dpiScale);
UnlockChildrenRecursive();
PerformLayout();
}