From f0406f9fe2f7a1d4d135934280735a3fdc41935f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 31 Mar 2012 01:45:37 +0100 Subject: Rename SOG.HasChildPrim(uint) to SOG.ContainsPart(uint) to match existing ContainsPart method and remove method duplication. HasChildPrim is also misleading since the 'root' prim can also be returned. --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 47 +++++++++------------- 1 file changed, 18 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index afb5ccf..9d16beb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -338,6 +338,24 @@ namespace OpenSim.Region.Framework.Scenes return m_parts.ContainsKey(partID); } + /// + /// Does this group contain the given part? + /// should be able to remove these methods once we have a entity index in scene + /// + /// + /// + public bool ContainsPart(uint localID) + { + SceneObjectPart[] parts = m_parts.GetArray(); + for (int i = 0; i < parts.Length; i++) + { + if (parts[i].LocalId == localID) + return true; + } + + return false; + } + /// /// The root part of this scene object /// @@ -1911,35 +1929,6 @@ namespace OpenSim.Region.Framework.Scenes return null; } - /// - /// Does this group contain the child prim - /// should be able to remove these methods once we have a entity index in scene - /// - /// - /// - public bool HasChildPrim(UUID primID) - { - return m_parts.ContainsKey(primID); - } - - /// - /// Does this group contain the child prim - /// should be able to remove these methods once we have a entity index in scene - /// - /// - /// - public bool HasChildPrim(uint localID) - { - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - { - if (parts[i].LocalId == localID) - return true; - } - - return false; - } - #endregion #region Packet Handlers -- cgit v1.1 From 32a953fed727fdadd65228b7c9282091da3521ac Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 31 Mar 2012 01:52:06 +0100 Subject: refactor: Rename SOG.GetChildPart() to GetPart() since it can also return the 'root' part. --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9d16beb..04b3766 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 /// /// - /// null if a child part with the primID was not found - public SceneObjectPart GetChildPart(UUID primID) + /// null if a part with the primID was not found + 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 /// /// - /// null if a child part with the local ID was not found - public SceneObjectPart GetChildPart(uint localID) + /// null if a part with the local ID was not found + 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 /// The object group of the newly delinked prim. Null if part could not be found 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 /// 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 /// 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 /// 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 /// 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 /// 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 /// 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 /// public void UpdateSingleRotation(Quaternion rot, Vector3 pos, uint localID) { - SceneObjectPart part = GetChildPart(localID); + SceneObjectPart part = GetPart(localID); if (part != null) { // m_log.DebugFormat( -- cgit v1.1