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.cs54
1 files changed, 36 insertions, 18 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 42e2502..d1ee990 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -83,7 +83,6 @@ namespace OpenSim.Region.Framework.Scenes
83 83
84 protected internal EntityManager Entities = new EntityManager(); 84 protected internal EntityManager Entities = new EntityManager();
85 85
86 protected RegionInfo m_regInfo;
87 protected Scene m_parentScene; 86 protected Scene m_parentScene;
88 protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); 87 protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>();
89 protected int m_numRootAgents = 0; 88 protected int m_numRootAgents = 0;
@@ -117,10 +116,9 @@ namespace OpenSim.Region.Framework.Scenes
117 116
118 #endregion 117 #endregion
119 118
120 protected internal SceneGraph(Scene parent, RegionInfo regInfo) 119 protected internal SceneGraph(Scene parent)
121 { 120 {
122 m_parentScene = parent; 121 m_parentScene = parent;
123 m_regInfo = regInfo;
124 } 122 }
125 123
126 public PhysicsScene PhysicsScene 124 public PhysicsScene PhysicsScene
@@ -131,7 +129,6 @@ namespace OpenSim.Region.Framework.Scenes
131 // If we're not doing the initial set 129 // If we're not doing the initial set
132 // Then we've got to remove the previous 130 // Then we've got to remove the previous
133 // event handler 131 // event handler
134
135 if (_PhyScene != null) 132 if (_PhyScene != null)
136 _PhyScene.OnPhysicsCrash -= physicsBasedCrash; 133 _PhyScene.OnPhysicsCrash -= physicsBasedCrash;
137 134
@@ -413,12 +410,12 @@ namespace OpenSim.Region.Framework.Scenes
413// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", 410// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
414// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); 411// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName);
415 412
416 SceneObjectPart[] children = sceneObject.Parts; 413 SceneObjectPart[] parts = sceneObject.Parts;
417 414
418 // Clamp child prim sizes and add child prims to the m_numPrim count 415 // Clamp child prim sizes and add child prims to the m_numPrim count
419 if (m_parentScene.m_clampPrimSize) 416 if (m_parentScene.m_clampPrimSize)
420 { 417 {
421 foreach (SceneObjectPart part in children) 418 foreach (SceneObjectPart part in parts)
422 { 419 {
423 Vector3 scale = part.Shape.Scale; 420 Vector3 scale = part.Shape.Scale;
424 421
@@ -432,7 +429,7 @@ namespace OpenSim.Region.Framework.Scenes
432 part.Shape.Scale = scale; 429 part.Shape.Scale = scale;
433 } 430 }
434 } 431 }
435 m_numPrim += children.Length; 432 m_numPrim += parts.Length;
436 433
437 sceneObject.AttachToScene(m_parentScene); 434 sceneObject.AttachToScene(m_parentScene);
438 435
@@ -452,15 +449,17 @@ namespace OpenSim.Region.Framework.Scenes
452 449
453 lock (SceneObjectGroupsByFullPartID) 450 lock (SceneObjectGroupsByFullPartID)
454 { 451 {
455 SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject; 452 foreach (SceneObjectPart part in parts)
456 foreach (SceneObjectPart part in children)
457 SceneObjectGroupsByFullPartID[part.UUID] = sceneObject; 453 SceneObjectGroupsByFullPartID[part.UUID] = sceneObject;
458 } 454 }
459 455
460 lock (SceneObjectGroupsByLocalPartID) 456 lock (SceneObjectGroupsByLocalPartID)
461 { 457 {
462 SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject; 458// m_log.DebugFormat(
463 foreach (SceneObjectPart part in children) 459// "[SCENE GRAPH]: Adding scene object {0} {1} {2} to SceneObjectGroupsByLocalPartID in {3}",
460// sceneObject.Name, sceneObject.UUID, sceneObject.LocalId, m_parentScene.RegionInfo.RegionName);
461
462 foreach (SceneObjectPart part in parts)
464 SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject; 463 SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
465 } 464 }
466 465
@@ -473,6 +472,10 @@ namespace OpenSim.Region.Framework.Scenes
473 /// <returns>true if the object was deleted, false if there was no object to delete</returns> 472 /// <returns>true if the object was deleted, false if there was no object to delete</returns>
474 public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) 473 public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
475 { 474 {
475// m_log.DebugFormat(
476// "[SCENE GRAPH]: Deleting scene object with uuid {0}, resultOfObjectLinked = {1}",
477// uuid, resultOfObjectLinked);
478
476 EntityBase entity; 479 EntityBase entity;
477 if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup))) 480 if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup)))
478 return false; 481 return false;
@@ -501,7 +504,6 @@ namespace OpenSim.Region.Framework.Scenes
501 SceneObjectPart[] parts = grp.Parts; 504 SceneObjectPart[] parts = grp.Parts;
502 for (int i = 0; i < parts.Length; i++) 505 for (int i = 0; i < parts.Length; i++)
503 SceneObjectGroupsByFullPartID.Remove(parts[i].UUID); 506 SceneObjectGroupsByFullPartID.Remove(parts[i].UUID);
504 SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID);
505 } 507 }
506 508
507 lock (SceneObjectGroupsByLocalPartID) 509 lock (SceneObjectGroupsByLocalPartID)
@@ -509,7 +511,6 @@ namespace OpenSim.Region.Framework.Scenes
509 SceneObjectPart[] parts = grp.Parts; 511 SceneObjectPart[] parts = grp.Parts;
510 for (int i = 0; i < parts.Length; i++) 512 for (int i = 0; i < parts.Length; i++)
511 SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId); 513 SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId);
512 SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId);
513 } 514 }
514 515
515 return Entities.Remove(uuid); 516 return Entities.Remove(uuid);
@@ -654,7 +655,7 @@ namespace OpenSim.Region.Framework.Scenes
654 ScenePresence newAvatar = null; 655 ScenePresence newAvatar = null;
655 656
656 // ScenePresence always defaults to child agent 657 // ScenePresence always defaults to child agent
657 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance, type); 658 newAvatar = new ScenePresence(client, m_parentScene, appearance, type);
658 659
659 AddScenePresence(newAvatar); 660 AddScenePresence(newAvatar);
660 661
@@ -721,7 +722,7 @@ namespace OpenSim.Region.Framework.Scenes
721 if (!Entities.Remove(agentID)) 722 if (!Entities.Remove(agentID))
722 { 723 {
723 m_log.WarnFormat( 724 m_log.WarnFormat(
724 "[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", 725 "[SCENE GRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
725 agentID); 726 agentID);
726 } 727 }
727 728
@@ -745,7 +746,7 @@ namespace OpenSim.Region.Framework.Scenes
745 } 746 }
746 else 747 else
747 { 748 {
748 m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); 749 m_log.WarnFormat("[SCENE GRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
749 } 750 }
750 } 751 }
751 finally 752 finally
@@ -956,7 +957,8 @@ namespace OpenSim.Region.Framework.Scenes
956 if (Entities.TryGetValue(localID, out entity)) 957 if (Entities.TryGetValue(localID, out entity))
957 return entity as SceneObjectGroup; 958 return entity as SceneObjectGroup;
958 959
959 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); 960// m_log.DebugFormat("[SCENE GRAPH]: Entered GetGroupByPrim with localID {0}", localID);
961
960 SceneObjectGroup sog; 962 SceneObjectGroup sog;
961 lock (SceneObjectGroupsByLocalPartID) 963 lock (SceneObjectGroupsByLocalPartID)
962 SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog); 964 SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog);
@@ -964,8 +966,24 @@ namespace OpenSim.Region.Framework.Scenes
964 if (sog != null) 966 if (sog != null)
965 { 967 {
966 if (sog.HasChildPrim(localID)) 968 if (sog.HasChildPrim(localID))
969 {
970// m_log.DebugFormat(
971// "[SCENE GRAPH]: Found scene object {0} {1} {2} containing part with local id {3} in {4}. Returning.",
972// sog.Name, sog.UUID, sog.LocalId, localID, m_parentScene.RegionInfo.RegionName);
973
967 return sog; 974 return sog;
968 SceneObjectGroupsByLocalPartID.Remove(localID); 975 }
976 else
977 {
978 lock (SceneObjectGroupsByLocalPartID)
979 {
980 m_log.WarnFormat(
981 "[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}.",
982 sog.Name, sog.UUID, sog.LocalId, localID, m_parentScene.RegionInfo.RegionName);
983
984 SceneObjectGroupsByLocalPartID.Remove(localID);
985 }
986 }
969 } 987 }
970 988
971 EntityBase[] entityList = GetEntities(); 989 EntityBase[] entityList = GetEntities();