Skip to content

Add Ctrl+click tool to split edges and floor path segments - #454

Open
gtfrans2re wants to merge 2 commits into
open-rmf:mainfrom
gtfrans2re:gtfrans2re/62-split-edges-and-paths
Open

gtfrans2re wants to merge 2 commits into
open-rmf:mainfrom
gtfrans2re:gtfrans2re/62-split-edges-and-paths

Conversation

@gtfrans2re

Copy link
Copy Markdown

Ctrl + left click on a wall, lane, door, measurement or floor inserts an anchor that splits it: an edge A->B becomes A->C and C->B (the new segment keeps the original edge's properties), and a floor path gets the anchor inserted into its nearest segment.

Closes #62.

New feature implementation

Implemented feature

A tool to split edges and floor path segments, requested in #62. Holding Ctrl and left-clicking on a wall, lane, door or floor inserts an anchor at that point. For an edge A→B this yields two edges A→C and C→B; for a floor the new anchor is inserted into the nearest segment of its path. Both pieces share the new anchor, so dragging it reshapes them.

Implementation description

A single system (handle_split_on_ctrl_click, in crates/rmf_site_editor/src/interaction/split.rs) runs after the selection stage. On Ctrl + left-click it reads the hovered element and the cursor's ground-plane intersection, then:

  • Edges (Edge<Entity>): spawns an anchor projected onto the segment, moves the original edge's end anchor to it (A→C), and duplicates the original entity with clone_and_spawn to produce C→B, so the new segment keeps every property of the original (lane Motion/graphs, wall texture/height, door type, …). Anchor dependents are rewired via ChangeDependent; the Added<..Marker> visual systems regenerate the meshes.
  • Floors (Path<Entity>): inserts the new anchor into the nearest segment of the path (closed loop included). Changed<Path> re-meshes the floor.

Tested on office.building.yaml by splitting walls, lanes and floors and dragging the resulting anchor to confirm each piece is independent and retains its properties.

Scope notes:

  • Covers level-scope elements. Measurements (drawing scope) and lift anchors are deferred, since placing their 2D anchor needs an extra frame transform — happy to add in a follow-up.
  • Ctrl+click also leaves the clicked element selected; normal left-click behaviour is unchanged.

Open questions:

  • The second segment is duplicated via clone_and_spawn with a deny-list (SiteID, Dependents, Children, Selected, Hovered, Selectable). Does anything else on an edge entity need excluding?
  • Would a dedicated interaction mode with a live hover preview be preferred over the single-shot Ctrl+click?

GenAI Use

We follow OSRA's policy on GenAI tools

  • I used a GenAI tool in this PR.
  • I did not use GenAI

Assisted-by: Claude Opus 4.8

Ctrl + left click on a wall, lane, door, measurement or floor inserts an
anchor that splits it: an edge A->B becomes A->C and C->B (the new segment
keeps the original edge's properties), and a floor path gets the anchor
inserted into its nearest segment.

Closes open-rmf#62.

Signed-off-by: gtfrans2re <francoisgonothitoure@gmail.com>
@mxgrey mxgrey added this to PMC Board Oct 13, 2026
@github-project-automation github-project-automation Bot moved this to Inbox in PMC Board Oct 13, 2026
@mxgrey
mxgrey requested a review from arjo129 October 20, 2026 01:26
@mxgrey mxgrey moved this from Inbox to In Review in PMC Board Oct 20, 2026

@muchmirul muchmirul left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please exclude DoorSegments in split_edge()'s clone_and_spawn_with exclusion list.

DoorSegments stores entity IDs for the original door's bodies, cue, and labels. Excluding Children does not clear those references. Because add_door_visuals filters for Without, the cloned door skips visual initialization and does not get independent visuals.

Please add .deny::() and a regression test verifying that splitting a door produces two independently rendered and selectable doors with no shared visual entity IDs.

-assisted by GPT-6-Astra
split.rs, lines 119–124

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

Tool to split edges + path segments

3 participants