From 24c430fb1d2b71fff9f47590265d730bd692c62e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Apr 2026 20:29:52 +0000 Subject: [PATCH 1/2] Initial plan From bf2dcabdde0d61788effcb2de11728a56044d38e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Apr 2026 20:35:01 +0000 Subject: [PATCH 2/2] Fix sector paste geometry rebuild near portals Agent-Logs-Url: https://github.com/TombEngine/Tomb-Editor/sessions/c2156dd4-fa1c-4504-9db5-4bec36d945c7 Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com> --- TombEditor/EditorActions.cs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/TombEditor/EditorActions.cs b/TombEditor/EditorActions.cs index a595f46c8..23f7ebcc9 100644 --- a/TombEditor/EditorActions.cs +++ b/TombEditor/EditorActions.cs @@ -4874,15 +4874,21 @@ public static void TryStampObject(ObjectInstance instance, IWin32Window owner) public static void TryPasteSectors(SectorsClipboardData data, IWin32Window owner) { - _editor.UndoManager.PushGeometryChanged(_editor.SelectedRoom); - int x0 = _editor.SelectedSectors.Area.X0; int z0 = _editor.SelectedSectors.Area.Y0; int x1 = Math.Min(_editor.SelectedRoom.NumXSectors - 1, x0 + data.Width); int z1 = Math.Min(_editor.SelectedRoom.NumZSectors - 1, z0 + data.Height); + if (x1 <= x0 || z1 <= z0) + return; + + 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); + var sectors = data.GetSectors(); - var portals = new List(); for (int x = x0; x < x1; x++) for (int z = z0; z < z1; z++) @@ -4894,20 +4900,17 @@ public static void TryPasteSectors(SectorsClipboardData data, IWin32Window owner if (_editor.SelectedSectors.Empty || _editor.SelectedSectors.Single || _editor.SelectedSectors.Area.Contains(new VectorInt2(x, z))) - { - portals.AddRange(_editor.SelectedRoom.Sectors[x, z].Portals); _editor.SelectedRoom.Sectors[x, z].ReplaceGeometry(_editor.Level, currentSector); - } } - // Redraw rooms in portals - portals.Select(p => p.AdjoiningRoom).ToList().ForEach(room => + SmartBuildGeometry(_editor.SelectedRoom, pastedArea); + + foreach (var affectedRoom in affectedRooms) { - room.Rebuild(_editor.ShouldRelight, _editor.Configuration.Rendering3D_HighQualityLightPreview); - _editor.RoomGeometryChange(room); - }); + if (affectedRoom != _editor.SelectedRoom) + _editor.RoomGeometryChange(affectedRoom); + } - _editor.SelectedRoom.Rebuild(_editor.ShouldRelight, _editor.Configuration.Rendering3D_HighQualityLightPreview); _editor.RoomSectorPropertiesChange(_editor.SelectedRoom); }