Skip to content

feat(editor): Map ↔ Scenario mode, and the p8-s2 docs (#246) - #532

Merged
JArmandoAnaya merged 1 commit into
mainfrom
feat/p8-s2-finish
Jul 31, 2026
Merged

JArmandoAnaya merged 1 commit into
mainfrom
feat/p8-s2-finish

Conversation

@JArmandoAnaya

Copy link
Copy Markdown
Contributor

Part of #246 (p8-s2). Follows #527, #528, #529, #531. Does not close the issue — see the scope note at the end.

The issue's own acceptance

"Mode switch preserves both documents; placed actors serialize to OpenSCENARIO and round-trip."

The second half landed in #527/#528 with a byte-identical round-trip test. This is the first half.

View ▸ Scenario Mode switches which document is authored. Both stay open: the roads remain visible and selectable for reference, and switching back returns to the map with its undo history intact — which is free, because both documents already share one undo stack.

★ The gate is derived, not hand-written

apply_editor_mode() walks the shortcut registry and gates each action by shortcuts::toolbar_tab_of(). Every tool already declares its toolbar group, and toolbar_violations() fails the build for one that does not — so a tool added by a later pillar is gated correctly the day it lands, with nothing here to update.

A hand-written list would silently leave it enabled in both modes, and nothing would notice: a tool that is merely available when it shouldn't be still works. The test suite asserts the property the derived gate rests on — every Tools row carries a group — so the dependency is explicit rather than incidental.

Two consequences worth stating:

  • The core strip is never withheld. Taking Select or Delete away with the mode would leave the user unable to inspect anything.
  • A tool disabled by a mode switch is also deactivated. Left active it would keep receiving viewport events behind a greyed-out button.

Persistence

The mode persists per scene in <scene>.rmscene.json, not in QSettings — it describes the scene you were working on, not a preference. Restoring it blocks the action's signal, so a restore does not look like the user toggling it and immediately write itself back.

Docs, and what they now admit

GW-6 steps 1–4 are refined to what shipped, and step 1's wording is amended: it said "the scenario toolbar tab activates", describing UI that #377 removed when it replaced the tabbed toolbar with a single flat row. Rather than build a tab to satisfy a stale sentence, the sentence is corrected.

Steps 3 and 4 now carry explicit ⚠ warnings that the Attributes pane rows, the scene-tree branch, actor picking and Delete routing are follow-up work — rather than reading as though they shipped. Step 3's original "distinct from props" also had nothing to contrast against: props are not in the scene tree at all today.

ADR-0014 gains a dated amendment. §9's "teaching the project model about scenario files is p8-s2's" is discharged — the .xosc is derived from the scene's stem and never stored, because a stored copy of a derivable path can only ever disagree with the scene. It also records the two model changes a reader must not miss (the position variant; <PrivateAction>'s second arm and one-element-per-set-arm emission), and the one known asymmetry: a file that omitted @offset gains offset="0" on rewrite.

Verification

  • ctest --preset ci-macos — 3094/3094, exit code checked
  • 6 new tests
  • clang-format clean via CI's exact command

Scope: what remains on #246

Deliberately not claimed as done — viewport picking of actors, Delete routing, the scene-tree scenario branch, and the Attributes pane actor rows. The issue's stated acceptance is met; these are GW-6 refinements and want their own change.

The issue's own acceptance is "mode switch preserves both documents; placed
actors serialize to OpenSCENARIO and round-trip". The second half landed in
#527/#528 with a byte-identical round-trip test; this is the first.

View > Scenario Mode switches which document is authored. BOTH stay open: the
roads remain visible and selectable for reference, and switching back returns
to the map with its undo history intact — which is free, because both documents
already share one undo stack.

★ THE GATE IS DERIVED, NOT HAND-WRITTEN. apply_editor_mode() walks the shortcut
registry and gates each action by shortcuts::toolbar_tab_of(). Every tool
already declares its toolbar group and toolbar_violations() fails the build for
one that does not — so a tool added by a later pillar is gated correctly the day
it lands, with nothing here to update. A hand-written list would silently leave
it enabled in BOTH modes, and nothing would notice: a tool that is merely
available when it should not be still works.

The core strip is never withheld. Taking Select or Delete away with the mode
would leave the user unable to inspect anything.

A tool disabled by a mode switch is also DEACTIVATED. Left active it would keep
receiving viewport events behind a greyed-out button.

The mode persists per SCENE in <scene>.rmscene.json rather than in QSettings: it
describes the scene you were working on, not a preference. Restoring it blocks
the action's signal, so a restore does not look like the user toggling it and
immediately write itself back.

DOCS, AND WHAT THEY NOW ADMIT
GW-6 steps 1-4 are refined to what shipped, and step 1's wording is AMENDED:
it said "the scenario toolbar tab activates", describing UI that #377 removed
when it replaced the tabbed toolbar with one flat row. Steps 3 and 4 now carry
explicit warnings that the Attributes pane rows, the scene-tree branch, actor
picking and Delete routing are follow-up work rather than implying they shipped.
Step 3's original "distinct from props" also had nothing to contrast against —
props are not in the scene tree at all today.

ADR-0014 gains a dated amendment: §9's "teaching the project model about
scenario files is p8-s2's" is discharged (the .xosc is derived from the scene's
stem, never stored), and the two model changes a reader must not miss are
recorded — the position variant, and <PrivateAction> gaining a second arm with
one element emitted per set arm. The one known asymmetry is recorded rather than
hidden: a file that omitted @offset gains offset="0" on rewrite.

Local: ctest 3094/3094 (exit code checked), format clean. 6 new tests.
@JArmandoAnaya
JArmandoAnaya merged commit f09a566 into main Jul 31, 2026
16 checks passed
@JArmandoAnaya
JArmandoAnaya deleted the feat/p8-s2-finish branch July 31, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant