refactor: rename SOG collections in SceneGraph to make it clearer that they are indexing each part's UUID, not just the root part.

0.7.1-dev
Justin Clark-Casey (justincc) 2011-03-26 00:42:48 +00:00
parent d8e1c380e6
commit f30bf429c2
1 changed files with 30 additions and 30 deletions

View File

@ -89,8 +89,8 @@ namespace OpenSim.Region.Framework.Scenes
protected internal PhysicsScene _PhyScene; protected internal PhysicsScene _PhyScene;
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>(); protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>(); protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullPartID = new Dictionary<UUID, SceneObjectGroup>();
private Object m_updateLock = new Object(); private Object m_updateLock = new Object();
@ -131,10 +131,10 @@ namespace OpenSim.Region.Framework.Scenes
m_scenePresenceArray = newlist; m_scenePresenceArray = newlist;
} }
lock (SceneObjectGroupsByFullID) lock (SceneObjectGroupsByFullPartID)
SceneObjectGroupsByFullID.Clear(); SceneObjectGroupsByFullPartID.Clear();
lock (SceneObjectGroupsByLocalID) lock (SceneObjectGroupsByLocalPartID)
SceneObjectGroupsByLocalID.Clear(); SceneObjectGroupsByLocalPartID.Clear();
Entities.Clear(); Entities.Clear();
} }
@ -384,18 +384,18 @@ namespace OpenSim.Region.Framework.Scenes
if (OnObjectCreate != null) if (OnObjectCreate != null)
OnObjectCreate(sceneObject); OnObjectCreate(sceneObject);
lock (SceneObjectGroupsByFullID) lock (SceneObjectGroupsByFullPartID)
{ {
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject;
foreach (SceneObjectPart part in children) foreach (SceneObjectPart part in children)
SceneObjectGroupsByFullID[part.UUID] = sceneObject; SceneObjectGroupsByFullPartID[part.UUID] = sceneObject;
} }
lock (SceneObjectGroupsByLocalID) lock (SceneObjectGroupsByLocalPartID)
{ {
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in children) foreach (SceneObjectPart part in children)
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
} }
return true; return true;
@ -427,20 +427,20 @@ namespace OpenSim.Region.Framework.Scenes
if (OnObjectRemove != null) if (OnObjectRemove != null)
OnObjectRemove(Entities[uuid]); OnObjectRemove(Entities[uuid]);
lock (SceneObjectGroupsByFullID) lock (SceneObjectGroupsByFullPartID)
{ {
SceneObjectPart[] parts = grp.Parts; SceneObjectPart[] parts = grp.Parts;
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
SceneObjectGroupsByFullID.Remove(parts[i].UUID); SceneObjectGroupsByFullPartID.Remove(parts[i].UUID);
SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID);
} }
lock (SceneObjectGroupsByLocalID) lock (SceneObjectGroupsByLocalPartID)
{ {
SceneObjectPart[] parts = grp.Parts; SceneObjectPart[] parts = grp.Parts;
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
SceneObjectGroupsByLocalID.Remove(parts[i].LocalId); SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId);
SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId);
} }
return Entities.Remove(uuid); return Entities.Remove(uuid);
@ -854,14 +854,14 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
SceneObjectGroup sog; SceneObjectGroup sog;
lock (SceneObjectGroupsByLocalID) lock (SceneObjectGroupsByLocalPartID)
SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog);
if (sog != null) if (sog != null)
{ {
if (sog.HasChildPrim(localID)) if (sog.HasChildPrim(localID))
return sog; return sog;
SceneObjectGroupsByLocalID.Remove(localID); SceneObjectGroupsByLocalPartID.Remove(localID);
} }
EntityBase[] entityList = GetEntities(); EntityBase[] entityList = GetEntities();
@ -873,8 +873,8 @@ namespace OpenSim.Region.Framework.Scenes
sog = (SceneObjectGroup)ent; sog = (SceneObjectGroup)ent;
if (sog.HasChildPrim(localID)) if (sog.HasChildPrim(localID))
{ {
lock (SceneObjectGroupsByLocalID) lock (SceneObjectGroupsByLocalPartID)
SceneObjectGroupsByLocalID[localID] = sog; SceneObjectGroupsByLocalPartID[localID] = sog;
return sog; return sog;
} }
} }
@ -891,16 +891,16 @@ namespace OpenSim.Region.Framework.Scenes
private SceneObjectGroup GetGroupByPrim(UUID fullID) private SceneObjectGroup GetGroupByPrim(UUID fullID)
{ {
SceneObjectGroup sog; SceneObjectGroup sog;
lock (SceneObjectGroupsByFullID) lock (SceneObjectGroupsByFullPartID)
SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); SceneObjectGroupsByFullPartID.TryGetValue(fullID, out sog);
if (sog != null) if (sog != null)
{ {
if (sog.ContainsPart(fullID)) if (sog.ContainsPart(fullID))
return sog; return sog;
lock (SceneObjectGroupsByFullID) lock (SceneObjectGroupsByFullPartID)
SceneObjectGroupsByFullID.Remove(fullID); SceneObjectGroupsByFullPartID.Remove(fullID);
} }
EntityBase[] entityList = GetEntities(); EntityBase[] entityList = GetEntities();
@ -911,8 +911,8 @@ namespace OpenSim.Region.Framework.Scenes
sog = (SceneObjectGroup)ent; sog = (SceneObjectGroup)ent;
if (sog.HasChildPrim(fullID)) if (sog.HasChildPrim(fullID))
{ {
lock (SceneObjectGroupsByFullID) lock (SceneObjectGroupsByFullPartID)
SceneObjectGroupsByFullID[fullID] = sog; SceneObjectGroupsByFullPartID[fullID] = sog;
return sog; return sog;
} }
} }
@ -1069,7 +1069,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="action"></param> /// <param name="action"></param>
protected internal void ForEachSOG(Action<SceneObjectGroup> action) protected internal void ForEachSOG(Action<SceneObjectGroup> action)
{ {
List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullPartID.Values);
foreach (SceneObjectGroup obj in objlist) foreach (SceneObjectGroup obj in objlist)
{ {
try try