77#include < core/renderer/Texture.h>
88#include < core/app/GameApplication.h>
99
10+ #include < core/asset/AssetManagerUtil.h>
11+
1012#include " StringValues.h"
1113
1214class ContentBrowserPanel
@@ -23,7 +25,6 @@ class ContentBrowserPanel
2325
2426 void OnImGuiRender ()
2527 {
26-
2728 // Load Textures of the icons here:
2829 if (!m_LoadedTextures)
2930 {
@@ -74,6 +75,25 @@ class ContentBrowserPanel
7475
7576 ImGui::Columns (column_count, " ##FileColumns" , false );
7677
78+ Xen::AssetPtrRegistry assetRegistry = Xen::AssetManagerUtil::GetEditorAssetManager ()->GetLoadedAssetRegistry ();
79+
80+ for (auto && assetPair : assetRegistry)
81+ {
82+ ImGui::PushStyleColor (ImGuiCol_Button, ImVec4 (0 , 0 , 0 , 0 ));
83+
84+ Xen::Ref<Xen::Texture2D> texture = Xen::AssetManagerUtil::GetAsset<Xen::Texture2D>(assetPair.first );
85+
86+ ImGui::PushID (assetPair.first );
87+ ImGui::ImageButton ((ImTextureID)(texture->GetNativeTextureID ()), { (float )m_IconSize, (float )m_IconSize });
88+
89+ ImGui::PopID ();
90+
91+ ImGui::TextWrapped (" %u" , assetPair.first );
92+ ImGui::PopStyleColor ();
93+ ImGui::NextColumn ();
94+ }
95+
96+ #if 0
7797 for (auto& p : std::filesystem::directory_iterator{ m_CurrentPath })
7898 {
7999 const auto& path = p.path();
@@ -117,6 +137,7 @@ class ContentBrowserPanel
117137 ImGui::NextColumn();
118138
119139 }
140+ #endif
120141 ImGui::Columns (1 );
121142 ImGui::End ();
122143 }
@@ -136,9 +157,9 @@ class ContentBrowserPanel
136157 std::filesystem::path m_CurrentPath;
137158
138159 // Drag drop types:
139- std::string m_SceneLoadDropType = " XEN_CONTENT_BROWSER_SCENE_LOAD" ;
140- std::string m_TextureLoadDropType = " XEN_CONTENT_BROWSER_TEXTURE_LOAD" ;
141- std::string m_ScriptLoadDropType = " XEN_CONTENT_BROWSER_SCRIPT_LOAD" ;
160+ std::string m_SceneLoadDropType = " XEN_CONTENT_BROWSER_SCENE_LOAD" ;
161+ std::string m_TextureLoadDropType = " XEN_CONTENT_BROWSER_TEXTURE_LOAD" ;
162+ std::string m_ScriptLoadDropType = " XEN_CONTENT_BROWSER_SCRIPT_LOAD" ;
142163
143164 Xen::Ref<Xen::Texture2D> m_FolderTexture;
144165 Xen::Ref<Xen::Texture2D> m_FileTexture;
0 commit comments