Skip to content

Rebuild adjoining room geometry when pasting sectors near portals#1195

Open
Copilot wants to merge 2 commits into
developfrom
copilot/fix-roomgeometry-update-issue
Open

Rebuild adjoining room geometry when pasting sectors near portals#1195
Copilot wants to merge 2 commits into
developfrom
copilot/fix-roomgeometry-update-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 19, 2026

Pasting sector geometry next to a wall portal could leave the connected room with stale/missing faces. The paste path was only rebuilding rooms when pasted sectors directly contained portal data, which missed geometry changes adjacent to the portal boundary.

  • Scope affected rooms from the pasted area

    • Compute the pasted rectangle up front.
    • Include adjoining rooms found from pastedArea.Inflate(1) so paste near a portal rebuilds both sides consistently.
    • Capture undo for the full affected room set instead of only the selected room.
  • Use the normal geometry rebuild path

    • Replace the ad hoc portal-room rebuild logic in TryPasteSectors(...) with SmartBuildGeometry(...).
    • This makes sector paste follow the same rebuild behavior as other geometry edits around portals.
  • Preserve editor notifications

    • Continue notifying the selected room for sector property changes.
    • Emit geometry change notifications for affected adjoining rooms after the smart rebuild.
var pastedArea = new RectangleInt2(x0, z0, x1 - 1, z1 - 1);
var affectedRooms = _editor.SelectedRoom.GetAdjoiningRoomsFromArea(pastedArea.Inflate(1));
affectedRooms.Add(_editor.SelectedRoom);

_editor.UndoManager.PushGeometryChanged(affectedRooms);

SmartBuildGeometry(_editor.SelectedRoom, pastedArea);

Copilot AI changed the title [WIP] Fix RoomGeometry update issue near portals Rebuild adjoining room geometry when pasting sectors near portals Apr 19, 2026
Copilot AI requested a review from Nickelony April 19, 2026 20:36
@Nickelony Nickelony added bug Something isn't working as intended. ready for review The Pull Request is finished and ready for review. labels Apr 19, 2026
@Nickelony Nickelony marked this pull request as ready for review April 19, 2026 21:32
@Nickelony Nickelony added this to the Version 2.0 milestone Apr 20, 2026
Copy link
Copy Markdown
Collaborator

@Nickelony Nickelony left a comment

Choose a reason for hiding this comment

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

Works perfectly!

Before:
image

After:
image

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

Labels

bug Something isn't working as intended. ready for review The Pull Request is finished and ready for review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TE: Pasting near portals causes geometry in connected room to miss faces

2 participants