aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-03-26 00:57:52 +0000
committerJustin Clark-Casey (justincc)2011-03-26 00:57:52 +0000
commit3d0e072d500f0d76547fb6f93848a289ee42af9f (patch)
treef387ac0d7e5579d6b53fb282c0209b2053063039 /OpenSim/Region
parentAdd test for PCM taint. This currently fails due to unexpected behaviour of ... (diff)
parentMake SceneGraph.ForEachSOG() execute once for each SOG, not once for each pri... (diff)
downloadopensim-SC_OLD-3d0e072d500f0d76547fb6f93848a289ee42af9f.zip
opensim-SC_OLD-3d0e072d500f0d76547fb6f93848a289ee42af9f.tar.gz
opensim-SC_OLD-3d0e072d500f0d76547fb6f93848a289ee42af9f.tar.bz2
opensim-SC_OLD-3d0e072d500f0d76547fb6f93848a289ee42af9f.tar.xz
Merge branch 'master' into primcounts
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs76
1 files changed, 48 insertions, 28 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index eca2786..1621398 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -88,9 +88,21 @@ namespace OpenSim.Region.Framework.Scenes
88 protected internal object m_syncRoot = new object(); 88 protected internal object m_syncRoot = new object();
89 89
90 protected internal PhysicsScene _PhyScene; 90 protected internal PhysicsScene _PhyScene;
91 91
92 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>(); 92 /// <summary>
93 /// Index the SceneObjectGroup for each part by the root part's UUID.
94 /// </summary>
93 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>(); 95 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>();
96
97 /// <summary>
98 /// Index the SceneObjectGroup for each part by that part's UUID.
99 /// </summary>
100 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullPartID = new Dictionary<UUID, SceneObjectGroup>();
101
102 /// <summary>
103 /// Index the SceneObjectGroup for each part by that part's local ID.
104 /// </summary>
105 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
94 106
95 private Object m_updateLock = new Object(); 107 private Object m_updateLock = new Object();
96 108
@@ -133,8 +145,10 @@ namespace OpenSim.Region.Framework.Scenes
133 145
134 lock (SceneObjectGroupsByFullID) 146 lock (SceneObjectGroupsByFullID)
135 SceneObjectGroupsByFullID.Clear(); 147 SceneObjectGroupsByFullID.Clear();
136 lock (SceneObjectGroupsByLocalID) 148 lock (SceneObjectGroupsByFullPartID)
137 SceneObjectGroupsByLocalID.Clear(); 149 SceneObjectGroupsByFullPartID.Clear();
150 lock (SceneObjectGroupsByLocalPartID)
151 SceneObjectGroupsByLocalPartID.Clear();
138 152
139 Entities.Clear(); 153 Entities.Clear();
140 } 154 }
@@ -385,17 +399,20 @@ namespace OpenSim.Region.Framework.Scenes
385 OnObjectCreate(sceneObject); 399 OnObjectCreate(sceneObject);
386 400
387 lock (SceneObjectGroupsByFullID) 401 lock (SceneObjectGroupsByFullID)
388 {
389 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 402 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
403
404 lock (SceneObjectGroupsByFullPartID)
405 {
406 SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject;
390 foreach (SceneObjectPart part in children) 407 foreach (SceneObjectPart part in children)
391 SceneObjectGroupsByFullID[part.UUID] = sceneObject; 408 SceneObjectGroupsByFullPartID[part.UUID] = sceneObject;
392 } 409 }
393 410
394 lock (SceneObjectGroupsByLocalID) 411 lock (SceneObjectGroupsByLocalPartID)
395 { 412 {
396 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; 413 SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject;
397 foreach (SceneObjectPart part in children) 414 foreach (SceneObjectPart part in children)
398 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; 415 SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
399 } 416 }
400 417
401 return true; 418 return true;
@@ -426,21 +443,24 @@ namespace OpenSim.Region.Framework.Scenes
426 443
427 if (OnObjectRemove != null) 444 if (OnObjectRemove != null)
428 OnObjectRemove(Entities[uuid]); 445 OnObjectRemove(Entities[uuid]);
429 446
430 lock (SceneObjectGroupsByFullID) 447 lock (SceneObjectGroupsByFullID)
448 SceneObjectGroupsByFullID.Remove(grp.UUID);
449
450 lock (SceneObjectGroupsByFullPartID)
431 { 451 {
432 SceneObjectPart[] parts = grp.Parts; 452 SceneObjectPart[] parts = grp.Parts;
433 for (int i = 0; i < parts.Length; i++) 453 for (int i = 0; i < parts.Length; i++)
434 SceneObjectGroupsByFullID.Remove(parts[i].UUID); 454 SceneObjectGroupsByFullPartID.Remove(parts[i].UUID);
435 SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); 455 SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID);
436 } 456 }
437 457
438 lock (SceneObjectGroupsByLocalID) 458 lock (SceneObjectGroupsByLocalPartID)
439 { 459 {
440 SceneObjectPart[] parts = grp.Parts; 460 SceneObjectPart[] parts = grp.Parts;
441 for (int i = 0; i < parts.Length; i++) 461 for (int i = 0; i < parts.Length; i++)
442 SceneObjectGroupsByLocalID.Remove(parts[i].LocalId); 462 SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId);
443 SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); 463 SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId);
444 } 464 }
445 465
446 return Entities.Remove(uuid); 466 return Entities.Remove(uuid);
@@ -854,14 +874,14 @@ namespace OpenSim.Region.Framework.Scenes
854 874
855 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); 875 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
856 SceneObjectGroup sog; 876 SceneObjectGroup sog;
857 lock (SceneObjectGroupsByLocalID) 877 lock (SceneObjectGroupsByLocalPartID)
858 SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); 878 SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog);
859 879
860 if (sog != null) 880 if (sog != null)
861 { 881 {
862 if (sog.HasChildPrim(localID)) 882 if (sog.HasChildPrim(localID))
863 return sog; 883 return sog;
864 SceneObjectGroupsByLocalID.Remove(localID); 884 SceneObjectGroupsByLocalPartID.Remove(localID);
865 } 885 }
866 886
867 EntityBase[] entityList = GetEntities(); 887 EntityBase[] entityList = GetEntities();
@@ -873,8 +893,8 @@ namespace OpenSim.Region.Framework.Scenes
873 sog = (SceneObjectGroup)ent; 893 sog = (SceneObjectGroup)ent;
874 if (sog.HasChildPrim(localID)) 894 if (sog.HasChildPrim(localID))
875 { 895 {
876 lock (SceneObjectGroupsByLocalID) 896 lock (SceneObjectGroupsByLocalPartID)
877 SceneObjectGroupsByLocalID[localID] = sog; 897 SceneObjectGroupsByLocalPartID[localID] = sog;
878 return sog; 898 return sog;
879 } 899 }
880 } 900 }
@@ -891,16 +911,16 @@ namespace OpenSim.Region.Framework.Scenes
891 private SceneObjectGroup GetGroupByPrim(UUID fullID) 911 private SceneObjectGroup GetGroupByPrim(UUID fullID)
892 { 912 {
893 SceneObjectGroup sog; 913 SceneObjectGroup sog;
894 lock (SceneObjectGroupsByFullID) 914 lock (SceneObjectGroupsByFullPartID)
895 SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); 915 SceneObjectGroupsByFullPartID.TryGetValue(fullID, out sog);
896 916
897 if (sog != null) 917 if (sog != null)
898 { 918 {
899 if (sog.ContainsPart(fullID)) 919 if (sog.ContainsPart(fullID))
900 return sog; 920 return sog;
901 921
902 lock (SceneObjectGroupsByFullID) 922 lock (SceneObjectGroupsByFullPartID)
903 SceneObjectGroupsByFullID.Remove(fullID); 923 SceneObjectGroupsByFullPartID.Remove(fullID);
904 } 924 }
905 925
906 EntityBase[] entityList = GetEntities(); 926 EntityBase[] entityList = GetEntities();
@@ -911,8 +931,8 @@ namespace OpenSim.Region.Framework.Scenes
911 sog = (SceneObjectGroup)ent; 931 sog = (SceneObjectGroup)ent;
912 if (sog.HasChildPrim(fullID)) 932 if (sog.HasChildPrim(fullID))
913 { 933 {
914 lock (SceneObjectGroupsByFullID) 934 lock (SceneObjectGroupsByFullPartID)
915 SceneObjectGroupsByFullID[fullID] = sog; 935 SceneObjectGroupsByFullPartID[fullID] = sog;
916 return sog; 936 return sog;
917 } 937 }
918 } 938 }
@@ -1064,11 +1084,12 @@ namespace OpenSim.Region.Framework.Scenes
1064 } 1084 }
1065 1085
1066 /// <summary> 1086 /// <summary>
1067 /// Performs action on all scene object groups. 1087 /// Performs action once on all scene object groups.
1068 /// </summary> 1088 /// </summary>
1069 /// <param name="action"></param> 1089 /// <param name="action"></param>
1070 protected internal void ForEachSOG(Action<SceneObjectGroup> action) 1090 protected internal void ForEachSOG(Action<SceneObjectGroup> action)
1071 { 1091 {
1092 // FIXME: Need to lock here, really.
1072 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); 1093 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
1073 foreach (SceneObjectGroup obj in objlist) 1094 foreach (SceneObjectGroup obj in objlist)
1074 { 1095 {
@@ -1084,7 +1105,6 @@ namespace OpenSim.Region.Framework.Scenes
1084 } 1105 }
1085 } 1106 }
1086 } 1107 }
1087
1088 1108
1089 /// <summary> 1109 /// <summary>
1090 /// Performs action on all scene presences. This can ultimately run the actions in parallel but 1110 /// Performs action on all scene presences. This can ultimately run the actions in parallel but