Some more work on SceneObjectGroup

afrisby
MW 2007-08-13 18:25:12 +00:00
parent 050921d7b6
commit 8af12cd9a8
1 changed files with 10 additions and 5 deletions

View File

@ -203,20 +203,24 @@ namespace OpenSim.Region.Environment.Scenes
public new SceneObjectGroup Copy() public new SceneObjectGroup Copy()
{ {
SceneObjectGroup dupe = (SceneObjectGroup)this.MemberwiseClone(); SceneObjectGroup dupe = (SceneObjectGroup)this.MemberwiseClone();
dupe.m_parts.Clear();
dupe.Pos = new LLVector3(Pos.X, Pos.Y, Pos.Z); dupe.Pos = new LLVector3(Pos.X, Pos.Y, Pos.Z);
dupe.m_scene = m_scene; dupe.m_scene = m_scene;
dupe.m_regionHandle = this.m_regionHandle; dupe.m_regionHandle = this.m_regionHandle;
dupe.CopyRootPart(this.m_rootPart); dupe.CopyRootPart(this.m_rootPart);
m_scene.EventManager.OnBackup += dupe.ProcessBackup;
foreach (SceneObjectPart part in this.m_parts.Values) List<SceneObjectPart> partList = new List<SceneObjectPart>(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.CopyPart(part);
} }
} }
dupe.UpdateParentIDs();
m_scene.EventManager.OnBackup += dupe.ProcessBackup;
return dupe; return dupe;
} }
@ -227,6 +231,7 @@ namespace OpenSim.Region.Environment.Scenes
public void CopyRootPart(SceneObjectPart part) public void CopyRootPart(SceneObjectPart part)
{ {
SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate()); SceneObjectPart newPart = part.Copy(m_scene.PrimIDAllocate());
newPart.SetParent(this);
this.m_parts.Add(newPart.UUID, newPart); this.m_parts.Add(newPart.UUID, newPart);
this.SetPartAsRoot(newPart); this.SetPartAsRoot(newPart);
} }
@ -580,7 +585,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart part = this.GetChildPrim(localID); SceneObjectPart part = this.GetChildPrim(localID);
if (part != null) if (part != null)
{ {
if (part.UUID == this.m_rootPart.UUID) if (part.UUID== this.m_rootPart.UUID)
{ {
this.UpdateRootPosition(pos); this.UpdateRootPosition(pos);
} }