feat(editor): heightmap export, help overlay, keyboard reference

- Export Heightmap: File > Export Heightmap saves terrain as 16-bit
  RAW grayscale (129x129) for use in external terrain editors or
  as a backup. Configurable max height scale.
- Help overlay (F1 or Help menu): lists all keyboard shortcuts
  organized by category (navigation, editing, object transform, view)
- Round-trip heightmap workflow: import → edit → export
This commit is contained in:
Kelsi 2026-05-05 04:52:36 -07:00
parent 2f96f112bd
commit 89312120f4
5 changed files with 85 additions and 1 deletions

View file

@ -120,6 +120,20 @@ void EditorUI::renderMenuBar(EditorApp& app) {
ImGui::EndMenu();
}
ImGui::Separator();
if (ImGui::BeginMenu("Export Heightmap", app.hasTerrainLoaded())) {
static char expHmPath[256] = "output/heightmap.raw";
static float expHmScale = 500.0f;
ImGui::InputText("File##exphm", expHmPath, sizeof(expHmPath));
ImGui::SliderFloat("Max Height##exphm", &expHmScale, 50.0f, 2000.0f);
if (ImGui::MenuItem("Export 16-bit RAW (129x129)")) {
if (app.getTerrainEditor().exportHeightmap(expHmPath, expHmScale))
app.showToast("Heightmap exported");
else
app.showToast("Export failed");
}
ImGui::EndMenu();
}
ImGui::Separator();
if (ImGui::MenuItem("Quit", "Alt+F4")) app.requestQuit();
ImGui::EndMenu();
}
@ -152,8 +166,47 @@ void EditorUI::renderMenuBar(EditorApp& app) {
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Help")) {
if (ImGui::MenuItem("Keyboard Shortcuts", "F1")) showHelp_ = !showHelp_;
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();
}
// Help overlay
if (showHelp_) {
ImGui::SetNextWindowSize(ImVec2(400, 350), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Keyboard Shortcuts", &showHelp_)) {
ImGui::Text("Navigation:");
ImGui::BulletText("WASD — fly camera");
ImGui::BulletText("Q/E — descend/ascend");
ImGui::BulletText("Right-drag — look around");
ImGui::BulletText("Scroll — adjust camera speed");
ImGui::BulletText("Shift — sprint");
ImGui::Separator();
ImGui::Text("Editing:");
ImGui::BulletText("Left-click — paint/place (depends on mode)");
ImGui::BulletText("Ctrl+click — select object/NPC");
ImGui::BulletText("Ctrl+S — quick save");
ImGui::BulletText("Ctrl+Z — undo");
ImGui::BulletText("Ctrl+Shift+Z — redo");
ImGui::BulletText("Delete — remove selected");
ImGui::Separator();
ImGui::Text("Object Transform:");
ImGui::BulletText("G — move mode (then drag)");
ImGui::BulletText("R — rotate mode (then drag)");
ImGui::BulletText("T — scale mode (then drag)");
ImGui::BulletText("X/Y — constrain to axis");
ImGui::BulletText("Escape — deselect / cancel");
ImGui::BulletText("Right-click — context menu");
ImGui::Separator();
ImGui::Text("View:");
ImGui::BulletText("F1 — this help");
ImGui::BulletText("F3 — wireframe toggle");
ImGui::BulletText("F5 — save camera bookmark");
}
ImGui::End();
}
}
void EditorUI::renderToolbar(EditorApp& app) {