From e1776620d5fdc0a55fbf5e272d37e9a1057147c6 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 5 May 2026 05:37:35 -0700 Subject: [PATCH] feat(editor): brush mode tooltips, chunk texture inspector in Paint panel - Brush mode tooltips: hover over the mode combo to see what each does (Raise/Lower/Smooth/Flatten/Level/Erode descriptions) - Chunk texture inspector: Paint panel shows which texture layers are on the chunk under the cursor (base + blended layers with filenames) - Helps identify what textures you're painting over before blending --- tools/editor/editor_ui.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tools/editor/editor_ui.cpp b/tools/editor/editor_ui.cpp index 59ca30a9..7177ef26 100644 --- a/tools/editor/editor_ui.cpp +++ b/tools/editor/editor_ui.cpp @@ -336,6 +336,17 @@ void EditorUI::renderBrushPanel(EditorApp& app) { const char* modes[] = {"Raise", "Lower", "Smooth", "Flatten", "Level", "Erode"}; int idx = static_cast(s.mode); if (ImGui::Combo("Mode", &idx, modes, 6)) s.mode = static_cast(idx); + if (ImGui::IsItemHovered()) { + const char* tips[] = { + "Raise: lift terrain up", + "Lower: push terrain down", + "Smooth: average neighbor heights", + "Flatten: set to target height", + "Level: same as flatten", + "Erode: simulate water erosion downhill" + }; + ImGui::SetTooltip("%s", tips[idx]); + } ImGui::SliderFloat("Radius", &s.radius, 5.0f, 200.0f, "%.0f"); ImGui::SliderFloat("Strength", &s.strength, 0.5f, 50.0f, "%.1f"); ImGui::SliderFloat("Falloff", &s.falloff, 0.0f, 1.0f, "%.2f"); @@ -457,6 +468,32 @@ void EditorUI::renderTexturePaintPanel(EditorApp& app) { ImGui::TextColored(ImVec4(0.5f, 0.9f, 0.5f, 1.0f), "Active: %s", selectedTexture_.c_str()); + // Show textures on chunk under cursor + auto& brush = app.getTerrainEditor().brush(); + if (brush.isActive()) { + if (auto* terrain = app.getTerrainEditor().getTerrain()) { + glm::vec3 bp = brush.getPosition(); + float tileNW_X = (32.0f - static_cast(terrain->coord.y)) * 533.33333f; + float tileNW_Y = (32.0f - static_cast(terrain->coord.x)) * 533.33333f; + int cy = static_cast((tileNW_X - bp.x) / (533.33333f / 16.0f)); + int cx = static_cast((tileNW_Y - bp.y) / (533.33333f / 16.0f)); + cx = std::clamp(cx, 0, 15); + cy = std::clamp(cy, 0, 15); + auto& chunk = terrain->chunks[cy * 16 + cx]; + if (!chunk.layers.empty()) { + ImGui::Separator(); + ImGui::Text("Chunk [%d,%d] layers:", cx, cy); + for (size_t li = 0; li < chunk.layers.size(); li++) { + uint32_t tid = chunk.layers[li].textureId; + std::string tname = (tid < terrain->textures.size()) ? terrain->textures[tid] : "?"; + auto sl = tname.rfind('\\'); + if (sl != std::string::npos) tname = tname.substr(sl + 1); + ImGui::BulletText("%s%s", li == 0 ? "[base] " : "", tname.c_str()); + } + } + } + } + // Recent textures auto& recent = app.getTexturePainter().getRecentTextures(); if (!recent.empty()) {