Commit graph

202 commits

Author SHA1 Message Date
Kelsi
6a7ea6dcfc feat(editor): in-editor "Audit Spawns Against Terrain" menu
EditorApp::auditSpawnsAgainstTerrain(threshold) counts every
creature + object whose Z is more than `threshold` yards off the
sampled terrain. Returns the issue count; non-mutating.

Generate menu gets a new "Audit Spawns Against Terrain" item that
runs the audit at the default 5y threshold and shows a toast: a
clean count if everything's fine, or the issue count + a hint to
run "Snap All" if not. Surfaces placement bugs without dropping
to the CLI.

Pairs with the existing "Snap All Spawns to Ground" so the
workflow stays inside the editor: audit → see count → snap →
audit again.
2026-05-07 15:47:26 -07:00
Kelsi
bc5d22e357 feat(editor): zone audio panel gets "Play" preview buttons
Adds a small "Play" button next to the music and ambience dropdowns
that hands the selected file off to the OS default audio player —
'open' on macOS, 'xdg-open' on Linux, 'start ""' on Windows.
Buttons only appear when a file is set.

Avoids pulling SDL_mixer (or any new dep) into the editor binary
just for the preview workflow. Designers already have a working
audio player; this just routes the file there with one click
instead of having them hunt through Data/Sound/Music in their file
manager.

Closes the third leg of the original "dropdown + browse + play
audio to hear it" ask: dropdown is the auto-scanned combo from the
prior commit; browse-via-real-files works through the dropdown;
play preview works now via OS shell.
2026-05-07 14:28:52 -07:00
Kelsi
f870a516dd 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."
2026-05-07 14:12:39 -07:00
Kelsi
7a624adada feat(editor): zone audio panel scans Data dir for music + ambience files
The Zone Audio panel previously only offered five hardcoded preset
paths. Replaced with a recursive directory walk of <data>/Sound/
Music and <data>/Sound/Ambience for any .mp3/.wav/.ogg files.
Results cached after the first scan; a Refresh button forces a
rebuild for when the user drops new files in.

Two ImGui combos populate from the scan:
- "Music File"     — picks from Sound/Music
- "Ambience File"  — picks from Sound/Ambience

Each combo has a "(none)" option to clear. Selecting an entry
updates both the manifest field and the existing manual text input
buffer below, so users can fine-tune the path after picking from
the combo.

EditorApp gets a public getDataPath() so the UI can reach the
configured asset root without exposing the rest of the private
state.

Audio playback preview is the remaining piece — needs SDL_mixer
or similar wired into the editor; not in this commit.
2026-05-07 12:43:58 -07:00
Kelsi
89dacba666 feat(editor): in-editor "Random Populate" menu mirrors CLI
Adds EditorApp::randomPopulateZone(creatureCount, objectCount, seed)
and a Generate-menu submenu with sliders for both counts plus a
seed input. Same logic and bestiary as the --random-populate-zone
CLI: 12 creature templates with level jitter, 5 placeholder WMO
prop types with randomized rotation/scale.

Spawns are placed within the loaded tile's world bbox, marked
dirty + auto-save pending so the populated content persists across
restarts.

The CLI command remains for CI / scripting / batch workflows; the
menu serves designers who want to populate from the GUI without
context-switching to a terminal.

Same-seed reproducibility: a hover hint reminds the user that the
seed determines the output deterministically.
2026-05-07 12:14:13 -07:00
Kelsi
bdf2497f46 feat(editor): paint roads to/from selected objects/NPCs
The path tool gains a "Append selected <object|NPC> as path point"
button that captures the currently-selected entity's world position
into pathPoints_. Workflow: place an inn + a town hall, select inn
→ click append, select town hall → click append, click Apply Path.
The road is then drawn between the two object positions.

When no object/NPC is selected, the button area shows a hint
instead. The button auto-kicks pathCapture_ from None into Waiting*
on first use so the user doesn't have to remember the setup
sequence.

