Skip to content

feat(editor): actor attributes rows and Delete routing (p8-s2) (#246) - #540

Merged
JArmandoAnaya merged 1 commit into
mainfrom
feat/p8-s2-gaps-attributes
Aug 1, 2026
Merged

JArmandoAnaya merged 1 commit into
mainfrom
feat/p8-s2-gaps-attributes

Conversation

@JArmandoAnaya

Copy link
Copy Markdown
Contributor

Two of the four gaps that kept #246 open after its five merged PRs — GW-6 step 3's Attributes-pane rows and step 4's Delete routing. Both are pure editor binding: the kernel surface (osc::edit::*) already existed and is unchanged here.

What lands

The Actor section (properties_panel.{hpp,cpp}) shows name, category, the lane anchor (road / lane / s / offset), the bounding box and the initial speed. Each editor commits ONE osc::edit command through Document::push_scenario_command, so an actor edit lands on the same QUndoStack as the roads under it.

Deliberately no ScrubLabel bindings: install_scrub drives a RoadNetwork preview session (Document::update_preview) and a scenario holds no arena to preview. The editors commit on editingFinished, which is the same single-undo contract by a shorter road.

Delete routing (select_tool.cpp): remove_scenario_object rides the same macro as the road deletions, which is what makes a mixed road+actor selection one undo step rather than two. Liveness for an actor is checked against the scenario, not the arena — an actor is a <ScenarioObject @name> and has no generational handle to go stale.

Three things travel through an edit untouched

Each has its own test, and each was confirmed by sabotage:

Carried through Why it is not the value being edited
the position's <Orientation> the four widgets author the anchor and nothing else; a freshly built <LanePosition> would drop an authored heading and nothing in the round trip would report it
the bounding box's centre a vehicle's reference point is the centre of the rear axle, not the body centre — losing it makes the drawn box straddle the wrong end
an absent <SpeedAction> an actor showing 0 m/s commits nothing; materializing the element would cost the scenario its byte-identical re-save

A speed defined by a <RelativeTargetSpeed> this version does not model is shown disabled rather than silently overwritten — set_entity_init_speed refuses it, so the pane does not offer an edit the kernel will reject.

The anchor rows appear only for a <LanePosition>. Retyping a position drops the old element's preserved tier (set_entity_init_pose's contract), so the pane never converts a world or road position implicitly; it reports what the position is instead.

Two findings

PropertiesPanel was not listening to Document::scenario_changed at all. It listened to mesh_changed, and a scenario command emits no mesh change — so a rename pushed from this very pane would not have repainted its own rows, and neither would an undo. Connected here.

The dispatch order matters, but not for the reason it looks like. refresh() decides the actor path first. An actor entry carries no arena ids, so every id-based test further down is false for one and the dispatch would still be reached from inside the no-road branch — the rows would show. What would not run is actor_group_->hide(): nested in that branch it never fires for a road, a lane, a prop or a signal, and the actor rows survive into the next selection. Measured: relocating the block leaves the show working and breaks exactly that. The comment says so rather than the plausible-but-wrong version I first wrote.

Verification

  • cmake --build --preset ci-macos clean; 3105/3105 ctest --preset ci-macos pass.
  • 6 new gtests in test_panels.cpp, 4 in test_select_tool.cpp.
  • Six sabotages, six caught: reordering the dispatch, dropping the scenario_changed connection, rebuilding the bounding box instead of copying it, dropping the zero-speed guard, removing the Delete actor arm, and rebuilding the <LanePosition> instead of copying it. The last one initially caught nothing — the orientation was untested, not undefended — so EditingTheAnchorKeepsAnAuthoredOrientation was added and then confirmed to fail under it.
  • git ls-files '*.cpp' '*.hpp' | xargs clang-format --dry-run --Werror clean.

Refs #246 — the issue stays open until PR A2 (scene-tree scenario branch + viewport actor picking) closes the other two gaps.

Two of the four gaps that kept #246 open after its five merged PRs: GW-6
step 3's Attributes-pane rows and step 4's Delete routing. Both are pure
editor binding — the kernel surface (osc::edit) already existed and is
unchanged here.

The Actor section shows name, category, the lane anchor (road / lane / s /
offset), the bounding box and the initial speed. Each editor commits ONE
osc::edit command through Document::push_scenario_command, so an actor edit
lands on the same QUndoStack as the roads under it. No ScrubLabel bindings:
install_scrub drives a RoadNetwork preview session and a scenario holds no
arena to preview.

Three things travel through an edit untouched, and each has its own test:
the position's <Orientation> (the four widgets author the anchor and nothing
else), the bounding box's centre (the reference point of a vehicle is the
rear axle, not the body centre), and a <SpeedAction> that is absent — an
actor showing 0 m/s commits nothing, because materializing the element would
cost the scenario its byte-identical re-save.

refresh() dispatches the actor path first. Not because a later dispatch
could not show the rows, but because actor_group_->hide() has to sit on the
path every other selection takes; relocating the block into the no-road
branch leaves the show working and breaks exactly that (measured).

PropertiesPanel now listens to Document::scenario_changed. It listened to
mesh_changed only, and a scenario command emits no mesh change — so a rename
pushed from this very pane did not repaint its own rows.

Delete reaches a second command layer: remove_scenario_object rides the same
macro as the road deletions, which is what makes a mixed selection one undo
step rather than two. Liveness for an actor is checked against the scenario,
not the arena — an actor is a <ScenarioObject @name> with no generational
handle to go stale.

Refs #246.
@JArmandoAnaya
JArmandoAnaya merged commit cd1043a into main Aug 1, 2026
16 checks passed
@JArmandoAnaya
JArmandoAnaya deleted the feat/p8-s2-gaps-attributes branch August 1, 2026 00:36
@JArmandoAnaya JArmandoAnaya mentioned this pull request Aug 1, 2026
3 of 8 tasks
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