From 18939af73d76a7e43c0d1338ee33735bc4c4b40a Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 5 May 2026 09:39:01 -0700 Subject: [PATCH] feat(editor): project management UI in File menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - File > Project submenu: New/Save/Load project, add zones - "Add Current Zone to Project" captures loaded map/tile info - Project path editable in the menu - Zone count shown for quick reference - Foundation for multi-zone custom expansion workflow: create project → add zones → edit each → export all as WCP --- tools/editor/editor_app.hpp | 5 +++++ tools/editor/editor_ui.cpp | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/tools/editor/editor_app.hpp b/tools/editor/editor_app.hpp index 74371030..8ef3afc4 100644 --- a/tools/editor/editor_app.hpp +++ b/tools/editor/editor_app.hpp @@ -9,6 +9,7 @@ #include "npc_spawner.hpp" #include "npc_presets.hpp" #include "quest_editor.hpp" +#include "editor_project.hpp" #include "zone_manifest.hpp" #include "asset_browser.hpp" #include "core/window.hpp" @@ -117,6 +118,10 @@ private: NpcSpawner npcSpawner_; NpcPresets npcPresets_; QuestEditor questEditor_; + EditorProject project_; +public: + EditorProject& getProject() { return project_; } +private: AssetBrowser assetBrowser_; pipeline::ADTTerrain terrain_; diff --git a/tools/editor/editor_ui.cpp b/tools/editor/editor_ui.cpp index dc8c8fee..63a576a7 100644 --- a/tools/editor/editor_ui.cpp +++ b/tools/editor/editor_ui.cpp @@ -129,6 +129,39 @@ void EditorUI::processActions(EditorApp& app) { void EditorUI::renderMenuBar(EditorApp& app) { if (ImGui::BeginMainMenuBar()) { if (ImGui::BeginMenu("File")) { + if (ImGui::BeginMenu("Project")) { + static char projPathBuf[256] = "projects/MyExpansion/project.json"; + if (ImGui::MenuItem("New Project...")) { + app.getProject().name = "MyExpansion"; + app.getProject().author = "Kelsi Davis"; + app.getProject().zones.clear(); + app.showToast("New project created"); + } + if (ImGui::MenuItem("Save Project")) { + app.getProject().save(projPathBuf); + app.showToast("Project saved"); + } + if (ImGui::MenuItem("Load Project")) { + if (app.getProject().load(projPathBuf)) + app.showToast("Project loaded: " + app.getProject().name); + else + app.showToast("Failed to load project"); + } + if (ImGui::MenuItem("Add Current Zone to Project") && app.hasTerrainLoaded()) { + ProjectZone pz; + pz.mapName = app.getLoadedMap(); + pz.tileX = app.getLoadedTileX(); + pz.tileY = app.getLoadedTileY(); + app.getProject().zones.push_back(pz); + app.showToast("Zone added to project (" + + std::to_string(app.getProject().zones.size()) + " zones)"); + } + ImGui::Separator(); + ImGui::InputText("Path##proj", projPathBuf, sizeof(projPathBuf)); + ImGui::Text("Zones: %zu", app.getProject().zones.size()); + ImGui::EndMenu(); + } + ImGui::Separator(); if (ImGui::MenuItem("New Terrain...", "Ctrl+N")) showNewDialog_ = true; if (ImGui::MenuItem("Load ADT...", "Ctrl+O")) showLoadDialog_ = true; if (ImGui::BeginMenu("Import Heightmap", app.hasTerrainLoaded())) {