aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneGraph.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs61
1 files changed, 33 insertions, 28 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 0587846..c3d66eb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -101,6 +101,13 @@ namespace OpenSim.Region.Framework.Scenes
101 /// </summary> 101 /// </summary>
102 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>(); 102 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
103 103
104 /// <summary>
105 /// Lock to prevent object group update, linking, delinking and duplication operations from running concurrently.
106 /// </summary>
107 /// <remarks>
108 /// These operations rely on the parts composition of the object. If allowed to run concurrently then race
109 /// conditions can occur.
110 /// </remarks>
104 private Object m_updateLock = new Object(); 111 private Object m_updateLock = new Object();
105 112
106 #endregion 113 #endregion
@@ -394,9 +401,9 @@ namespace OpenSim.Region.Framework.Scenes
394 401
395 if (Entities.ContainsKey(sceneObject.UUID)) 402 if (Entities.ContainsKey(sceneObject.UUID))
396 { 403 {
397// m_log.DebugFormat( 404 m_log.DebugFormat(
398// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", 405 "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()",
399// m_parentScene.RegionInfo.RegionName, sceneObject.UUID); 406 m_parentScene.RegionInfo.RegionName, sceneObject.UUID);
400 407
401 return false; 408 return false;
402 } 409 }
@@ -775,12 +782,6 @@ namespace OpenSim.Region.Framework.Scenes
775 782
776 public int GetChildAgentCount() 783 public int GetChildAgentCount()
777 { 784 {
778 // some network situations come in where child agents get closed twice.
779 if (m_numChildAgents < 0)
780 {
781 m_numChildAgents = 0;
782 }
783
784 return m_numChildAgents; 785 return m_numChildAgents;
785 } 786 }
786 787
@@ -852,11 +853,6 @@ namespace OpenSim.Region.Framework.Scenes
852 return m_scenePresenceArray; 853 return m_scenePresenceArray;
853 } 854 }
854 855
855 public int GetNumberOfScenePresences()
856 {
857 return m_scenePresenceArray.Count;
858 }
859
860 /// <summary> 856 /// <summary>
861 /// Request a scene presence by UUID. Fast, indexed lookup. 857 /// Request a scene presence by UUID. Fast, indexed lookup.
862 /// </summary> 858 /// </summary>
@@ -1042,6 +1038,18 @@ namespace OpenSim.Region.Framework.Scenes
1042 } 1038 }
1043 1039
1044 /// <summary> 1040 /// <summary>
1041 /// Get all the scene object groups.
1042 /// </summary>
1043 /// <returns>
1044 /// The scene object groups. If the scene is empty then an empty list is returned.
1045 /// </returns>
1046 protected internal List<SceneObjectGroup> GetSceneObjectGroups()
1047 {
1048 lock (SceneObjectGroupsByFullID)
1049 return new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
1050 }
1051
1052 /// <summary>
1045 /// Get a group in the scene 1053 /// Get a group in the scene
1046 /// </summary> 1054 /// </summary>
1047 /// <param name="fullID">UUID of the group</param> 1055 /// <param name="fullID">UUID of the group</param>
@@ -1184,11 +1192,7 @@ namespace OpenSim.Region.Framework.Scenes
1184 /// <param name="action"></param> 1192 /// <param name="action"></param>
1185 protected internal void ForEachSOG(Action<SceneObjectGroup> action) 1193 protected internal void ForEachSOG(Action<SceneObjectGroup> action)
1186 { 1194 {
1187 List<SceneObjectGroup> objlist; 1195 foreach (SceneObjectGroup obj in GetSceneObjectGroups())
1188 lock (SceneObjectGroupsByFullID)
1189 objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
1190
1191 foreach (SceneObjectGroup obj in objlist)
1192 { 1196 {
1193 try 1197 try
1194 { 1198 {
@@ -2065,12 +2069,14 @@ namespace OpenSim.Region.Framework.Scenes
2065 /// <param name="AgentID"></param> 2069 /// <param name="AgentID"></param>
2066 /// <param name="GroupID"></param> 2070 /// <param name="GroupID"></param>
2067 /// <param name="rot"></param> 2071 /// <param name="rot"></param>
2072 /// <returns>null if duplication fails, otherwise the duplicated object</returns>
2073 /// <summary>
2068 public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) 2074 public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
2069 { 2075 {
2070// m_log.DebugFormat( 2076// m_log.DebugFormat(
2071// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", 2077// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
2072// originalPrimID, offset, AgentID); 2078// originalPrimID, offset, AgentID);
2073 2079
2074 SceneObjectGroup original = GetGroupByPrim(originalPrimID); 2080 SceneObjectGroup original = GetGroupByPrim(originalPrimID);
2075 if (original != null) 2081 if (original != null)
2076 { 2082 {
@@ -2100,25 +2106,25 @@ namespace OpenSim.Region.Framework.Scenes
2100 2106
2101 // FIXME: This section needs to be refactored so that it just calls AddSceneObject() 2107 // FIXME: This section needs to be refactored so that it just calls AddSceneObject()
2102 Entities.Add(copy); 2108 Entities.Add(copy);
2103 2109
2104 lock (SceneObjectGroupsByFullID) 2110 lock (SceneObjectGroupsByFullID)
2105 SceneObjectGroupsByFullID[copy.UUID] = copy; 2111 SceneObjectGroupsByFullID[copy.UUID] = copy;
2106 2112
2107 SceneObjectPart[] children = copy.Parts; 2113 SceneObjectPart[] children = copy.Parts;
2108 2114
2109 lock (SceneObjectGroupsByFullPartID) 2115 lock (SceneObjectGroupsByFullPartID)
2110 { 2116 {
2111 SceneObjectGroupsByFullPartID[copy.UUID] = copy; 2117 SceneObjectGroupsByFullPartID[copy.UUID] = copy;
2112 foreach (SceneObjectPart part in children) 2118 foreach (SceneObjectPart part in children)
2113 SceneObjectGroupsByFullPartID[part.UUID] = copy; 2119 SceneObjectGroupsByFullPartID[part.UUID] = copy;
2114 } 2120 }
2115 2121
2116 lock (SceneObjectGroupsByLocalPartID) 2122 lock (SceneObjectGroupsByLocalPartID)
2117 { 2123 {
2118 SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; 2124 SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
2119 foreach (SceneObjectPart part in children) 2125 foreach (SceneObjectPart part in children)
2120 SceneObjectGroupsByLocalPartID[part.LocalId] = copy; 2126 SceneObjectGroupsByLocalPartID[part.LocalId] = copy;
2121 } 2127 }
2122 // PROBABLE END OF FIXME 2128 // PROBABLE END OF FIXME
2123 2129
2124 // Since we copy from a source group that is in selected 2130 // Since we copy from a source group that is in selected
@@ -2150,11 +2156,10 @@ namespace OpenSim.Region.Framework.Scenes
2150 { 2156 {
2151 m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID); 2157 m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID);
2152 } 2158 }
2153 2159
2154 return null; 2160 return null;
2155 } 2161 }
2156 2162
2157 /// <summary>
2158 /// Calculates the distance between two Vector3s 2163 /// Calculates the distance between two Vector3s
2159 /// </summary> 2164 /// </summary>
2160 /// <param name="v1"></param> 2165 /// <param name="v1"></param>