feat(editor): object scatter, camera bookmarks, shortcut hints

- Object scatter tool: place N copies of selected M2/WMO in a radius
  with random rotation and scale range (Min/Max Scale slider)
- Camera bookmarks: F5 saves current position, View > Load Bookmark
  to jump back — useful for working on different parts of a large zone
- Shortcut hints shown at bottom of Object panel
  (G=move, R=rotate, T=scale, Del=remove)
- DragFloatRange2 for min/max scale in scatter UI
This commit is contained in:
Kelsi 2026-05-05 04:20:26 -07:00
parent 48026421c9
commit 5daa359e74
5 changed files with 90 additions and 0 deletions

View file

@ -94,6 +94,16 @@ void EditorUI::renderMenuBar(EditorApp& app) {
bool wf = app.isWireframe();
if (ImGui::MenuItem("Wireframe", "F3", &wf)) app.setWireframe(wf);
if (ImGui::MenuItem("Reset Camera")) app.resetCamera();
ImGui::Separator();
if (ImGui::MenuItem("Save Bookmark", "F5")) app.saveBookmark("");
auto& bmarks = app.getBookmarks();
if (!bmarks.empty() && ImGui::BeginMenu("Load Bookmark")) {
for (int i = 0; i < static_cast<int>(bmarks.size()); i++) {
if (ImGui::MenuItem(bmarks[i].name.c_str()))
app.loadBookmark(i);
}
ImGui::EndMenu();
}
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();
@ -379,6 +389,32 @@ void EditorUI::renderObjectPanel(EditorApp& app) {
if (ImGui::Button("Deselect", ImVec2(100, 0)))
placer.clearSelection();
}
ImGui::Separator();
// Object scatter
if (ImGui::CollapsingHeader("Scatter Objects")) {
static int objScatterCount = 8;
static float objScatterRadius = 60.0f;
static float objMinScale = 0.8f;
static float objMaxScale = 1.5f;
ImGui::SliderInt("Count##objsc", &objScatterCount, 1, 50);
ImGui::SliderFloat("Radius##objsc", &objScatterRadius, 10.0f, 300.0f);
ImGui::DragFloatRange2("Scale##objsc", &objMinScale, &objMaxScale, 0.05f, 0.1f, 10.0f);
auto& brush = app.getTerrainEditor().brush();
if (ImGui::Button("Scatter at Cursor##obj", ImVec2(-1, 0))) {
if (brush.isActive() && !placer.getActivePath().empty()) {
placer.scatter(brush.getPosition(), objScatterRadius,
objScatterCount, objMinScale, objMaxScale);
app.markObjectsDirty();
}
}
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1),
"Scatters selected model with random rotation/scale");
}
ImGui::Separator();
ImGui::TextColored(ImVec4(0.7f, 0.9f, 0.7f, 1), "Left-click: place | Ctrl+click: select");
ImGui::TextColored(ImVec4(0.7f, 0.9f, 0.7f, 1), "G: move | R: rotate | T: scale | Del: remove");
}
ImGui::End();
}