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:
Kelsi 2026-05-07 14:12:39 -07:00
parent f589fa20ce
commit f870a516dd
3 changed files with 50 additions and 0 deletions

View file

@ -102,6 +102,10 @@ public:
// tile's world bbox. Mirrors the --random-populate-zone CLI
// command so users can do bulk population from inside the editor.
void randomPopulateZone(int creatureCount, int objectCount, uint32_t seed);
// Re-snap every creature + object Z to actual terrain. In-editor
// mirror of the --snap-zone-to-ground CLI; useful after terrain
// edits or random population to fix floating/buried spawns.
void snapAllSpawnsToGround();
void centerOnTerrain();
// Multi-tile support