From acba3883588bfa9d26edf1028ce580d29b44ceb8 Mon Sep 17 00:00:00 2001 From: dexy Date: Tue, 14 Jan 2020 12:54:45 +1100 Subject: [PATCH] Paste into different files bug fix, multiple selection clone bug fix, fix for collisions editing crash --- Project/ProjectForm.cs | 7 ++++++- WorldForm.cs | 28 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Project/ProjectForm.cs b/Project/ProjectForm.cs index 8c30b80..9c9b790 100644 --- a/Project/ProjectForm.cs +++ b/Project/ProjectForm.cs @@ -1502,7 +1502,6 @@ namespace CodeWalker.Project public object NewObject(MapSelection sel, bool copyPosition = false, bool selectNew = true) { //general method to add a new object, given a map selection - SetObject(ref sel); if (sel.MultipleSelectionItems != null) { var objs = new List(); @@ -6789,6 +6788,12 @@ namespace CodeWalker.Project } else { + if ((sel.MultipleSelectionItems != null) && (sel.MultipleSelectionItems.Length > 0)) + { + SetObject(ref sel.MultipleSelectionItems[sel.MultipleSelectionItems.Length - 1]); + return; + } + var mlo = sel.MloEntityDef; var room = sel.MloRoomDef; var ent = sel.EntityDef; diff --git a/WorldForm.cs b/WorldForm.cs index 4d8c871..c38bac5 100644 --- a/WorldForm.cs +++ b/WorldForm.cs @@ -1766,23 +1766,23 @@ namespace CodeWalker public void UpdateCollisionBoundsGraphics(Bounds b) { - if (b is BoundBVH bvh) + lock (Renderer.RenderSyncRoot) { - bvh.BuildBVH(); - } - else if (b is BoundComposite bc) - { - bc.BuildBVH(); - } + if (b is BoundBVH bvh) + { + bvh.BuildBVH(); + } + else if (b is BoundComposite bc) + { + bc.BuildBVH(); + } - var ib = b; - while (ib.Parent != null) - { - ib = ib.Parent; - } + var ib = b; + while (ib.Parent != null) + { + ib = ib.Parent; + } - //lock (Renderer.RenderSyncRoot) - { Renderer.Invalidate(ib); } }