calic 30f38d771f feat(map-editor): v0.2.0c — transform controls + Direct-mode override paint
State + actions:
 - active_flip (0/1) joins active_rot (0..3). Combined the two cover
   all 8 D4 orientations; single Flip button is sufficient (H+V
   would be redundant).
 - toggle_flip / reset_transform / paint_override_at /
   erase_override_at.

Toolbar:
 - New Flip (H) + Reset (0) buttons next to Rotate (R).
 - Status chip extended with `slot=N rot=N flip=N` indicator.

Paint:
 - Direct-mode + LMB on canvas now calls maps.set_override on the
   active material-bound terrain layer. Bare slot int when canonical
   (rot=0+flip=0), {slot, rot, flip} object otherwise — matches the
   v0.5.1 override-format extension. Palette slot 1..14 maps to lib
   slot 0..13 (palette is user-friendly 1-based; lib API is 0-based).
 - Direct-mode + RMB on canvas calls maps.clear_override.
 - Auto-Tile mode unchanged; transform state is ignored there (the
   renderer derives slot/rot/flip from the vertex bitmask).

Hotkeys:
 - h -> flip (new)
 - 0 -> reset_transform (new)
 - r continues to cycle rotation CW; Shift+R for CCW is out because
   lib-core.input has no modifier-combo support (deferred).

Cheatsheet rows updated.
2026-05-29 00:46:08 +02:00

sporel-module-map-editor

Interactive map editor for v2 Sporel map files. Click-to-paint, vertical layer-chip overlay on the left edge, collapsible atlas+tile picker bottom-left.

Run

Default — edit the module's in-place work map:

bash scripts/run-map-editor.sh

With a target — copy a real map in, edit, copy back out:

bash scripts/run-map-editor.sh ~/Projects/Sporel/sporel-modules/spine-prototype/maps/demo.map.json

UI

  • Layer chips (left edge, vertical): top-of-stack down. Rf at top toggles roof-edit mode; the other eight chips select the active layer.
    • Left-click = set active layer (or toggle roof mode)
    • Right-click = toggle layer visibility (Rf chip ignores right-click)
  • Atlas + tile picker (bottom-left): collapsed chip shows the active tile. Click to expand; click again or outside to collapse.
  • Status chip (bottom-right): current mouse-cell coordinate plus a * when the map has unsaved changes.

Hotkeys

Key Action
Left click on map Paint cell with active tile (or set roof flag in roof-mode)
E Erase the cell under the mouse
R Cycle rotation 0 → 1 → 2 → 3 → 0
S Save to disk (overwrites the work map)
Esc Quit

Limitations (v0.1.0)

  • Tile thumbnails in the picker render as gray placeholders with tile-IDs as text — lib-core.maps v0.4.0 does not expose per-tile UVs to Lua, so visual thumbnails are a v0.2.0 task.
  • Atlas list in the picker is purely informational; if a map declares multiple atlases, the active atlas is set from state.lua defaults at startup and cannot yet be switched via UI (v0.2.0 hit-tests inside the expanded picker).
  • Engine bindings engine.render.draw_rect_lines and engine.render.draw_line are not yet registered — active-chip borders, hidden-layer strikethroughs, and the entity-slot divider will trigger runtime errors when their code paths execute. Adding the bindings is a small engine-side follow-up.
  • No undo/redo, no multi-tile brush, no entity placement, no heightmap editing — see the design spec §1 for the full out-of-scope list.

Spec

docs/superpowers/specs/2026-05-23-sporel-module-map-editor-design.md in the sporel-meta repo.

Description
Interactive map editor for v2 Sporel map files.
Readme 603 KiB
Languages
Lua 98.3%
Shell 1.7%