mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
Merge branch 'master' into careminster-presence-refactor
This commit is contained in:
@@ -97,9 +97,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();
|
||||
|
||||
@@ -147,8 +159,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
lock (SceneObjectGroupsByFullID)
|
||||
SceneObjectGroupsByFullID.Clear();
|
||||
lock (SceneObjectGroupsByLocalID)
|
||||
SceneObjectGroupsByLocalID.Clear();
|
||||
lock (SceneObjectGroupsByFullPartID)
|
||||
SceneObjectGroupsByFullPartID.Clear();
|
||||
lock (SceneObjectGroupsByLocalPartID)
|
||||
SceneObjectGroupsByLocalPartID.Clear();
|
||||
|
||||
Entities.Clear();
|
||||
}
|
||||
@@ -390,6 +404,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (Entities.ContainsKey(sceneObject.UUID))
|
||||
return false;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
|
||||
// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName);
|
||||
|
||||
SceneObjectPart[] children = sceneObject.Parts;
|
||||
|
||||
@@ -426,17 +444,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;
|
||||
@@ -467,21 +488,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);
|
||||
@@ -697,7 +721,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (!Entities.Remove(agentID))
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
|
||||
"[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
|
||||
agentID);
|
||||
}
|
||||
|
||||
@@ -721,7 +745,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
|
||||
m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -934,14 +958,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();
|
||||
@@ -953,8 +977,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;
|
||||
}
|
||||
}
|
||||
@@ -971,16 +995,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();
|
||||
@@ -991,8 +1015,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;
|
||||
}
|
||||
}
|
||||
@@ -1144,16 +1168,15 @@ 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)
|
||||
{
|
||||
EntityBase[] objlist = Entities.GetAllByType<SceneObjectGroup>();
|
||||
foreach (EntityBase ent in objlist)
|
||||
// FIXME: Need to lock here, really.
|
||||
List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
|
||||
foreach (SceneObjectGroup obj in objlist)
|
||||
{
|
||||
SceneObjectGroup obj = (SceneObjectGroup)ent;
|
||||
|
||||
try
|
||||
{
|
||||
action(obj);
|
||||
@@ -1161,11 +1184,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
catch (Exception e)
|
||||
{
|
||||
// Catch it and move on. This includes situations where splist has inconsistent info
|
||||
m_log.WarnFormat("[SCENE]: Problem processing action in ForEachSOG: ", e.ToString());
|
||||
m_log.WarnFormat(
|
||||
"[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Performs action on all scene presences. This can ultimately run the actions in parallel but
|
||||
@@ -1185,8 +1208,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
|
||||
m_log.Info("[BUG] Stack Trace: " + e.StackTrace);
|
||||
m_log.Info("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
|
||||
m_log.Info("[SCENEGRAPH]: Stack Trace: " + e.StackTrace);
|
||||
}
|
||||
});
|
||||
Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction);
|
||||
@@ -1201,7 +1224,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
|
||||
m_log.Error("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1884,7 +1907,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="rot"></param>
|
||||
public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
|
||||
{
|
||||
//m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID);
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
|
||||
// originalPrimID, offset, AgentID);
|
||||
|
||||
SceneObjectGroup original = GetGroupByPrim(originalPrimID);
|
||||
if (original != null)
|
||||
{
|
||||
@@ -1912,7 +1938,28 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: This section needs to be refactored so that it just calls AddSceneObject()
|
||||
Entities.Add(copy);
|
||||
|
||||
lock (SceneObjectGroupsByFullID)
|
||||
SceneObjectGroupsByFullID[copy.UUID] = copy;
|
||||
|
||||
SceneObjectPart[] children = copy.Parts;
|
||||
|
||||
lock (SceneObjectGroupsByFullPartID)
|
||||
{
|
||||
SceneObjectGroupsByFullPartID[copy.UUID] = copy;
|
||||
foreach (SceneObjectPart part in children)
|
||||
SceneObjectGroupsByFullPartID[part.UUID] = copy;
|
||||
}
|
||||
|
||||
lock (SceneObjectGroupsByLocalPartID)
|
||||
{
|
||||
SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
|
||||
foreach (SceneObjectPart part in children)
|
||||
SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
|
||||
}
|
||||
// PROBABLE END OF FIXME
|
||||
|
||||
// Since we copy from a source group that is in selected
|
||||
// state, but the copy is shown deselected in the viewer,
|
||||
|
||||
Reference in New Issue
Block a user