diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 0d178c3..23a0550 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 |
@@ -853,11 +860,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
853 | return m_scenePresenceArray; | 860 | return m_scenePresenceArray; |
854 | } | 861 | } |
855 | 862 | ||
856 | public int GetNumberOfScenePresences() | ||
857 | { | ||
858 | return m_scenePresenceArray.Count; | ||
859 | } | ||
860 | |||
861 | /// <summary> | 863 | /// <summary> |
862 | /// Request a scene presence by UUID. Fast, indexed lookup. | 864 | /// Request a scene presence by UUID. Fast, indexed lookup. |
863 | /// </summary> | 865 | /// </summary> |
@@ -2064,12 +2066,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2064 | /// <param name="AgentID"></param> | 2066 | /// <param name="AgentID"></param> |
2065 | /// <param name="GroupID"></param> | 2067 | /// <param name="GroupID"></param> |
2066 | /// <param name="rot"></param> | 2068 | /// <param name="rot"></param> |
2069 | /// <returns>null if duplication fails, otherwise the duplicated object</returns> | ||
2070 | /// <summary> | ||
2067 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) | 2071 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) |
2068 | { | 2072 | { |
2069 | // m_log.DebugFormat( | 2073 | // m_log.DebugFormat( |
2070 | // "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", | 2074 | // "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", |
2071 | // originalPrimID, offset, AgentID); | 2075 | // originalPrimID, offset, AgentID); |
2072 | 2076 | ||
2073 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); | 2077 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); |
2074 | if (original != null) | 2078 | if (original != null) |
2075 | { | 2079 | { |
@@ -2099,25 +2103,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2099 | 2103 | ||
2100 | // FIXME: This section needs to be refactored so that it just calls AddSceneObject() | 2104 | // FIXME: This section needs to be refactored so that it just calls AddSceneObject() |
2101 | Entities.Add(copy); | 2105 | Entities.Add(copy); |
2102 | 2106 | ||
2103 | lock (SceneObjectGroupsByFullID) | 2107 | lock (SceneObjectGroupsByFullID) |
2104 | SceneObjectGroupsByFullID[copy.UUID] = copy; | 2108 | SceneObjectGroupsByFullID[copy.UUID] = copy; |
2105 | 2109 | ||
2106 | SceneObjectPart[] children = copy.Parts; | 2110 | SceneObjectPart[] children = copy.Parts; |
2107 | 2111 | ||
2108 | lock (SceneObjectGroupsByFullPartID) | 2112 | lock (SceneObjectGroupsByFullPartID) |
2109 | { | 2113 | { |
2110 | SceneObjectGroupsByFullPartID[copy.UUID] = copy; | 2114 | SceneObjectGroupsByFullPartID[copy.UUID] = copy; |
2111 | foreach (SceneObjectPart part in children) | 2115 | foreach (SceneObjectPart part in children) |
2112 | SceneObjectGroupsByFullPartID[part.UUID] = copy; | 2116 | SceneObjectGroupsByFullPartID[part.UUID] = copy; |
2113 | } | 2117 | } |
2114 | 2118 | ||
2115 | lock (SceneObjectGroupsByLocalPartID) | 2119 | lock (SceneObjectGroupsByLocalPartID) |
2116 | { | 2120 | { |
2117 | SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; | 2121 | SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; |
2118 | foreach (SceneObjectPart part in children) | 2122 | foreach (SceneObjectPart part in children) |
2119 | SceneObjectGroupsByLocalPartID[part.LocalId] = copy; | 2123 | SceneObjectGroupsByLocalPartID[part.LocalId] = copy; |
2120 | } | 2124 | } |
2121 | // PROBABLE END OF FIXME | 2125 | // PROBABLE END OF FIXME |
2122 | 2126 | ||
2123 | // Since we copy from a source group that is in selected | 2127 | // Since we copy from a source group that is in selected |
@@ -2149,11 +2153,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2149 | { | 2153 | { |
2150 | m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID); | 2154 | m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID); |
2151 | } | 2155 | } |
2152 | 2156 | ||
2153 | return null; | 2157 | return null; |
2154 | } | 2158 | } |
2155 | 2159 | ||
2156 | /// <summary> | ||
2157 | /// Calculates the distance between two Vector3s | 2160 | /// Calculates the distance between two Vector3s |
2158 | /// </summary> | 2161 | /// </summary> |
2159 | /// <param name="v1"></param> | 2162 | /// <param name="v1"></param> |