From 2d89e562d714a987b8a968abce861b24e3714afb Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 10 Nov 2008 19:47:13 +0000 Subject: * Refactor the callers of SOG.SetPartAsRoot() to use common code --- .../Region/Environment/Scenes/SceneObjectGroup.cs | 49 ++++++++-------------- 1 file changed, 18 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 39615c0..8f88d8e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -365,13 +365,7 @@ namespace OpenSim.Region.Environment.Scenes /// public SceneObjectGroup(SceneObjectPart part) { - part.SetParent(this); - part.ParentID = 0; - part.LinkNum = 0; - - m_parts.Add(part.UUID, part); - - SetPartAsRoot(part); + SetRootPart(part); } /// @@ -506,11 +500,8 @@ namespace OpenSim.Region.Environment.Scenes /// public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) { - Vector3 rootOffset = new Vector3(0, 0, 0); - SceneObjectPart newPart = new SceneObjectPart(ownerID, shape, pos, rot, rootOffset); - newPart.LinkNum = 0; - AddPart(newPart); - SetPartAsRoot(newPart); + Vector3 rootOffset = new Vector3(0, 0, 0); + SetRootPart(new SceneObjectPart(ownerID, shape, pos, rot, rootOffset)); } /// @@ -735,15 +726,6 @@ namespace OpenSim.Region.Environment.Scenes } /// - /// - /// - /// - private void SetPartAsRoot(SceneObjectPart part) - { - m_rootPart = part; - } - - /// /// Attach this scene object to the given avatar. /// /// @@ -890,9 +872,22 @@ namespace OpenSim.Region.Environment.Scenes { m_scene = scene; } + + /// + /// Set a part to act as the root part for this scene object + /// + /// + private void SetRootPart(SceneObjectPart part) + { + part.SetParent(this); + part.ParentID = 0; + part.LinkNum = 0; + m_rootPart = part; + m_parts.Add(m_rootPart.UUID, m_rootPart); + } /// - /// Add a new part to this scene object + /// Add a new part to this scene object. The part must already be correctly configured. /// /// public void AddPart(SceneObjectPart part) @@ -1394,15 +1389,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) { - SceneObjectPart newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed); - newPart.SetParent(this); - - lock (m_parts) - { - m_parts.Add(newPart.UUID, newPart); - } - - SetPartAsRoot(newPart); + SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed)); } public void ScriptSetPhysicsStatus(bool UsePhysics) -- cgit v1.1