aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneGraph.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-05-21 21:57:56 +0100
committerJustin Clark-Casey (justincc)2010-05-21 21:57:56 +0100
commit5287c5f7fbd75ddb36f18a8692adb38cd824aaee (patch)
tree6f16b303a9e8b946086942e7ae8c24b9e6425e94 /OpenSim/Region/Framework/Scenes/SceneGraph.cs
parentminor: remove LongRunning test designator from TestAddSceneObject() since it ... (diff)
downloadopensim-SC-5287c5f7fbd75ddb36f18a8692adb38cd824aaee.zip
opensim-SC-5287c5f7fbd75ddb36f18a8692adb38cd824aaee.tar.gz
opensim-SC-5287c5f7fbd75ddb36f18a8692adb38cd824aaee.tar.bz2
opensim-SC-5287c5f7fbd75ddb36f18a8692adb38cd824aaee.tar.xz
rearrange SceneGraph.AddSceneObject() to return earlier if an object with that uuid is already in the scene
this means that we don't perform pointless work
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs102
1 files changed, 49 insertions, 53 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index bb570e7..e923a92 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -278,68 +278,64 @@ namespace OpenSim.Region.Framework.Scenes
278 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) 278 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
279 return false; 279 return false;
280 280
281 bool newlyAdded = false; 281 lock (sceneObject)
282 282 {
283 if (m_parentScene.m_clampPrimSize) 283 if (Entities.ContainsKey(sceneObject.UUID))
284 {
285 foreach (SceneObjectPart part in sceneObject.Children.Values)
286 { 284 {
287 Vector3 scale = part.Shape.Scale; 285// m_log.WarnFormat(
288 286// "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request",
289 if (scale.X > m_parentScene.m_maxNonphys) 287// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
290 scale.X = m_parentScene.m_maxNonphys; 288 return false;
291 if (scale.Y > m_parentScene.m_maxNonphys)
292 scale.Y = m_parentScene.m_maxNonphys;
293 if (scale.Z > m_parentScene.m_maxNonphys)
294 scale.Z = m_parentScene.m_maxNonphys;
295
296 part.Shape.Scale = scale;
297 } 289 }
298 } 290
299
300 sceneObject.AttachToScene(m_parentScene);
301
302 if (sendClientUpdates)
303 sceneObject.ScheduleGroupForFullUpdate();
304
305 lock (sceneObject)
306 {
307 if (!Entities.ContainsKey(sceneObject.UUID))
308 {
309// m_log.DebugFormat( 291// m_log.DebugFormat(
310// "[SCENE GRAPH]: Adding object {0} {1} to region {2}", 292// "[SCENE GRAPH]: Adding object {0} {1} to region {2}",
311// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); 293// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
312 294
313 newlyAdded = true; 295 if (m_parentScene.m_clampPrimSize)
314 Entities.Add(sceneObject); 296 {
315 m_numPrim += sceneObject.Children.Count; 297 foreach (SceneObjectPart part in sceneObject.Children.Values)
316
317 if (attachToBackup)
318 sceneObject.AttachToBackup();
319
320 if (OnObjectCreate != null)
321 OnObjectCreate(sceneObject);
322
323 lock (m_dictionary_lock)
324 { 298 {
325 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 299 Vector3 scale = part.Shape.Scale;
326 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; 300
327 foreach (SceneObjectPart part in sceneObject.Children.Values) 301 if (scale.X > m_parentScene.m_maxNonphys)
328 { 302 scale.X = m_parentScene.m_maxNonphys;
329 SceneObjectGroupsByFullID[part.UUID] = sceneObject; 303 if (scale.Y > m_parentScene.m_maxNonphys)
330 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; 304 scale.Y = m_parentScene.m_maxNonphys;
331 } 305 if (scale.Z > m_parentScene.m_maxNonphys)
306 scale.Z = m_parentScene.m_maxNonphys;
307
308 part.Shape.Scale = scale;
309 }
310 }
311
312 sceneObject.AttachToScene(m_parentScene);
313
314 if (sendClientUpdates)
315 sceneObject.ScheduleGroupForFullUpdate();
316
317 Entities.Add(sceneObject);
318 m_numPrim += sceneObject.Children.Count;
319
320 if (attachToBackup)
321 sceneObject.AttachToBackup();
322
323 if (OnObjectCreate != null)
324 OnObjectCreate(sceneObject);
325
326 lock (m_dictionary_lock)
327 {
328 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
329 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
330 foreach (SceneObjectPart part in sceneObject.Children.Values)
331 {
332 SceneObjectGroupsByFullID[part.UUID] = sceneObject;
333 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
332 } 334 }
333 } 335 }
334// else
335// {
336// m_log.WarnFormat(
337// "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request",
338// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
339// }
340 } 336 }
341 337
342 return newlyAdded; 338 return true;
343 } 339 }
344 340
345 /// <summary> 341 /// <summary>