From 32a953fed727fdadd65228b7c9282091da3521ac Mon Sep 17 00:00:00 2001
From: "Justin Clark-Casey (justincc)" <jjustincc@googlemail.com>
Date: Sat, 31 Mar 2012 01:52:06 +0100
Subject: [PATCH] refactor: Rename SOG.GetChildPart() to GetPart() since it can
 also return the 'root' part.

---
 .../World/Vegetation/VegetationModule.cs      |  2 +-
 OpenSim/Region/Framework/Scenes/Scene.cs      |  4 +-
 OpenSim/Region/Framework/Scenes/SceneGraph.cs |  4 +-
 .../Scenes/SceneObjectGroup.Inventory.cs      |  8 ++--
 .../Framework/Scenes/SceneObjectGroup.cs      | 40 +++++++++----------
 .../Scenes/SceneObjectPartInventory.cs        |  2 +-
 .../TreePopulator/TreePopulatorModule.cs      |  2 +-
 7 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
index ab8e1bf0b7..f5f35bb92e 100644
--- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
+++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
@@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
             }
             
             SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
-            SceneObjectPart rootPart = sceneObject.GetChildPart(sceneObject.UUID);
+            SceneObjectPart rootPart = sceneObject.GetPart(sceneObject.UUID);
             
             // if grass or tree, make phantom
             //rootPart.TrimPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index fc615718e0..06f7c0f64a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1833,7 +1833,7 @@ namespace OpenSim.Region.Framework.Scenes
             {
                 AddRestoredSceneObject(group, true, true);
                 EventManager.TriggerOnSceneObjectLoaded(group);
-                SceneObjectPart rootPart = group.GetChildPart(group.UUID);
+                SceneObjectPart rootPart = group.GetPart(group.UUID);
                 rootPart.Flags &= ~PrimFlags.Scripted;
                 rootPart.TrimPermissions();
 
@@ -4174,7 +4174,7 @@ namespace OpenSim.Region.Framework.Scenes
             {
                 if (ent is SceneObjectGroup)
                 {
-                    SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID);
+                    SceneObjectPart part = ((SceneObjectGroup)ent).GetPart(((SceneObjectGroup)ent).UUID);
                     if (part != null)
                     {
                         if (part.Name == cmdparams[2])
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index cd1366c107..8a05772c61 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1015,7 +1015,7 @@ namespace OpenSim.Region.Framework.Scenes
             SceneObjectGroup group = GetGroupByPrim(localID);
             if (group == null)
                 return null;
-            return group.GetChildPart(localID);
+            return group.GetPart(localID);
         }
         
         /// <summary>
@@ -1062,7 +1062,7 @@ namespace OpenSim.Region.Framework.Scenes
             SceneObjectGroup group = GetGroupByPrim(fullID);
             if (group == null)
                 return null;
-            return group.GetChildPart(fullID);
+            return group.GetPart(fullID);
         }
 
         /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index a73d9b69f9..10012d016a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -96,7 +96,7 @@ namespace OpenSim.Region.Framework.Scenes
             
             UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID;
 
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
             if (part != null)
             {
                 TaskInventoryItem taskItem = new TaskInventoryItem();
@@ -170,7 +170,7 @@ namespace OpenSim.Region.Framework.Scenes
         /// <returns>null if the item does not exist</returns>
         public TaskInventoryItem GetInventoryItem(uint primID, UUID itemID)
         {
-            SceneObjectPart part = GetChildPart(primID);
+            SceneObjectPart part = GetPart(primID);
             if (part != null)
             {
                 return part.Inventory.GetInventoryItem(itemID);
@@ -194,7 +194,7 @@ namespace OpenSim.Region.Framework.Scenes
         /// <returns>false if the item did not exist, true if the update occurred succesfully</returns>
         public bool UpdateInventoryItem(TaskInventoryItem item)
         {
-            SceneObjectPart part = GetChildPart(item.ParentPartID);
+            SceneObjectPart part = GetPart(item.ParentPartID);
             if (part != null)
             {
                 part.Inventory.UpdateInventoryItem(item);
@@ -214,7 +214,7 @@ namespace OpenSim.Region.Framework.Scenes
 
         public int RemoveInventoryItem(uint localID, UUID itemID)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
             if (part != null)
             {
                 int type = part.Inventory.RemoveInventoryItem(itemID);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 9d16bebabf..04b3766b15 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1127,7 +1127,7 @@ namespace OpenSim.Region.Framework.Scenes
 
         public UUID GetPartsFullID(uint localID)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
             if (part != null)
             {
                 return part.UUID;
@@ -1143,7 +1143,7 @@ namespace OpenSim.Region.Framework.Scenes
             }
             else
             {
-                SceneObjectPart part = GetChildPart(localId);
+                SceneObjectPart part = GetPart(localId);
                 OnGrabPart(part, offsetPos, remoteClient);
             }
         }
@@ -1904,8 +1904,8 @@ namespace OpenSim.Region.Framework.Scenes
         /// Get a part with a given UUID
         /// </summary>
         /// <param name="primID"></param>
-        /// <returns>null if a child part with the primID was not found</returns>
-        public SceneObjectPart GetChildPart(UUID primID)
+        /// <returns>null if a part with the primID was not found</returns>
+        public SceneObjectPart GetPart(UUID primID)
         {
             SceneObjectPart childPart;
             m_parts.TryGetValue(primID, out childPart);
@@ -1916,8 +1916,8 @@ namespace OpenSim.Region.Framework.Scenes
         /// Get a part with a given local ID
         /// </summary>
         /// <param name="localID"></param>
-        /// <returns>null if a child part with the local ID was not found</returns>
-        public SceneObjectPart GetChildPart(uint localID)
+        /// <returns>null if a part with the local ID was not found</returns>
+        public SceneObjectPart GetPart(uint localID)
         {
             SceneObjectPart[] parts = m_parts.GetArray();
             for (int i = 0; i < parts.Length; i++)
@@ -2035,7 +2035,7 @@ namespace OpenSim.Region.Framework.Scenes
         /// <returns>The object group of the newly delinked prim.  Null if part could not be found</returns>
         public SceneObjectGroup DelinkFromGroup(uint partID, bool sendEvents)
         {
-            SceneObjectPart linkPart = GetChildPart(partID);
+            SceneObjectPart linkPart = GetPart(partID);
 
             if (linkPart != null)
             {
@@ -2326,7 +2326,7 @@ namespace OpenSim.Region.Framework.Scenes
         /// <param name="localID"></param>
         public void SetPartName(string name, uint localID)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
             if (part != null)
             {
                 part.Name = name;
@@ -2335,7 +2335,7 @@ namespace OpenSim.Region.Framework.Scenes
 
         public void SetPartDescription(string des, uint localID)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
             if (part != null)
             {
                 part.Description = des;
@@ -2344,7 +2344,7 @@ namespace OpenSim.Region.Framework.Scenes
 
         public void SetPartText(string text, uint localID)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
             if (part != null)
             {
                 part.SetText(text);
@@ -2353,7 +2353,7 @@ namespace OpenSim.Region.Framework.Scenes
 
         public void SetPartText(string text, UUID partID)
         {
-            SceneObjectPart part = GetChildPart(partID);
+            SceneObjectPart part = GetPart(partID);
             if (part != null)
             {
                 part.SetText(text);
@@ -2362,7 +2362,7 @@ namespace OpenSim.Region.Framework.Scenes
 
         public string GetPartName(uint localID)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
             if (part != null)
             {
                 return part.Name;
@@ -2372,7 +2372,7 @@ namespace OpenSim.Region.Framework.Scenes
 
         public string GetPartDescription(uint localID)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
             if (part != null)
             {
                 return part.Description;
@@ -2390,7 +2390,7 @@ namespace OpenSim.Region.Framework.Scenes
         /// <param name="SetVolumeDetect"></param>
         public void UpdatePrimFlags(uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVolumeDetect)
         {
-            SceneObjectPart selectionPart = GetChildPart(localID);
+            SceneObjectPart selectionPart = GetPart(localID);
 
             if (SetTemporary && Scene != null)
             {
@@ -2427,7 +2427,7 @@ namespace OpenSim.Region.Framework.Scenes
 
         public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
             if (part != null)
             {
                 part.UpdateExtraParam(type, inUse, data);
@@ -2441,7 +2441,7 @@ namespace OpenSim.Region.Framework.Scenes
         /// <param name="textureEntry"></param>
         public void UpdateTextureEntry(uint localID, byte[] textureEntry)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
             if (part != null)
             {
                 part.UpdateTextureEntry(textureEntry);
@@ -2473,7 +2473,7 @@ namespace OpenSim.Region.Framework.Scenes
         /// <param name="shapeBlock"></param>
         public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
             if (part != null)
             {
                 part.UpdateShape(shapeBlock);
@@ -2685,7 +2685,7 @@ namespace OpenSim.Region.Framework.Scenes
         /// <param name="localID"></param>
         public void UpdateSinglePosition(Vector3 pos, uint localID)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
 
 //            SceneObjectPart[] parts = m_parts.GetArray();
 //            for (int i = 0; i < parts.Length; i++)
@@ -2824,7 +2824,7 @@ namespace OpenSim.Region.Framework.Scenes
         /// <param name="localID"></param>
         public void UpdateSingleRotation(Quaternion rot, uint localID)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
 
             SceneObjectPart[] parts = m_parts.GetArray();
             for (int i = 0; i < parts.Length; i++)
@@ -2853,7 +2853,7 @@ namespace OpenSim.Region.Framework.Scenes
         /// <param name="localID"></param>
         public void UpdateSingleRotation(Quaternion rot, Vector3 pos, uint localID)
         {
-            SceneObjectPart part = GetChildPart(localID);
+            SceneObjectPart part = GetPart(localID);
             if (part != null)
             {
 //                m_log.DebugFormat(
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 71a9084fe7..f7e123b97b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -623,7 +623,7 @@ namespace OpenSim.Region.Framework.Scenes
 
             group.ResetIDs();
 
-            SceneObjectPart rootPart = group.GetChildPart(group.UUID);
+            SceneObjectPart rootPart = group.GetPart(group.UUID);
 
             // Since renaming the item in the inventory does not affect the name stored
             // in the serialization, transfer the correct name from the inventory to the
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index a17eb41740..51b0592356 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -510,7 +510,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
             }
 
             SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
-            SceneObjectPart rootPart = sceneObject.GetChildPart(sceneObject.UUID);
+            SceneObjectPart rootPart = sceneObject.GetPart(sceneObject.UUID);
 
             rootPart.AddFlag(PrimFlags.Phantom);