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
This commit is contained in:
Kelsi 2026-05-05 06:28:05 -07:00
parent 9555a4a91a
commit 14bb2cf7de

View file

@ -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();