Skip to content

Commit

Permalink
allowed searching for GUIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
saint11 committed Dec 8, 2024
1 parent c23e281 commit cbabf04
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Murder.Editor/EditorScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,18 @@ private void DrawAssetsWindow()
ImGui.SetKeyboardFocusHere();
}

ImGui.InputTextWithHint("##search_assets", "Search...", ref _searchAssetText, 256);
if (ImGui.InputTextWithHint("##search_assets", "Search...", ref _searchAssetText, 256))
{
// if _searchAssetText is a GUID, we should select that asset.
if (Guid.TryParse(_searchAssetText, out Guid guid))
{
if (Architect.EditorData.TryGetAsset(guid) is GameAsset asset)
{
OpenAssetEditor(asset, true);
_searchAssetText = string.Empty;
}
}
}
ImGui.PopItemWidth();

if (!string.IsNullOrEmpty(_searchAssetText) || _folders?.Count == 1)
Expand Down Expand Up @@ -469,7 +480,7 @@ private void DrawAssetsWindow()
{
_colapseAll = true;
}
ImGuiHelpers.HelpTooltip("Collaps all folders");
ImGuiHelpers.HelpTooltip("Collapse all folders");

ImGui.Separator();

Expand Down

0 comments on commit cbabf04

Please sign in to comment.