From 8af12cd9a8d3498244058ff19e4a2ce2b6bdbb8c Mon Sep 17 00:00:00 2001 From: MW Date: Mon, 13 Aug 2007 18:25:12 +0000 Subject: Some more work on SceneObjectGroup --- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 42fe5eb..ad7b906 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -203,20 +203,24 @@ namespace OpenSim.Region.Environment.Scenes public new SceneObjectGroup Copy() { SceneObjectGroup dupe = (SceneObjectGroup)this.MemberwiseClone(); + dupe.m_parts.Clear(); dupe.Pos = new LLVector3(Pos.X, Pos.Y, Pos.Z); dupe.m_scene = m_scene; dupe.m_regionHandle = this.m_regionHandle; dupe.CopyRootPart(this.m_rootPart); - m_scene.EventManager.OnBackup += dupe.ProcessBackup; - - foreach (SceneObjectPart part in this.m_parts.Values) + + List partList = new List(this.m_parts.Values); + foreach (SceneObjectPart part in partList) { - if (part.UUID != this.m_rootPart.UUID) + if (part.UUID != this.m_rootPart.UUID) { dupe.CopyPart(part); } } + dupe.UpdateParentIDs(); + + m_scene.EventManager.OnBackup += dupe.ProcessBackup; return dupe; } @@ -227,6 +231,7 @@ namespace OpenSim.Region.Environment.Scenes public void CopyRootPart(SceneObjectPart part) { SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); + newPart.SetParent(this); this.m_parts.Add(newPart.UUID, newPart); this.SetPartAsRoot(newPart); } @@ -580,7 +585,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectPart part = this.GetChildPrim(localID); if (part != null) { - if (part.UUID == this.m_rootPart.UUID) + if (part.UUID== this.m_rootPart.UUID) { this.UpdateRootPosition(pos); } -- cgit v1.1