mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-08 10:03:51 +00:00
feat(editor): in-editor "Snap All Spawns to Ground" menu
Adds EditorApp::snapAllSpawnsToGround() and a menu item under Generate, mirroring the --snap-zone-to-ground CLI for users who want the action without context-switching to a terminal. Walks every NPC + object, casts a downward ray from baseZ+500y, and writes the hit Z into spawn.position.z. Patrol waypoints on each NPC are snapped too. Marks the project dirty + auto-save pending so the change persists without a manual Ctrl+S. Existing per-selection "Snap Ground" button on the right panel is unchanged; this is the bulk version for "I just edited terrain under a populated area."
This commit is contained in:
parent
f589fa20ce
commit
f870a516dd
3 changed files with 50 additions and 0 deletions
|
|
@ -395,6 +395,14 @@ void EditorUI::renderMenuBar(EditorApp& app) {
|
|||
"Same seed → same population (reproducible)");
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::MenuItem("Snap All Spawns to Ground", nullptr, false,
|
||||
app.hasTerrainLoaded())) {
|
||||
app.snapAllSpawnsToGround();
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip(
|
||||
"Re-snap every creature + object's Z to actual terrain height.\n"
|
||||
"Run after terrain edits to fix floating/buried spawns.");
|
||||
if (ImGui::MenuItem("Clear All Objects/NPCs", nullptr, false, app.hasTerrainLoaded())) {
|
||||
if (app.getObjectPlacer().objectCount() > 0 || app.getNpcSpawner().spawnCount() > 0)
|
||||
app.clearAllObjects();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue