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.0.7.4.1
parent
387d7fdad5
commit
f0406f9fe2
OpenSim
Data/Tests
Region
Framework/Scenes
ScriptEngine/Shared/Api/Implementation
|
@ -244,10 +244,10 @@ namespace OpenSim.Data.Tests
|
|||
SceneObjectPart[] newparts = newsog.Parts;
|
||||
Assert.That(newparts.Length,Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))");
|
||||
|
||||
Assert.That(newsog.HasChildPrim(tmp0), "Assert.That(newsog.HasChildPrim(tmp0))");
|
||||
Assert.That(newsog.HasChildPrim(tmp1), "Assert.That(newsog.HasChildPrim(tmp1))");
|
||||
Assert.That(newsog.HasChildPrim(tmp2), "Assert.That(newsog.HasChildPrim(tmp2))");
|
||||
Assert.That(newsog.HasChildPrim(tmp3), "Assert.That(newsog.HasChildPrim(tmp3))");
|
||||
Assert.That(newsog.ContainsPart(tmp0), "Assert.That(newsog.ContainsPart(tmp0))");
|
||||
Assert.That(newsog.ContainsPart(tmp1), "Assert.That(newsog.ContainsPart(tmp1))");
|
||||
Assert.That(newsog.ContainsPart(tmp2), "Assert.That(newsog.ContainsPart(tmp2))");
|
||||
Assert.That(newsog.ContainsPart(tmp3), "Assert.That(newsog.ContainsPart(tmp3))");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -860,7 +860,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (sog != null)
|
||||
{
|
||||
if (sog.HasChildPrim(localID))
|
||||
if (sog.ContainsPart(localID))
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE GRAPH]: Found scene object {0} {1} {2} containing part with local id {3} in {4}. Returning.",
|
||||
|
@ -888,7 +888,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
sog = (SceneObjectGroup)ent;
|
||||
if (sog.HasChildPrim(localID))
|
||||
if (sog.ContainsPart(localID))
|
||||
{
|
||||
lock (SceneObjectGroupsByLocalPartID)
|
||||
SceneObjectGroupsByLocalPartID[localID] = sog;
|
||||
|
@ -926,7 +926,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
sog = (SceneObjectGroup)ent;
|
||||
if (sog.HasChildPrim(fullID))
|
||||
if (sog.ContainsPart(fullID))
|
||||
{
|
||||
lock (SceneObjectGroupsByFullPartID)
|
||||
SceneObjectGroupsByFullPartID[fullID] = sog;
|
||||
|
|
|
@ -338,6 +338,24 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return m_parts.ContainsKey(partID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does this group contain the given part?
|
||||
/// should be able to remove these methods once we have a entity index in scene
|
||||
/// </summary>
|
||||
/// <param name="localID"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <value>
|
||||
/// The root part of this scene object
|
||||
/// </value>
|
||||
|
@ -1911,35 +1929,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does this group contain the child prim
|
||||
/// should be able to remove these methods once we have a entity index in scene
|
||||
/// </summary>
|
||||
/// <param name="primID"></param>
|
||||
/// <returns></returns>
|
||||
public bool HasChildPrim(UUID primID)
|
||||
{
|
||||
return m_parts.ContainsKey(primID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does this group contain the child prim
|
||||
/// should be able to remove these methods once we have a entity index in scene
|
||||
/// </summary>
|
||||
/// <param name="localID"></param>
|
||||
/// <returns></returns>
|
||||
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
|
||||
|
|
|
@ -3763,7 +3763,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
// parse for sitting avatare-uuids
|
||||
World.ForEachRootScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID))
|
||||
if (presence.ParentID != 0 && m_host.ParentGroup.ContainsPart(presence.ParentID))
|
||||
keytable.Add(presence.UUID);
|
||||
});
|
||||
|
||||
|
@ -3826,7 +3826,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
World.ForEachRootScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
SceneObjectPart sitPart = presence.ParentPart;
|
||||
if (sitPart != null && m_host.ParentGroup.HasChildPrim(sitPart.LocalId))
|
||||
if (sitPart != null && m_host.ParentGroup.ContainsPart(sitPart.LocalId))
|
||||
nametable.Add(presence.ControllingClient.Name);
|
||||
});
|
||||
|
||||
|
@ -7684,7 +7684,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
int avatarCount = 0;
|
||||
World.ForEachRootScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID))
|
||||
if (presence.ParentID != 0 && m_host.ParentGroup.ContainsPart(presence.ParentID))
|
||||
avatarCount++;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue