feat(editor): terrain holes, recent textures, sculpt panel polish

- Punch Hole / Fill Hole buttons in Sculpt panel: creates terrain
  holes (4x4 bitmask) for cave entrances, mine shafts, etc.
  Uses brush radius to determine affected area.
- Recent Textures: paint panel shows last 6 used textures as quick-
  select buttons (no need to re-search the full list)
- Holes saved in ADT format (MCNK holes field) and respected by
  the mesh generator (triangles skipped at hole positions)
This commit is contained in:
Kelsi 2026-05-05 04:34:03 -07:00
parent cc6a72e7b2
commit f5fe9a0101
5 changed files with 93 additions and 0 deletions

View file

@ -230,6 +230,15 @@ void EditorUI::renderBrushPanel(EditorApp& app) {
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Set target height from cursor position");
}
ImGui::Separator();
ImGui::Text("Terrain Holes (cave entrances):");
auto& brush = app.getTerrainEditor().brush();
if (ImGui::Button("Punch Hole", ImVec2(120, 0)) && brush.isActive())
app.getTerrainEditor().punchHole(brush.getPosition(), s.radius);
ImGui::SameLine();
if (ImGui::Button("Fill Hole", ImVec2(120, 0)) && brush.isActive())
app.getTerrainEditor().fillHole(brush.getPosition(), s.radius);
ImGui::Separator();
auto& hist = app.getTerrainEditor().history();
ImGui::Text("Undo: %zu Redo: %zu", hist.undoCount(), hist.redoCount());
@ -304,6 +313,25 @@ void EditorUI::renderTexturePaintPanel(EditorApp& app) {
if (!selectedTexture_.empty())
ImGui::TextColored(ImVec4(0.5f, 0.9f, 0.5f, 1.0f), "Active: %s",
selectedTexture_.c_str());
// Recent textures
auto& recent = app.getTexturePainter().getRecentTextures();
if (!recent.empty()) {
ImGui::Separator();
ImGui::Text("Recent:");
for (int i = 0; i < static_cast<int>(recent.size()) && i < 6; i++) {
std::string disp = recent[i];
auto sl = disp.rfind('\\');
if (sl != std::string::npos) disp = disp.substr(sl + 1);
if (ImGui::SmallButton(disp.c_str())) {
selectedTexture_ = recent[i];
app.getTexturePainter().setActiveTexture(recent[i]);
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("%s", recent[i].c_str());
if (i < 5 && i + 1 < static_cast<int>(recent.size())) ImGui::SameLine();
}
}
}
ImGui::End();
}