diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 6f963ac..36c5c52 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -74,7 +74,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
74 | 74 | ||
75 | protected internal EntityManager Entities = new EntityManager(); | 75 | protected internal EntityManager Entities = new EntityManager(); |
76 | 76 | ||
77 | protected RegionInfo m_regInfo; | ||
78 | protected Scene m_parentScene; | 77 | protected Scene m_parentScene; |
79 | protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); | 78 | protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); |
80 | protected int m_numRootAgents = 0; | 79 | protected int m_numRootAgents = 0; |
@@ -108,10 +107,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
108 | 107 | ||
109 | #endregion | 108 | #endregion |
110 | 109 | ||
111 | protected internal SceneGraph(Scene parent, RegionInfo regInfo) | 110 | protected internal SceneGraph(Scene parent) |
112 | { | 111 | { |
113 | m_parentScene = parent; | 112 | m_parentScene = parent; |
114 | m_regInfo = regInfo; | ||
115 | } | 113 | } |
116 | 114 | ||
117 | public PhysicsScene PhysicsScene | 115 | public PhysicsScene PhysicsScene |
@@ -122,7 +120,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
122 | // If we're not doing the initial set | 120 | // If we're not doing the initial set |
123 | // Then we've got to remove the previous | 121 | // Then we've got to remove the previous |
124 | // event handler | 122 | // event handler |
125 | |||
126 | if (_PhyScene != null) | 123 | if (_PhyScene != null) |
127 | _PhyScene.OnPhysicsCrash -= physicsBasedCrash; | 124 | _PhyScene.OnPhysicsCrash -= physicsBasedCrash; |
128 | 125 | ||
@@ -372,12 +369,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
372 | // "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", | 369 | // "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", |
373 | // sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); | 370 | // sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); |
374 | 371 | ||
375 | SceneObjectPart[] children = sceneObject.Parts; | 372 | SceneObjectPart[] parts = sceneObject.Parts; |
376 | 373 | ||
377 | // Clamp child prim sizes and add child prims to the m_numPrim count | 374 | // Clamp child prim sizes and add child prims to the m_numPrim count |
378 | if (m_parentScene.m_clampPrimSize) | 375 | if (m_parentScene.m_clampPrimSize) |
379 | { | 376 | { |
380 | foreach (SceneObjectPart part in children) | 377 | foreach (SceneObjectPart part in parts) |
381 | { | 378 | { |
382 | Vector3 scale = part.Shape.Scale; | 379 | Vector3 scale = part.Shape.Scale; |
383 | 380 | ||
@@ -391,7 +388,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
391 | part.Shape.Scale = scale; | 388 | part.Shape.Scale = scale; |
392 | } | 389 | } |
393 | } | 390 | } |
394 | m_numPrim += children.Length; | 391 | m_numPrim += parts.Length; |
395 | 392 | ||
396 | sceneObject.AttachToScene(m_parentScene); | 393 | sceneObject.AttachToScene(m_parentScene); |
397 | 394 | ||
@@ -411,15 +408,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
411 | 408 | ||
412 | lock (SceneObjectGroupsByFullPartID) | 409 | lock (SceneObjectGroupsByFullPartID) |
413 | { | 410 | { |
414 | SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject; | 411 | foreach (SceneObjectPart part in parts) |
415 | foreach (SceneObjectPart part in children) | ||
416 | SceneObjectGroupsByFullPartID[part.UUID] = sceneObject; | 412 | SceneObjectGroupsByFullPartID[part.UUID] = sceneObject; |
417 | } | 413 | } |
418 | 414 | ||
419 | lock (SceneObjectGroupsByLocalPartID) | 415 | lock (SceneObjectGroupsByLocalPartID) |
420 | { | 416 | { |
421 | SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject; | 417 | // m_log.DebugFormat( |
422 | foreach (SceneObjectPart part in children) | 418 | // "[SCENE GRAPH]: Adding scene object {0} {1} {2} to SceneObjectGroupsByLocalPartID in {3}", |
419 | // sceneObject.Name, sceneObject.UUID, sceneObject.LocalId, m_parentScene.RegionInfo.RegionName); | ||
420 | |||
421 | foreach (SceneObjectPart part in parts) | ||
423 | SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject; | 422 | SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject; |
424 | } | 423 | } |
425 | 424 | ||
@@ -432,6 +431,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
432 | /// <returns>true if the object was deleted, false if there was no object to delete</returns> | 431 | /// <returns>true if the object was deleted, false if there was no object to delete</returns> |
433 | public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) | 432 | public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) |
434 | { | 433 | { |
434 | // m_log.DebugFormat( | ||
435 | // "[SCENE GRAPH]: Deleting scene object with uuid {0}, resultOfObjectLinked = {1}", | ||
436 | // uuid, resultOfObjectLinked); | ||
437 | |||
435 | EntityBase entity; | 438 | EntityBase entity; |
436 | if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup))) | 439 | if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup))) |
437 | return false; | 440 | return false; |
@@ -460,7 +463,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
460 | SceneObjectPart[] parts = grp.Parts; | 463 | SceneObjectPart[] parts = grp.Parts; |
461 | for (int i = 0; i < parts.Length; i++) | 464 | for (int i = 0; i < parts.Length; i++) |
462 | SceneObjectGroupsByFullPartID.Remove(parts[i].UUID); | 465 | SceneObjectGroupsByFullPartID.Remove(parts[i].UUID); |
463 | SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID); | ||
464 | } | 466 | } |
465 | 467 | ||
466 | lock (SceneObjectGroupsByLocalPartID) | 468 | lock (SceneObjectGroupsByLocalPartID) |
@@ -468,7 +470,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
468 | SceneObjectPart[] parts = grp.Parts; | 470 | SceneObjectPart[] parts = grp.Parts; |
469 | for (int i = 0; i < parts.Length; i++) | 471 | for (int i = 0; i < parts.Length; i++) |
470 | SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId); | 472 | SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId); |
471 | SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId); | ||
472 | } | 473 | } |
473 | 474 | ||
474 | return Entities.Remove(uuid); | 475 | return Entities.Remove(uuid); |
@@ -589,7 +590,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
589 | ScenePresence newAvatar = null; | 590 | ScenePresence newAvatar = null; |
590 | 591 | ||
591 | // ScenePresence always defaults to child agent | 592 | // ScenePresence always defaults to child agent |
592 | newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance, type); | 593 | newAvatar = new ScenePresence(client, m_parentScene, appearance, type); |
593 | 594 | ||
594 | AddScenePresence(newAvatar); | 595 | AddScenePresence(newAvatar); |
595 | 596 | ||
@@ -651,7 +652,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
651 | if (!Entities.Remove(agentID)) | 652 | if (!Entities.Remove(agentID)) |
652 | { | 653 | { |
653 | m_log.WarnFormat( | 654 | m_log.WarnFormat( |
654 | "[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", | 655 | "[SCENE GRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", |
655 | agentID); | 656 | agentID); |
656 | } | 657 | } |
657 | 658 | ||
@@ -674,7 +675,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
674 | } | 675 | } |
675 | else | 676 | else |
676 | { | 677 | { |
677 | m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); | 678 | m_log.WarnFormat("[SCENE GRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); |
678 | } | 679 | } |
679 | } | 680 | } |
680 | } | 681 | } |
@@ -881,7 +882,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
881 | if (Entities.TryGetValue(localID, out entity)) | 882 | if (Entities.TryGetValue(localID, out entity)) |
882 | return entity as SceneObjectGroup; | 883 | return entity as SceneObjectGroup; |
883 | 884 | ||
884 | //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); | 885 | // m_log.DebugFormat("[SCENE GRAPH]: Entered GetGroupByPrim with localID {0}", localID); |
886 | |||
885 | SceneObjectGroup sog; | 887 | SceneObjectGroup sog; |
886 | lock (SceneObjectGroupsByLocalPartID) | 888 | lock (SceneObjectGroupsByLocalPartID) |
887 | SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog); | 889 | SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog); |
@@ -889,8 +891,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
889 | if (sog != null) | 891 | if (sog != null) |
890 | { | 892 | { |
891 | if (sog.HasChildPrim(localID)) | 893 | if (sog.HasChildPrim(localID)) |
894 | { | ||
895 | // m_log.DebugFormat( | ||
896 | // "[SCENE GRAPH]: Found scene object {0} {1} {2} containing part with local id {3} in {4}. Returning.", | ||
897 | // sog.Name, sog.UUID, sog.LocalId, localID, m_parentScene.RegionInfo.RegionName); | ||
898 | |||
892 | return sog; | 899 | return sog; |
893 | SceneObjectGroupsByLocalPartID.Remove(localID); | 900 | } |
901 | else | ||
902 | { | ||
903 | lock (SceneObjectGroupsByLocalPartID) | ||
904 | { | ||
905 | m_log.WarnFormat( | ||
906 | "[SCENE GRAPH]: Found scene object {0} {1} {2} via SceneObjectGroupsByLocalPartID index but it doesn't contain part with local id {3}. Removing from entry from index in {4}.", | ||
907 | sog.Name, sog.UUID, sog.LocalId, localID, m_parentScene.RegionInfo.RegionName); | ||
908 | |||
909 | SceneObjectGroupsByLocalPartID.Remove(localID); | ||
910 | } | ||
911 | } | ||
894 | } | 912 | } |
895 | 913 | ||
896 | EntityBase[] entityList = GetEntities(); | 914 | EntityBase[] entityList = GetEntities(); |