mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
Merge branch 'master' into primcounts
This commit is contained in:
@@ -88,9 +88,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
protected internal object m_syncRoot = new object();
|
||||
|
||||
protected internal PhysicsScene _PhyScene;
|
||||
|
||||
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>();
|
||||
|
||||
/// <summary>
|
||||
/// Index the SceneObjectGroup for each part by the root part's UUID.
|
||||
/// </summary>
|
||||
protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>();
|
||||
|
||||
/// <summary>
|
||||
/// Index the SceneObjectGroup for each part by that part's UUID.
|
||||
/// </summary>
|
||||
protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullPartID = new Dictionary<UUID, SceneObjectGroup>();
|
||||
|
||||
/// <summary>
|
||||
/// Index the SceneObjectGroup for each part by that part's local ID.
|
||||
/// </summary>
|
||||
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
|
||||
|
||||
private Object m_updateLock = new Object();
|
||||
|
||||
@@ -133,8 +145,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
lock (SceneObjectGroupsByFullID)
|
||||
SceneObjectGroupsByFullID.Clear();
|
||||
lock (SceneObjectGroupsByLocalID)
|
||||
SceneObjectGroupsByLocalID.Clear();
|
||||
lock (SceneObjectGroupsByFullPartID)
|
||||
SceneObjectGroupsByFullPartID.Clear();
|
||||
lock (SceneObjectGroupsByLocalPartID)
|
||||
SceneObjectGroupsByLocalPartID.Clear();
|
||||
|
||||
Entities.Clear();
|
||||
}
|
||||
@@ -385,17 +399,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
OnObjectCreate(sceneObject);
|
||||
|
||||
lock (SceneObjectGroupsByFullID)
|
||||
{
|
||||
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
|
||||
|
||||
lock (SceneObjectGroupsByFullPartID)
|
||||
{
|
||||
SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject;
|
||||
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)
|
||||
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
|
||||
SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -426,21 +443,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (OnObjectRemove != null)
|
||||
OnObjectRemove(Entities[uuid]);
|
||||
|
||||
|
||||
lock (SceneObjectGroupsByFullID)
|
||||
SceneObjectGroupsByFullID.Remove(grp.UUID);
|
||||
|
||||
lock (SceneObjectGroupsByFullPartID)
|
||||
{
|
||||
SceneObjectPart[] parts = grp.Parts;
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
SceneObjectGroupsByFullID.Remove(parts[i].UUID);
|
||||
SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
|
||||
SceneObjectGroupsByFullPartID.Remove(parts[i].UUID);
|
||||
SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID);
|
||||
}
|
||||
|
||||
lock (SceneObjectGroupsByLocalID)
|
||||
lock (SceneObjectGroupsByLocalPartID)
|
||||
{
|
||||
SceneObjectPart[] parts = grp.Parts;
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
SceneObjectGroupsByLocalID.Remove(parts[i].LocalId);
|
||||
SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
|
||||
SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId);
|
||||
SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId);
|
||||
}
|
||||
|
||||
return Entities.Remove(uuid);
|
||||
@@ -854,14 +874,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
|
||||
SceneObjectGroup sog;
|
||||
lock (SceneObjectGroupsByLocalID)
|
||||
SceneObjectGroupsByLocalID.TryGetValue(localID, out sog);
|
||||
lock (SceneObjectGroupsByLocalPartID)
|
||||
SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog);
|
||||
|
||||
if (sog != null)
|
||||
{
|
||||
if (sog.HasChildPrim(localID))
|
||||
return sog;
|
||||
SceneObjectGroupsByLocalID.Remove(localID);
|
||||
SceneObjectGroupsByLocalPartID.Remove(localID);
|
||||
}
|
||||
|
||||
EntityBase[] entityList = GetEntities();
|
||||
@@ -873,8 +893,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
sog = (SceneObjectGroup)ent;
|
||||
if (sog.HasChildPrim(localID))
|
||||
{
|
||||
lock (SceneObjectGroupsByLocalID)
|
||||
SceneObjectGroupsByLocalID[localID] = sog;
|
||||
lock (SceneObjectGroupsByLocalPartID)
|
||||
SceneObjectGroupsByLocalPartID[localID] = sog;
|
||||
return sog;
|
||||
}
|
||||
}
|
||||
@@ -891,16 +911,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
private SceneObjectGroup GetGroupByPrim(UUID fullID)
|
||||
{
|
||||
SceneObjectGroup sog;
|
||||
lock (SceneObjectGroupsByFullID)
|
||||
SceneObjectGroupsByFullID.TryGetValue(fullID, out sog);
|
||||
lock (SceneObjectGroupsByFullPartID)
|
||||
SceneObjectGroupsByFullPartID.TryGetValue(fullID, out sog);
|
||||
|
||||
if (sog != null)
|
||||
{
|
||||
if (sog.ContainsPart(fullID))
|
||||
return sog;
|
||||
|
||||
lock (SceneObjectGroupsByFullID)
|
||||
SceneObjectGroupsByFullID.Remove(fullID);
|
||||
lock (SceneObjectGroupsByFullPartID)
|
||||
SceneObjectGroupsByFullPartID.Remove(fullID);
|
||||
}
|
||||
|
||||
EntityBase[] entityList = GetEntities();
|
||||
@@ -911,8 +931,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
sog = (SceneObjectGroup)ent;
|
||||
if (sog.HasChildPrim(fullID))
|
||||
{
|
||||
lock (SceneObjectGroupsByFullID)
|
||||
SceneObjectGroupsByFullID[fullID] = sog;
|
||||
lock (SceneObjectGroupsByFullPartID)
|
||||
SceneObjectGroupsByFullPartID[fullID] = sog;
|
||||
return sog;
|
||||
}
|
||||
}
|
||||
@@ -1064,11 +1084,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs action on all scene object groups.
|
||||
/// Performs action once on all scene object groups.
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
protected internal void ForEachSOG(Action<SceneObjectGroup> action)
|
||||
{
|
||||
// FIXME: Need to lock here, really.
|
||||
List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
|
||||
foreach (SceneObjectGroup obj in objlist)
|
||||
{
|
||||
@@ -1084,7 +1105,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Performs action on all scene presences. This can ultimately run the actions in parallel but
|
||||
|
||||
Reference in New Issue
Block a user