From 14bb2cf7de21ba770fbbb82919c9ef3dee40830d Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 5 May 2026 06:28:05 -0700 Subject: [PATCH] feat(editor): one-click flatten platform for building sites - "Create Flat Platform at Cursor" button in Sculpt panel - Instantly flattens terrain under brush radius to cursor height - Perfect for creating building sites, road beds, camp grounds - Applies 30 iterations of flatten for a thorough result - Restores previous brush mode after completion --- tools/editor/editor_ui.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/editor/editor_ui.cpp b/tools/editor/editor_ui.cpp index 3cf9c9ad..b519af81 100644 --- a/tools/editor/editor_ui.cpp +++ b/tools/editor/editor_ui.cpp @@ -484,6 +484,24 @@ void EditorUI::renderBrushPanel(EditorApp& app) { ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1), "No stamp copied"); } + if (ImGui::CollapsingHeader("Flatten Platform")) { + auto& brush3 = app.getTerrainEditor().brush(); + if (ImGui::Button("Create Flat Platform at Cursor", ImVec2(-1, 0)) && brush3.isActive()) { + // Flatten all vertices under brush to the cursor height + auto& te = app.getTerrainEditor(); + float targetZ = brush3.getPosition().z; + te.brush().settings().flattenHeight = targetZ; + auto savedMode = te.brush().settings().mode; + te.brush().settings().mode = BrushMode::Flatten; + // Apply flatten for several frames worth + for (int i = 0; i < 30; i++) te.applyBrush(0.1f); + te.brush().settings().mode = savedMode; + app.showToast("Platform created"); + } + ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1), + "Flattens area under brush to cursor height.\nGood for building sites, roads, camps."); + } + ImGui::Separator(); ImGui::Text("Terrain Holes (cave entrances):"); auto& brush = app.getTerrainEditor().brush();