Works with the multi-point polyline path tool from the previous
commit — append three or more objects to route a road through them
in order.
2026-05-07 11:59:52 -07:00
Kelsi
4e4102bf4a feat(editor): river/road tool supports multi-point polylines
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Path capture replaced with std::vector<glm::vec3> pathPoints_. The
flow is now: click "Click Start Point" → click terrain for first
point → keep clicking for additional waypoints → press Apply when
done, or Cancel to scrap. Apply iterates each consecutive pair as a
segment, calling carveRiver + paintAlongPath + fillWaterAlongPath
(or flattenRoad for road mode) per segment.

Hard-capped at 64 captured points so a runaway click handler can't
unboundedly grow the polyline. Toast at end reports the segment
count so users see the polyline took.

PathCapture states extended: None / WaitingStart / WaitingEnd /
WaitingMore. Backwards-compatible getPathStart()/getPathEnd()
return first/last points so the existing path-preview wiring keeps
working.
2026-05-07 10:32:19 -07:00
Kelsi
158ab192f0 feat(editor): river tool now fills water along the carved path
The river path tool used to carve the channel and texture the banks
but never added a water layer — users had to manually run
"Fill Water" afterward, which floods the entire tile. The fix is a
new TerrainEditor::fillWaterAlongPath() method that adds water
layers only to chunks the river segment passes through (within
width + chunk-half-diagonal of the line).

Per-chunk water height is set to the chunk's post-carve minimum
terrain height + 0.5y offset so the water sits visibly in the
channel without overflowing onto banks.

The river apply path now invokes carveRiver → paintAlongPath →
fillWaterAlongPath in sequence. Toast updated to mention all three.

Multi-point rivers are still next on the list — the underlying
math takes a single segment today, so a polyline river needs a UI
revamp to capture N points + a per-segment loop. Ack'd, not done
this commit.
2026-05-07 10:17:36 -07:00
Kelsi
ecba93d4a4 fix(editor): NPCs default to Wander behavior + UI tooltip
CreatureSpawn::behavior defaulted to Stationary, so newly placed
NPCs would never move at runtime. The "NPCs do not patrol or
wander, they stay put" complaint was a default-value issue, not a
missing feature — switching the default to Wander (radius 10y)
gets normal NPCs roaming out of the box.

Added a tooltip on the Behavior combo making it explicit that this
is the runtime mode (the editor's preview doesn't run movement
logic; the behavior kicks in once the zone ships and the server
consumes the exported SQL). Lists what each mode means:
Stationary / Patrol / Wander / Scripted.

Existing zones with explicitly-set Stationary NPCs are preserved
on load — only fresh defaults are affected.
2026-05-07 10:03:17 -07:00
Kelsi
3a6f119f7a fix(editor): NPC nameplates align with NPC + togglable to selected only
Three issues fixed in one pass:

