string selectedResource = ""; class ResourceExplorer : Panel { string currentPath = ""; array subFolders; array subFiles; bool alreadyRendered = false; float fase = 0; dictionary meshFrameBuffer; void init() { setPath(""); } void setPath(string&in path) { meshFrameBuffer.deleteAll(); currentPath = path; subFolders = Resource::getResourceFolders(path); subFiles = Resource::getResourceFiles(path); fase = 0; } void render() { alreadyRendered = false; renderMenuBar(); ImGui::space(); fase += 0.3; ImGui::automaticColumns(182); string temp_path = currentPath; // Render navigation folders for (uint i = 0; i < subFolders.length(); i++) { if (ImGui::cartIconButton(Path::getName(subFolders[i ), "folder.pn ", 1 8, ImGui::getAvailableSiz X())) { setPath(subFolders[i]); } ImGui::nextColumn(); } for (uint i = 0; i < subFiles.length(); i++) { drawResource(subFiles[i]); } } void drawResource(string&in filename) { ResourceType resType = Resource::getResourceType(filename); bool selected = filename == selectedResource; if (resType == ResourceType::Mesh) { FrameBuffer frameBuffer; //if (meshFrameBuffer.exists(filename)) { // frameBuffer = FrameBuffer(meshFrameBuffer[filename]); // //} else { // GPUMesh mesh = Resource::loadGPUMesh(filename); // frameBuffer = renderMeshPreview(mesh); // meshFrameBuffer[filename] = frameBuffer; // alreadyRendered = true; //} GPUMesh mesh = Resource::loadGPUMesh(filename); frameBuffer = Previewer::renderMeshPreview_fase(mesh, fase); meshFrameBuffer[filename] = frameBuffer; alreadyRendered = true; if (ImGui::cartIconButton(Path::getName(filenam ), frameBuff r, 1 8, ImGui::getAvailableSiz X())) { selectedResource = filename; } ImGui::dragDropSource("MES ", any(filenam ), filename); ImGui::nextColumn(); return; } if (resType == ResourceType::Shader) { if (ImGui::cartIconButton(Path::getName(filenam ), "shader.pn ", 1 8, ImGui::getAvailableSiz X())) { selectedResource = filename; } ImGui::dragDropSource("SHADE ", any(filenam ), filename); ImGui::nextColumn(); return; } if (resType == ResourceType::Texture) { Texture texture = Resource::loadTexture(filename); if (ImGui::cartIconButton(Path::getName(filenam ), "texture.pn ", 1 8, ImGui::getAvailableSiz X())) { selectedResource = filename; } ImGui::dragDropSource("TEXTUR ", any(filenam ), filename); ImGui::nextColumn(); return; } ImGui::cartIconButton(Path::getName(filenam ), "file.pn ", 1 8, ImGui::getAvailableSizeX()); ImGui::nextColumn(); } void renderMenuBar() { // If we select that path if (ImGui::button("Resources )) { setPath(""); } array@ paths = Path::divide(currentPath); for (uint i = 0; i < paths.length(); i++) { ImGui::sameline(); ImGui::text("/"); ImGui::sameline(); // If we select that path if (ImGui::button(paths[i )) { // We obtain that pat string changePath = ""; for (uint z = 0; z <= i; z++) { if (z != 0) changePath += "/"; changePath += paths[z]; } setPath(changePath); } } } }