Repository navigation
feat(editor): actor attributes rows and Delete routing (p8-s2) (#246) - #540
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ONEosc::editcommand throughDocument::push_scenario_command, so an actor edit lands on the sameQUndoStackas the roads under it.Deliberately no
ScrubLabelbindings:install_scrubdrives aRoadNetworkpreview session (Document::update_preview) and a scenario holds no arena to preview. The editors commit oneditingFinished, which is the same single-undo contract by a shorter road.Delete routing (
select_tool.cpp):remove_scenario_objectrides 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:
<Orientation><LanePosition>would drop an authored heading and nothing in the round trip would report it<SpeedAction>A speed defined by a
<RelativeTargetSpeed>this version does not model is shown disabled rather than silently overwritten —set_entity_init_speedrefuses 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
PropertiesPanelwas not listening toDocument::scenario_changedat all. It listened tomesh_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 isactor_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-macosclean; 3105/3105ctest --preset ci-macospass.test_panels.cpp, 4 intest_select_tool.cpp.scenario_changedconnection, 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 — soEditingTheAnchorKeepsAnAuthoredOrientationwas added and then confirmed to fail under it.git ls-files '*.cpp' '*.hpp' | xargs clang-format --dry-run --Werrorclean.Refs #246 — the issue stays open until PR A2 (scene-tree scenario branch + viewport actor picking) closes the other two gaps.