mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 09:03:52 +00:00
feat(editor): heightmap import, toast notifications, workflow polish
- Import Heightmap: File > Import Heightmap loads RAW 8/16-bit grayscale files (129x129 or 257x257) and maps to terrain heights with configurable scale. Supports standard terrain editor heightmap formats. - Toast notifications: non-intrusive green popup at bottom center for user feedback (save confirmations, import results, errors) - Toasts fade out after 3 seconds with alpha animation - Auto-save now shows toast on save - Quick-save (Ctrl+S) shows toast confirmation
This commit is contained in:
parent
a91233a6ec
commit
2f96f112bd
5 changed files with 120 additions and 1 deletions
|
|
@ -48,6 +48,25 @@ void EditorUI::render(EditorApp& app) {
|
|||
renderMinimap(app);
|
||||
renderPropertiesPanel(app);
|
||||
renderStatusBar(app);
|
||||
|
||||
// Toast notifications
|
||||
ImGuiViewport* tvp = ImGui::GetMainViewport();
|
||||
float toastY = tvp->Size.y - 60;
|
||||
for (const auto& t : app.getToasts()) {
|
||||
float alpha = std::min(1.0f, t.timer);
|
||||
ImGui::SetNextWindowPos(ImVec2(tvp->Size.x / 2 - 150, toastY));
|
||||
ImGui::SetNextWindowSize(ImVec2(300, 30));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha);
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.1f, 0.4f, 0.1f, 0.9f));
|
||||
char toastId[32]; std::snprintf(toastId, sizeof(toastId), "##toast%p", (void*)&t);
|
||||
ImGui::Begin(toastId, nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs |
|
||||
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings);
|
||||
ImGui::Text("%s", t.msg.c_str());
|
||||
ImGui::End();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleVar();
|
||||
toastY -= 35;
|
||||
}
|
||||
}
|
||||
|
||||
void EditorUI::processActions(EditorApp& app) {
|
||||
|
|
@ -69,6 +88,20 @@ void EditorUI::renderMenuBar(EditorApp& app) {
|
|||
if (ImGui::BeginMenu("File")) {
|
||||
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())) {
|
||||
static char hmPath[256] = "heightmap.raw";
|
||||
static float hmScale = 200.0f;
|
||||
ImGui::InputText("File##hm", hmPath, sizeof(hmPath));
|
||||
ImGui::SliderFloat("Height Scale", &hmScale, 10.0f, 1000.0f);
|
||||
ImGui::TextColored(ImVec4(0.6f,0.6f,0.6f,1), "RAW 16-bit or 8-bit (129x129 or 257x257)");
|
||||
if (ImGui::MenuItem("Import")) {
|
||||
if (app.getTerrainEditor().importHeightmap(hmPath, hmScale))
|
||||
app.showToast("Heightmap imported");
|
||||
else
|
||||
app.showToast("Failed to import heightmap");
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::MenuItem("Clear All", nullptr, false, app.hasTerrainLoaded())) {
|
||||
app.getTerrainEditor().history().clear();
|
||||
app.getObjectPlacer().clearSelection();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue