36{
37 ImGui::Begin("Asset Browser");
38
39 ImGui::BeginGroup();
40 for (auto it = m_relatedPaths.rbegin(); it != m_relatedPaths.rend(); ++it)
41 {
42 ImGui::BeginDisabled(it->Path == m_CurrentPath);
43 if (ImGui::Button(it->DisplayName.c_str()))
44 {
45 m_CurrentPath = it->Path;
46 m_shouldUpdate = true;
47 }
48 ImGui::EndDisabled();
49
50 ImGui::SameLine();
51 ImGui::Text("/");
52 ImGui::SameLine();
53 }
54 ImGui::EndGroup();
55 ImGui::Separator();
56
57 ImVec2 buttonSize(72, 72);
58 float spacing = ImGui::GetStyle().ItemSpacing.x * 2;
59 float panelWidth = ImGui::GetWindowSize().x;
60 int colNb = (int) std::floor(panelWidth / (buttonSize.x + spacing));
61 colNb = std::max(1, colNb);
62
63 int index = 0;
64
65 if (m_CurrentPath != ".") {
66 ImGui::PushID(index);
67 ImGui::BeginGroup();
68 ImGui::ImageButton("back", (ImTextureID) m_folderTexture->GetNativeHandle(), buttonSize);
69
70 if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
71 m_CurrentPath = m_CurrentPath.parent_path();
72 m_shouldUpdate = true;
73 }
74
75 ImGui::TextWrapped("../");
76
77 ImGui::EndGroup();
78 ImGui::PopID();
79 ImGui::SameLine();
80 index++;
81 }
82
83 int id = 0;
84 for (FileItem item : m_FileItems)
85 {
86 ImGui::PushID(index);
87 ImGui::BeginGroup();
88
89 if (ImGui::ImageButton("file_item", (ImTextureID) m_currentTextures[item.iconPath]->GetNativeHandle(), buttonSize)) {}
90
91 if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
93 m_CurrentPath += "/" + item.name;
94 m_shouldUpdate = true;
95 }
96 else {
98 }
99 }
100
101 ImGui::PushTextWrapPos(ImGui::GetCursorPosX() + buttonSize.x);
102 ImGui::TextWrapped("%s", item.name.c_str());
103 ImGui::PopTextWrapPos();
104
105 ImGui::EndGroup();
106 ImGui::PopID();
107
108 if ((index + 1) % colNb != 0)
109 {
110 ImGui::SameLine();
111 }
112 index++;
113 }
114 ImGui::End();
115}
void OpenWithDefaultApp(const std::string &filePath)