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:
Kelsi 2026-05-05 04:49:43 -07:00
parent a91233a6ec
commit 2f96f112bd
5 changed files with 120 additions and 1 deletions

View file

@ -7,6 +7,7 @@
#include <imgui.h>
#include <imgui_impl_sdl2.h>
#include <imgui_impl_vulkan.h>
#include <algorithm>
#include <chrono>
#include <sstream>
@ -81,6 +82,8 @@ void EditorApp::run() {
// Handle pending UI actions
ui_.processActions(*this);
updateToasts(dt);
// Auto-save
if (autoSaveEnabled_ && terrain_.isLoaded() && terrainEditor_.hasUnsavedChanges()) {
autoSaveTimer_ += dt;
@ -593,6 +596,7 @@ void EditorApp::exportZone(const std::string& outputDir) {
}
lastSavePath_ = outputDir;
showToast("Zone exported to " + base);
LOG_INFO("Zone exported to: ", base);
}
@ -606,6 +610,16 @@ void EditorApp::requestQuit() {
window_->setShouldClose(true);
}
void EditorApp::showToast(const std::string& msg, float duration) {
toasts_.push_back({msg, duration});
}
void EditorApp::updateToasts(float dt) {
for (auto& t : toasts_) t.timer -= dt;
toasts_.erase(std::remove_if(toasts_.begin(), toasts_.end(),
[](const Toast& t) { return t.timer <= 0; }), toasts_.end());
}
void EditorApp::setSkyPreset(int preset) {
switch (preset) {
case 0: // Day