diff --git a/tools/tesseratos/src/tesseratos/project/plugin.cpp b/tools/tesseratos/src/tesseratos/project/plugin.cpp index 7c4c39e26..8239386d5 100644 --- a/tools/tesseratos/src/tesseratos/project/plugin.cpp +++ b/tools/tesseratos/src/tesseratos/project/plugin.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -20,44 +21,55 @@ void tesseratos::projectPlugin(Cubos& cubos) cubos.depends(toolboxPlugin); cubos.depends(imguiPlugin); cubos.depends(settingsPlugin); + cubos.depends(assetsPlugin); cubos.resource(); - cubos.system("show Project").tagged(imguiTag).call([](Toolbox& toolbox, Project& project, Settings& settings) { - if (!toolbox.isOpen("Project")) - { - return; - } - - if (!ImGui::Begin("Project")) - { - ImGui::End(); - return; - } - - if (!project.open()) - { - // If the project is not open, only show the open dialog. - auto projectOSPath = settings.getString("project.path", ""); - if (ImGui::InputText("Project Path", &projectOSPath)) + cubos.system("show Project") + .tagged(imguiTag) + .call([](Toolbox& toolbox, Project& project, Settings& settings, Assets& assets) { + if (!toolbox.isOpen("Project")) { - settings.setString("project.path", projectOSPath); + return; } - if (ImGui::Button("Open") && !project.open(projectOSPath)) + if (!ImGui::Begin("Project")) { - CUBOS_ERROR("Failed to open project"); + ImGui::End(); + return; } - ImGui::End(); - return; - } + if (!project.open()) + { + // If the project is not open, only show the open dialog. + auto projectOSPath = settings.getString("project.path", ""); + if (ImGui::InputText("Project Path", &projectOSPath)) + { + settings.setString("project.path", projectOSPath); + } + + if (ImGui::Button("Open")) + { + if (project.open(projectOSPath)) + { + assets.loadMeta("/project/assets"); + } + else + { + CUBOS_ERROR("Failed to open project"); + } + } - if (ImGui::Button("Close")) - { - project.close(); - } + ImGui::End(); + return; + } - ImGui::End(); - }); + if (ImGui::Button("Close")) + { + assets.unloadMeta("/project/assets"); + project.close(); + } + + ImGui::End(); + }); }