1. Z-offset was 35 yards — nameplates floated way above the actual
   NPC position. Dropped to 3.5 yards (just above an average
   creature's head) so the label reads as attached.

2. Horizontal alignment was a fixed -30 px offset, which only looked
   centered for ~6-character names. Switched to ImGui::CalcTextSize
   and centering on the projected position.

3. Nameplates were always-on, which got noisy fast on populated
   zones. Added "Nameplate on selected only" checkbox in the NPC
   panel (default ON); when unchecked, all NPCs show their names.

Vertical position also slightly tightened (sy - textSz.y - 2 vs
sy - 10) so the text baseline aligns rather than floating below.
2026-05-07 09:48:59 -07:00
Kelsi
0e2b55f9fd fix(editor): crater button now click-to-place on terrain
The "Create Crater at Cursor" button used the brush's last hover
position, which was stale by the time the user clicked the button —
the cursor had to move onto the button itself, dragging the brush
position along with it. Result: crater spawned somewhere between
where the user wanted and the button.

New flow: button arms a "click on terrain to place crater" mode
(captures the user's chosen radius/depth/rim at arm time). The next
left-click anywhere on terrain spawns the crater at the actual click
position, regardless of brush state. Button label changes to "ARMED
— click on terrain to place" while waiting, with a Cancel button +
Esc to dismiss.

Misses on terrain leave the mode armed so the user can retry without
re-pressing the button.
2026-05-07 09:34:17 -07:00
Kelsi
00717543a8 feat(editor): preset selection auto-fills sensible AzerothCore faction
When a user picks a creature preset, faction stays 0 (server treats this
as 'use template') unless the user already typed a value. Now defaults
based on the preset category:
  Critter        -> 250 (critter, indifferent to all)
  hostile preset -> 14  (monster, hostile to all)
  friendly preset -> 35  (friendly to all)
Means picking 'Wolf' from the preset list immediately produces a hostile
NPC that actually attacks players in-game without further configuration.
2026-05-06 04:48:30 -07:00
Kelsi
882321863a feat(editor): NPC template + selected-NPC editor expose Respawn (s) input
The respawnTimeMs field was loaded/saved/exported but never editable
through the UI. Added a DragFloat showing seconds (range 5-86400) in
both the template and the selected-NPC editors. SQL export already
divides by 1000 for AzerothCore's spawntimesecs column.
2026-05-06 04:21:42 -07:00
Kelsi
8d006b6b86 feat(editor): selected-NPC editor gains Mana / Min Dmg / Max Dmg / Armor inputs
Last batch of stat fields missing from the selected-NPC editor. Now any
property a user could set on the template can also be edited on an
already-placed NPC, without removing and re-placing.
2026-05-06 04:18:25 -07:00
Kelsi
a7ab2756d6 feat(editor): selected-NPC editor gains role flag checkboxes
Adds Hostile/Quest/Vendor/Inn/Train/Bank/Auc/Repair/Flight checkboxes
to the selected-NPC editor matching the template editor's set. Lets
users toggle these on already-placed NPCs without removing and
re-placing them.
2026-05-06 04:17:31 -07:00
Kelsi
9625201952 feat(editor): selected-NPC editor gains Faction input (parity with template) 2026-05-06 04:15:39 -07:00
Kelsi
4e01dd5553 feat(editor): NPC template gains Faction ID input with common-value tooltip
The CreatureSpawn struct has a faction field that was already exported
to creature_template.faction but wasn't editable. Added an InputInt with
a tooltip listing the common AzerothCore FactionTemplate IDs (Stormwind,
Monster, Beast, Friendly, Critter, etc.) so users can pick the right
hostility/disposition without referencing the DBC manually.
2026-05-06 04:14:33 -07:00
Kelsi
99aaab3aa8 feat(editor): add Trainer/Banker/Auctioneer/Repair NPC flags + SQL export
CreatureSpawn struct gains four AzerothCore-standard NPC flag bits:
  trainer    -> npcflag 0x10
  repair     -> npcflag 0x1000
  banker     -> npcflag 0x20000
  auctioneer -> npcflag 0x200000
Saved/loaded via the JSON spawn file, exported to creature_template.npcflag,
exposed as checkboxes in the NPC template panel. Lets users build full
city NPCs (city auctioneer, weapon trainer, etc.) without dropping to SQL.
2026-05-06 04:03:23 -07:00
Kelsi
bc6e60c6e9 polish(editor): placement scale slider matches selected-object range (0.1-50) 2026-05-06 04:00:07 -07:00
Kelsi
a156b6246e polish(editor): NPC selected-editor Facing slider shows 'deg' unit (matches template) 2026-05-06 03:59:10 -07:00
Kelsi
32ff80f177 feat(editor): texture panel shows total pool count + dir count 2026-05-06 03:48:37 -07:00
Kelsi
f4805b8e69 feat(editor): object panel shows total pool count for M2/WMO assets
Helps users understand the search base — 'Pool: 1234 M2  56 WMO' tells
them why their filter might be matching too many results, and gives a
quick view into how much asset variety the loaded data has.
2026-05-06 03:47:54 -07:00
Kelsi
f022459971 fix(editor): NPC template scale slider matches selected-NPC editor range (0.1-50)
Template was a SliderFloat 0.5-10 while the selected-NPC editor uses
DragFloat 0.1-50. Inconsistent ceilings made it surprising that an NPC
could be scaled higher after placement than during placement. Now both
use DragFloat with the same range.
2026-05-06 03:30:30 -07:00
Kelsi
248dcd4eb4 feat(editor): quest objective limit raised to 10 (matches SQL slot capacity)
UI was capped at 4 but the SQL exporter writes RequiredNpcOrGo[1..4] +
RequiredItemId[1..6] = 10 total slots. Allowing 10 lets users define
mixed kill+collect quests fully.
2026-05-06 03:13:26 -07:00
Kelsi
ce778ed674 feat(editor): patrol waypoint reorder (up/dn) + insert-after-cursor (+after)
Previously waypoints could only be appended or removed; reordering meant
clearing and re-adding the whole path. Now each waypoint row has up/dn
swap buttons and a +after that inserts a new waypoint at the current
brush cursor right after this index — slicing long segments doesn't
require redoing the rest of the path.
2026-05-06 03:12:45 -07:00
Kelsi
7822790c60 feat(editor): status bar asterisk also reflects unsaved object/NPC/quest changes 2026-05-06 03:01:09 -07:00
Kelsi
7b2cbcfc92 feat(editor): status bar shows cursor world position alongside camera
Cam in dim yellow, cursor (when brush is on terrain) in cyan. Useful for
quickly noting positions where to drop spawns/objects without flying over
to read the brush coords manually.
2026-05-06 02:56:10 -07:00
Kelsi
0f42ebab3d feat(editor): quest objectives now have a Target ID field + spawn picker
The SQL exporter writes objective targets to RequiredNpcOrGo/RequiredItem
slots based on the objective's targetName field, but the UI never let
the user fill that field. Added an InputText for Target ID and, for Kill
objectives, a dropdown that auto-fills with the entry of any placed NPC.
2026-05-06 02:51:12 -07:00
Kelsi
469f046db5 feat(editor): NPC list shows hostile/friendly/questgiver/vendor counts
Helps users see at-a-glance the makeup of their zone's creature pop
without having to scroll the list looking at each entry's flags.
2026-05-06 02:41:23 -07:00
Kelsi
22c9bc354c feat(editor): placed-object list also has name filter (parity with NPC list) 2026-05-06 02:34:41 -07:00
Kelsi
590ec6b3a3 feat(editor): NPC spawn list has name filter for fast lookup
A zone with 50+ creatures made finding a specific spawn tedious. Added
a case-insensitive name-filter input above the list, capped at 200
visible entries with a 'refine filter' hint when exceeded.
2026-05-06 02:34:05 -07:00
Kelsi
49b7268dc9 feat(editor): show camera (x,y,z) in status bar
Helpful for navigation and noting positions for spawn placement, plus
diagnostic value when debugging coordinate issues. Shown only after a
terrain is loaded.
2026-05-06 02:10:50 -07:00
Kelsi
f6187e7f9a feat(editor): expose Display ID field in selected-NPC editor
SQL export uses CreatureSpawn.displayId for creature_template.modelid1.
Without it AzerothCore can't render the creature in-game. Added an
InputInt + warning text so users can set the displayId manually until
auto-discovery from CreatureDisplayInfo.dbc lands.
2026-05-06 01:57:49 -07:00
Kelsi
9eae67d574 feat(editor): NPC scatter snaps each spawn to ground when enabled
The scatter tool spawned creatures all at the cursor's z-height which
made them hover when scattered over uneven terrain. Added a Snap to
Ground checkbox (defaults to on) that raycasts each scattered NPC and
places it on the actual surface.
2026-05-06 01:35:26 -07:00
Kelsi
b49cb344ac feat(editor): NPC context menu adds Snap to Ground and Face Camera
Right-click context menu on a selected NPC now mirrors the object menu:
Snap to Ground drops it to terrain elevation, Face Camera rotates the NPC
to face the current camera position. Also annotates Duplicate with the
Ctrl+D shortcut hint.
2026-05-06 01:30:27 -07:00
Kelsi
09f573c6ee feat(editor): patrol UI shows loop length and per-point wait time editor
The patrol list now shows total loop distance and gives each waypoint a
draggable wait-time field (0-60s). Helps tune patrol pacing without re-saving
the JSON manually.
2026-05-06 01:27:50 -07:00
Kelsi
700416b2c7 feat(editor): scale slider in selected-NPC editor
Once an NPC is placed there was no way to resize it without removing and
re-placing. Added a Scale DragFloat in the selected-creature editor with
the same 0.1-50 range used for placed objects.
2026-05-06 01:23:42 -07:00
Kelsi
7c4afdbca4 feat(editor): double-click in NPC/object list flies camera to entry
Single-click selects, double-click also flies to. Removes the trip back to
the side panel to hit the Fly To button when navigating long lists.
2026-05-06 01:22:44 -07:00
Kelsi
f39869ef6a docs(editor): document new shortcuts in F1 Keyboard Shortcuts dialog
Adds Ctrl+D duplicate, Ctrl+Wheel rotation, NPC click-to-select, and
W-for-waypoint to the help text so users discover the new bindings.
2026-05-06 01:17:57 -07:00
Kelsi
35ad340ccc feat(editor): facing arrow on NPC markers + Ctrl+Wheel hint in object panel
NPC markers now show a yellow ground-triangle pointing in the orientation
direction so users can see facing without selecting. Object panel gained
the Ctrl+Wheel rotation hint to match the NPC panel.
2026-05-06 01:08:32 -07:00
Kelsi
191ff9ec16 feat(editor): NPC orientation control + Ctrl+Wheel rotates placement preview
Added orientation slider in NPC panel with random button. Ctrl+Wheel now
rotates the placement preview (objects and NPCs) instead of zooming —
Shift makes the step finer (5 deg vs 15 deg). Ghost preview now shows
the actual orientation that the placed NPC will have.
2026-05-06 00:56:19 -07:00
Kelsi
d773109b50 feat(editor): WMO-only instance loading (Dire Maul, dungeons, raids)
Many WoW instances (Dire Maul, Blackrock Depths, etc.) are WMO-only
maps with no ADT terrain tiles. The editor now handles these:

- loadWMOInstance(): reads WDT, detects WDTF_GLOBAL_WMO flag, loads
  the root WMO path from MWMO chunk, places it as an object with
  correct position/rotation from MODF chunk
- Automatic fallback: when loadADT fails to find tiles, tries
  WMO-only loading before showing error
- Load dialog: "Find Tile" detects WMO-only instances and shows
  "WMO-only instance — click Load to open" instead of "not found"
- Camera positioned near the WMO for immediate editing
- Blank terrain floor generated as ground reference
2026-05-05 22:44:38 -07:00
Kelsi
92787901d8 feat(editor): tile count button in ADT load dialog
"Count" button next to "Find Tile" scans all 64x64 tile coordinates
and shows how many ADT tiles exist for the selected map. Helps users
understand the scope of a map before loading individual tiles.
2026-05-05 22:23:18 -07:00
Kelsi
e287cc9a78 fix(editor): shrink NPC markers, add show/hide toggle
- NPC markers reduced from 30-unit poles to 8-unit poles (was
  overwhelming and obscuring terrain). Base 1.5u, diamond top 1u
- "Show Position Markers" checkbox in NPC panel to toggle visibility
- Markers hidden when checkbox unchecked — useful when M2 creature
  models are rendering and markers are redundant
- Marker alpha reduced for less visual noise
2026-05-05 22:11:53 -07:00
Kelsi
110f250150 feat(editor): biome vegetation auto-population system
One-click procedural object placement based on biome rules:

- 10 biome vegetation rulesets with density, scale range, and slope
  constraints per asset type (trees, bushes, rocks, ferns, etc.)
- Grassland: pine trees + bushes + rocks
- Forest: ashenvale trees + ferns + forest rocks (dense canopy)
- Jungle: palm trees + ferns + vines (high density)
- Desert: cacti + desert rocks + bones (sparse)
- Barrens: scattered trees + dry bushes + rocks
- Snow: snow pines + snowdrifts + rocks
- Swamp: dark trees + mushrooms + logs
- Rocky: rock formations + rock piles
- Beach: palm trees + beach rocks
- Volcanic: lava rocks + charred trees

Objects panel > Auto-Populate Biome: select biome, set seed, click
"Populate Zone" to fill the entire tile with biome-appropriate
vegetation at rule-defined densities.
2026-05-05 16:42:41 -07:00
Kelsi
0d401c3eb8 docs: document server module generator in CHANGELOG, README, help panel
- CHANGELOG: add server module generator description
- README: add AzerothCore integration paragraph with feature summary
- Help panel (F1): add "File → Generate Server Module" to export section
2026-05-05 16:34:40 -07:00
Kelsi
cceff622b4 feat(editor): AzerothCore server module generator
One-click generation of a complete AzerothCore/TrinityCore server module
from editor zone data. File > Generate Server Module creates:

- sql/01_map.sql: map_dbc + area_table_dbc registration
- sql/02_spawns.sql: creature_template + creature + waypoint_data + quests
- sql/03_teleport.sql: game_tele entry for .tele command
- sql/04_zone_flags.sql: sanctuary/PvP area flags
- conf/mod_wowee.conf.dist: worldserver.conf snippet with zone settings
- README.md: step-by-step server admin installation guide
- module.json: machine-readable module manifest

Server admins can import the SQL files, add the config snippet, and
restart their server to have the custom zone fully operational with
NPC spawns, patrol paths, quests, teleport commands, and zone flags.
2026-05-05 16:31:13 -07:00
Kelsi
b19627d82c feat(editor): SQL spawn export for AzerothCore/TrinityCore
Private server integration: export creature spawns, patrol waypoints,
and quest definitions as ready-to-import SQL for AzerothCore/TrinityCore.

- creature_template: name, level, health, mana, damage, armor, faction,
  npcflag (questgiver/vendor/flightmaster/innkeeper), displayId, scale
- creature: spawn position, orientation, respawn time, wander distance,
  movement type (stationary/wander/patrol)
- creature_addon + waypoint_data: patrol path waypoints with delays
- quest_template: title, description, completion text, level, XP, money
- All use ON DUPLICATE KEY UPDATE for safe re-imports
- Auto-exported as spawns.sql alongside other assets on zone save
- File > Export Server SQL menu item for standalone export
- Map ID from zone metadata panel used in spawn table
2026-05-05 16:06:34 -07:00
Kelsi
84a431880e feat(editor): zone map image export (colored top-down PNG)
- exportZoneMap(): renders terrain as colored top-down image with
  height-based coloring (blue lowlands → green plains → brown hills →
  white peaks), water overlay, hole visualization, doodad markers
- Configurable resolution (128-2048px, default 512)
- Auto-exported as zone_map.png alongside other assets on save
- File > Export Zone Map menu with resolution slider
- Useful for documentation, server admin tools, custom map websites
2026-05-05 16:01:29 -07:00
Kelsi
9db5cced2c feat(editor): zone metadata panel with mapId, displayName, gameplay flags
- Map ID: configurable integer input (0-65535) for private server
  integration. Custom zones default to 9000+ to avoid Blizzard conflicts
- Display Name: editable text field for in-game world map/loading screen
- Description: multi-line text field for zone documentation
- Zone Flags: Allow Flying, PvP Enabled, Indoor, Sanctuary checkboxes
- All fields serialized to zone.json under "flags" key
- Info panel shows quest count alongside objects/NPCs
2026-05-05 15:52:59 -07:00