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