aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateDataService.cs58
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs62
-rw-r--r--OpenSim/Region/Framework/Interfaces/ILandObject.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs125
6 files changed, 255 insertions, 45 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
index 95c9659..38c10a6 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
@@ -34,12 +34,68 @@ namespace OpenSim.Region.Framework.Interfaces
34{ 34{
35 public interface IEstateDataService 35 public interface IEstateDataService
36 { 36 {
37 /// <summary>
38 /// Load estate settings for a region.
39 /// </summary>
40 /// <param name="regionID"></param>
41 /// <param name="create">If true, then an estate is created if one is not found.</param>
42 /// <returns></returns>
37 EstateSettings LoadEstateSettings(UUID regionID, bool create); 43 EstateSettings LoadEstateSettings(UUID regionID, bool create);
44
45 /// <summary>
46 /// Load estate settings for an estate ID.
47 /// </summary>
48 /// <param name="estateID"></param>
49 /// <returns></returns>
38 EstateSettings LoadEstateSettings(int estateID); 50 EstateSettings LoadEstateSettings(int estateID);
51
52 /// <summary>
53 /// Load/Get all estate settings.
54 /// </summary>
55 /// <returns>An empty list if no estates were found.</returns>
56 List<EstateSettings> LoadEstateSettingsAll();
57
58 /// <summary>
59 /// Store estate settings.
60 /// </summary>
61 /// <remarks>
62 /// This is also called by EstateSettings.Save()</remarks>
63 /// <param name="es"></param>
39 void StoreEstateSettings(EstateSettings es); 64 void StoreEstateSettings(EstateSettings es);
65
66 /// <summary>
67 /// Get estate IDs.
68 /// </summary>
69 /// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param>
70 /// <returns></returns>
40 List<int> GetEstates(string search); 71 List<int> GetEstates(string search);
72
73 /// <summary>
74 /// Get the IDs of all estates.
75 /// </summary>
76 /// <returns>An empty list if no estates were found.</returns>
77 List<int> GetEstatesAll();
78
79 /// <summary>
80 /// Link a region to an estate.
81 /// </summary>
82 /// <param name="regionID"></param>
83 /// <param name="estateID"></param>
84 /// <returns>true if the link succeeded, false otherwise</returns>
41 bool LinkRegion(UUID regionID, int estateID); 85 bool LinkRegion(UUID regionID, int estateID);
86
87 /// <summary>
88 /// Get the UUIDs of all the regions in an estate.
89 /// </summary>
90 /// <param name="estateID"></param>
91 /// <returns></returns>
42 List<UUID> GetRegions(int estateID); 92 List<UUID> GetRegions(int estateID);
93
94 /// <summary>
95 /// Delete an estate
96 /// </summary>
97 /// <param name="estateID"></param>
98 /// <returns>true if the delete succeeded, false otherwise</returns>
43 bool DeleteEstate(int estateID); 99 bool DeleteEstate(int estateID);
44 } 100 }
45} 101} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
index 87c7a05..c82661d 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
@@ -33,14 +33,74 @@ namespace OpenSim.Region.Framework.Interfaces
33{ 33{
34 public interface IEstateDataStore 34 public interface IEstateDataStore
35 { 35 {
36 /// <summary>
37 /// Initialise the data store.
38 /// </summary>
39 /// <param name="connectstring"></param>
36 void Initialise(string connectstring); 40 void Initialise(string connectstring);
37 41
42 /// <summary>
43 /// Load estate settings for a region.
44 /// </summary>
45 /// <param name="regionID"></param>
46 /// <param name="create">If true, then an estate is created if one is not found.</param>
47 /// <returns></returns>
38 EstateSettings LoadEstateSettings(UUID regionID, bool create); 48 EstateSettings LoadEstateSettings(UUID regionID, bool create);
49
50 /// <summary>
51 /// Load estate settings for an estate ID.
52 /// </summary>
53 /// <param name="estateID"></param>
54 /// <returns></returns>
39 EstateSettings LoadEstateSettings(int estateID); 55 EstateSettings LoadEstateSettings(int estateID);
56
57 /// <summary>
58 /// Load/Get all estate settings.
59 /// </summary>
60 /// <returns>An empty list if no estates were found.</returns>
61 List<EstateSettings> LoadEstateSettingsAll();
62
63 /// <summary>
64 /// Store estate settings.
65 /// </summary>
66 /// <remarks>
67 /// This is also called by EstateSettings.Save()</remarks>
68 /// <param name="es"></param>
40 void StoreEstateSettings(EstateSettings es); 69 void StoreEstateSettings(EstateSettings es);
70
71 /// <summary>
72 /// Get estate IDs.
73 /// </summary>
74 /// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param>
75 /// <returns></returns>
41 List<int> GetEstates(string search); 76 List<int> GetEstates(string search);
77
78 /// <summary>
79 /// Get the IDs of all estates.
80 /// </summary>
81 /// <returns>An empty list if no estates were found.</returns>
82 List<int> GetEstatesAll();
83
84 /// <summary>
85 /// Link a region to an estate.
86 /// </summary>
87 /// <param name="regionID"></param>
88 /// <param name="estateID"></param>
89 /// <returns>true if the link succeeded, false otherwise</returns>
42 bool LinkRegion(UUID regionID, int estateID); 90 bool LinkRegion(UUID regionID, int estateID);
91
92 /// <summary>
93 /// Get the UUIDs of all the regions in an estate.
94 /// </summary>
95 /// <param name="estateID"></param>
96 /// <returns></returns>
43 List<UUID> GetRegions(int estateID); 97 List<UUID> GetRegions(int estateID);
98
99 /// <summary>
100 /// Delete an estate
101 /// </summary>
102 /// <param name="estateID"></param>
103 /// <returns>true if the delete succeeded, false otherwise</returns>
44 bool DeleteEstate(int estateID); 104 bool DeleteEstate(int estateID);
45 } 105 }
46} 106} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
index eeb9d3a..9c0abde 100644
--- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs
+++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
@@ -46,6 +46,11 @@ namespace OpenSim.Region.Framework.Interfaces
46 UUID RegionUUID { get; } 46 UUID RegionUUID { get; }
47 47
48 /// <summary> 48 /// <summary>
49 /// Prim counts for this land object.
50 /// </summary>
51 IPrimCounts PrimCounts { get; set; }
52
53 /// <summary>
49 /// The start point for the land object. This is the western-most point as one scans land working from 54 /// The start point for the land object. This is the western-most point as one scans land working from
50 /// north to south. 55 /// north to south.
51 /// </summary> 56 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index f24c53c..4ce7a6c 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -246,7 +246,15 @@ namespace OpenSim.Region.Framework.Scenes
246 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); 246 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
247 247
248 public event EstateToolsSunUpdate OnEstateToolsSunUpdate; 248 public event EstateToolsSunUpdate OnEstateToolsSunUpdate;
249
250 /// <summary>
251 /// Triggered when an object is added to the scene.
252 /// </summary>
253 public event Action<SceneObjectGroup> OnObjectAddedToScene;
249 254
255 /// <summary>
256 /// Triggered when an object is removed from the scene.
257 /// </summary>
250 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); 258 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
251 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; 259 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
252 260
@@ -349,6 +357,7 @@ namespace OpenSim.Region.Framework.Scenes
349 public delegate void Attach(uint localID, UUID itemID, UUID avatarID); 357 public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
350 public event Attach OnAttach; 358 public event Attach OnAttach;
351 359
360
352 /// <summary> 361 /// <summary>
353 /// Called immediately after an object is loaded from storage. 362 /// Called immediately after an object is loaded from storage.
354 /// </summary> 363 /// </summary>
@@ -824,6 +833,27 @@ namespace OpenSim.Region.Framework.Scenes
824 } 833 }
825 } 834 }
826 835
836 public void TriggerObjectAddedToScene(SceneObjectGroup obj)
837 {
838 Action<SceneObjectGroup> handler = OnObjectAddedToScene;
839 if (handler != null)
840 {
841 foreach (Action<SceneObjectGroup> d in handler.GetInvocationList())
842 {
843 try
844 {
845 d(obj);
846 }
847 catch (Exception e)
848 {
849 m_log.ErrorFormat(
850 "[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}",
851 e.Message, e.StackTrace);
852 }
853 }
854 }
855 }
856
827 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) 857 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
828 { 858 {
829 ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; 859 ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e5c0f38..4eb5d64 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1137,7 +1137,7 @@ namespace OpenSim.Region.Framework.Scenes
1137 // 1137 //
1138 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) 1138 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
1139 { 1139 {
1140 MainConsole.Instance.Output("The current estate has no owner set."); 1140 MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName);
1141 List<char> excluded = new List<char>(new char[1]{' '}); 1141 List<char> excluded = new List<char>(new char[1]{' '});
1142 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); 1142 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
1143 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); 1143 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
@@ -1998,8 +1998,14 @@ namespace OpenSim.Region.Framework.Scenes
1998 /// If false, it is left to the caller to schedule the update 1998 /// If false, it is left to the caller to schedule the update
1999 /// </param> 1999 /// </param>
2000 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 2000 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
2001 { 2001 {
2002 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); 2002 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates))
2003 {
2004 EventManager.TriggerObjectAddedToScene(sceneObject);
2005 return true;
2006 }
2007
2008 return false;
2003 } 2009 }
2004 2010
2005 /// <summary> 2011 /// <summary>
@@ -2016,7 +2022,13 @@ namespace OpenSim.Region.Framework.Scenes
2016 public bool AddNewSceneObject( 2022 public bool AddNewSceneObject(
2017 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) 2023 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
2018 { 2024 {
2019 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); 2025 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel))
2026 {
2027 EventManager.TriggerObjectAddedToScene(sceneObject);
2028 return true;
2029 }
2030
2031 return false;
2020 } 2032 }
2021 2033
2022 /// <summary> 2034 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index e8cf4f4..62e7d36 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -97,9 +97,21 @@ namespace OpenSim.Region.Framework.Scenes
97 protected internal object m_syncRoot = new object(); 97 protected internal object m_syncRoot = new object();
98 98
99 protected internal PhysicsScene _PhyScene; 99 protected internal PhysicsScene _PhyScene;
100 100
101 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>(); 101 /// <summary>
102 /// Index the SceneObjectGroup for each part by the root part's UUID.
103 /// </summary>
102 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>(); 104 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>();
105
106 /// <summary>
107 /// Index the SceneObjectGroup for each part by that part's UUID.
108 /// </summary>
109 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullPartID = new Dictionary<UUID, SceneObjectGroup>();
110
111 /// <summary>
112 /// Index the SceneObjectGroup for each part by that part's local ID.
113 /// </summary>
114 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
103 115
104 private Object m_updateLock = new Object(); 116 private Object m_updateLock = new Object();
105 117
@@ -147,8 +159,10 @@ namespace OpenSim.Region.Framework.Scenes
147 159
148 lock (SceneObjectGroupsByFullID) 160 lock (SceneObjectGroupsByFullID)
149 SceneObjectGroupsByFullID.Clear(); 161 SceneObjectGroupsByFullID.Clear();
150 lock (SceneObjectGroupsByLocalID) 162 lock (SceneObjectGroupsByFullPartID)
151 SceneObjectGroupsByLocalID.Clear(); 163 SceneObjectGroupsByFullPartID.Clear();
164 lock (SceneObjectGroupsByLocalPartID)
165 SceneObjectGroupsByLocalPartID.Clear();
152 166
153 Entities.Clear(); 167 Entities.Clear();
154 } 168 }
@@ -390,6 +404,10 @@ namespace OpenSim.Region.Framework.Scenes
390 404
391 if (Entities.ContainsKey(sceneObject.UUID)) 405 if (Entities.ContainsKey(sceneObject.UUID))
392 return false; 406 return false;
407
408// m_log.DebugFormat(
409// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
410// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName);
393 411
394 SceneObjectPart[] children = sceneObject.Parts; 412 SceneObjectPart[] children = sceneObject.Parts;
395 413
@@ -426,17 +444,20 @@ namespace OpenSim.Region.Framework.Scenes
426 OnObjectCreate(sceneObject); 444 OnObjectCreate(sceneObject);
427 445
428 lock (SceneObjectGroupsByFullID) 446 lock (SceneObjectGroupsByFullID)
429 {
430 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 447 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
448
449 lock (SceneObjectGroupsByFullPartID)
450 {
451 SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject;
431 foreach (SceneObjectPart part in children) 452 foreach (SceneObjectPart part in children)
432 SceneObjectGroupsByFullID[part.UUID] = sceneObject; 453 SceneObjectGroupsByFullPartID[part.UUID] = sceneObject;
433 } 454 }
434 455
435 lock (SceneObjectGroupsByLocalID) 456 lock (SceneObjectGroupsByLocalPartID)
436 { 457 {
437 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; 458 SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject;
438 foreach (SceneObjectPart part in children) 459 foreach (SceneObjectPart part in children)
439 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; 460 SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
440 } 461 }
441 462
442 return true; 463 return true;
@@ -467,21 +488,24 @@ namespace OpenSim.Region.Framework.Scenes
467 488
468 if (OnObjectRemove != null) 489 if (OnObjectRemove != null)
469 OnObjectRemove(Entities[uuid]); 490 OnObjectRemove(Entities[uuid]);
470 491
471 lock (SceneObjectGroupsByFullID) 492 lock (SceneObjectGroupsByFullID)
493 SceneObjectGroupsByFullID.Remove(grp.UUID);
494
495 lock (SceneObjectGroupsByFullPartID)
472 { 496 {
473 SceneObjectPart[] parts = grp.Parts; 497 SceneObjectPart[] parts = grp.Parts;
474 for (int i = 0; i < parts.Length; i++) 498 for (int i = 0; i < parts.Length; i++)
475 SceneObjectGroupsByFullID.Remove(parts[i].UUID); 499 SceneObjectGroupsByFullPartID.Remove(parts[i].UUID);
476 SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); 500 SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID);
477 } 501 }
478 502
479 lock (SceneObjectGroupsByLocalID) 503 lock (SceneObjectGroupsByLocalPartID)
480 { 504 {
481 SceneObjectPart[] parts = grp.Parts; 505 SceneObjectPart[] parts = grp.Parts;
482 for (int i = 0; i < parts.Length; i++) 506 for (int i = 0; i < parts.Length; i++)
483 SceneObjectGroupsByLocalID.Remove(parts[i].LocalId); 507 SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId);
484 SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); 508 SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId);
485 } 509 }
486 510
487 return Entities.Remove(uuid); 511 return Entities.Remove(uuid);
@@ -697,7 +721,7 @@ namespace OpenSim.Region.Framework.Scenes
697 if (!Entities.Remove(agentID)) 721 if (!Entities.Remove(agentID))
698 { 722 {
699 m_log.WarnFormat( 723 m_log.WarnFormat(
700 "[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", 724 "[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
701 agentID); 725 agentID);
702 } 726 }
703 727
@@ -721,7 +745,7 @@ namespace OpenSim.Region.Framework.Scenes
721 } 745 }
722 else 746 else
723 { 747 {
724 m_log.WarnFormat("[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); 748 m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
725 } 749 }
726 } 750 }
727 finally 751 finally
@@ -934,14 +958,14 @@ namespace OpenSim.Region.Framework.Scenes
934 958
935 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); 959 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
936 SceneObjectGroup sog; 960 SceneObjectGroup sog;
937 lock (SceneObjectGroupsByLocalID) 961 lock (SceneObjectGroupsByLocalPartID)
938 SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); 962 SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog);
939 963
940 if (sog != null) 964 if (sog != null)
941 { 965 {
942 if (sog.HasChildPrim(localID)) 966 if (sog.HasChildPrim(localID))
943 return sog; 967 return sog;
944 SceneObjectGroupsByLocalID.Remove(localID); 968 SceneObjectGroupsByLocalPartID.Remove(localID);
945 } 969 }
946 970
947 EntityBase[] entityList = GetEntities(); 971 EntityBase[] entityList = GetEntities();
@@ -953,8 +977,8 @@ namespace OpenSim.Region.Framework.Scenes
953 sog = (SceneObjectGroup)ent; 977 sog = (SceneObjectGroup)ent;
954 if (sog.HasChildPrim(localID)) 978 if (sog.HasChildPrim(localID))
955 { 979 {
956 lock (SceneObjectGroupsByLocalID) 980 lock (SceneObjectGroupsByLocalPartID)
957 SceneObjectGroupsByLocalID[localID] = sog; 981 SceneObjectGroupsByLocalPartID[localID] = sog;
958 return sog; 982 return sog;
959 } 983 }
960 } 984 }
@@ -971,16 +995,16 @@ namespace OpenSim.Region.Framework.Scenes
971 private SceneObjectGroup GetGroupByPrim(UUID fullID) 995 private SceneObjectGroup GetGroupByPrim(UUID fullID)
972 { 996 {
973 SceneObjectGroup sog; 997 SceneObjectGroup sog;
974 lock (SceneObjectGroupsByFullID) 998 lock (SceneObjectGroupsByFullPartID)
975 SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); 999 SceneObjectGroupsByFullPartID.TryGetValue(fullID, out sog);
976 1000
977 if (sog != null) 1001 if (sog != null)
978 { 1002 {
979 if (sog.ContainsPart(fullID)) 1003 if (sog.ContainsPart(fullID))
980 return sog; 1004 return sog;
981 1005
982 lock (SceneObjectGroupsByFullID) 1006 lock (SceneObjectGroupsByFullPartID)
983 SceneObjectGroupsByFullID.Remove(fullID); 1007 SceneObjectGroupsByFullPartID.Remove(fullID);
984 } 1008 }
985 1009
986 EntityBase[] entityList = GetEntities(); 1010 EntityBase[] entityList = GetEntities();
@@ -991,8 +1015,8 @@ namespace OpenSim.Region.Framework.Scenes
991 sog = (SceneObjectGroup)ent; 1015 sog = (SceneObjectGroup)ent;
992 if (sog.HasChildPrim(fullID)) 1016 if (sog.HasChildPrim(fullID))
993 { 1017 {
994 lock (SceneObjectGroupsByFullID) 1018 lock (SceneObjectGroupsByFullPartID)
995 SceneObjectGroupsByFullID[fullID] = sog; 1019 SceneObjectGroupsByFullPartID[fullID] = sog;
996 return sog; 1020 return sog;
997 } 1021 }
998 } 1022 }
@@ -1144,16 +1168,15 @@ namespace OpenSim.Region.Framework.Scenes
1144 } 1168 }
1145 1169
1146 /// <summary> 1170 /// <summary>
1147 /// Performs action on all scene object groups. 1171 /// Performs action once on all scene object groups.
1148 /// </summary> 1172 /// </summary>
1149 /// <param name="action"></param> 1173 /// <param name="action"></param>
1150 protected internal void ForEachSOG(Action<SceneObjectGroup> action) 1174 protected internal void ForEachSOG(Action<SceneObjectGroup> action)
1151 { 1175 {
1152 EntityBase[] objlist = Entities.GetAllByType<SceneObjectGroup>(); 1176 // FIXME: Need to lock here, really.
1153 foreach (EntityBase ent in objlist) 1177 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
1178 foreach (SceneObjectGroup obj in objlist)
1154 { 1179 {
1155 SceneObjectGroup obj = (SceneObjectGroup)ent;
1156
1157 try 1180 try
1158 { 1181 {
1159 action(obj); 1182 action(obj);
@@ -1161,11 +1184,11 @@ namespace OpenSim.Region.Framework.Scenes
1161 catch (Exception e) 1184 catch (Exception e)
1162 { 1185 {
1163 // Catch it and move on. This includes situations where splist has inconsistent info 1186 // Catch it and move on. This includes situations where splist has inconsistent info
1164 m_log.WarnFormat("[SCENE]: Problem processing action in ForEachSOG: ", e.ToString()); 1187 m_log.WarnFormat(
1188 "[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace);
1165 } 1189 }
1166 } 1190 }
1167 } 1191 }
1168
1169 1192
1170 /// <summary> 1193 /// <summary>
1171 /// Performs action on all scene presences. This can ultimately run the actions in parallel but 1194 /// Performs action on all scene presences. This can ultimately run the actions in parallel but
@@ -1185,8 +1208,8 @@ namespace OpenSim.Region.Framework.Scenes
1185 } 1208 }
1186 catch (Exception e) 1209 catch (Exception e)
1187 { 1210 {
1188 m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); 1211 m_log.Info("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
1189 m_log.Info("[BUG] Stack Trace: " + e.StackTrace); 1212 m_log.Info("[SCENEGRAPH]: Stack Trace: " + e.StackTrace);
1190 } 1213 }
1191 }); 1214 });
1192 Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction); 1215 Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction);
@@ -1201,7 +1224,7 @@ namespace OpenSim.Region.Framework.Scenes
1201 } 1224 }
1202 catch (Exception e) 1225 catch (Exception e)
1203 { 1226 {
1204 m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); 1227 m_log.Error("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
1205 } 1228 }
1206 } 1229 }
1207 } 1230 }
@@ -1884,7 +1907,10 @@ namespace OpenSim.Region.Framework.Scenes
1884 /// <param name="rot"></param> 1907 /// <param name="rot"></param>
1885 public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) 1908 public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
1886 { 1909 {
1887 //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); 1910// m_log.DebugFormat(
1911// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
1912// originalPrimID, offset, AgentID);
1913
1888 SceneObjectGroup original = GetGroupByPrim(originalPrimID); 1914 SceneObjectGroup original = GetGroupByPrim(originalPrimID);
1889 if (original != null) 1915 if (original != null)
1890 { 1916 {
@@ -1912,7 +1938,28 @@ namespace OpenSim.Region.Framework.Scenes
1912 } 1938 }
1913 } 1939 }
1914 1940
1941 // FIXME: This section needs to be refactored so that it just calls AddSceneObject()
1915 Entities.Add(copy); 1942 Entities.Add(copy);
1943
1944 lock (SceneObjectGroupsByFullID)
1945 SceneObjectGroupsByFullID[copy.UUID] = copy;
1946
1947 SceneObjectPart[] children = copy.Parts;
1948
1949 lock (SceneObjectGroupsByFullPartID)
1950 {
1951 SceneObjectGroupsByFullPartID[copy.UUID] = copy;
1952 foreach (SceneObjectPart part in children)
1953 SceneObjectGroupsByFullPartID[part.UUID] = copy;
1954 }
1955
1956 lock (SceneObjectGroupsByLocalPartID)
1957 {
1958 SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
1959 foreach (SceneObjectPart part in children)
1960 SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
1961 }
1962 // PROBABLE END OF FIXME
1916 1963
1917 // Since we copy from a source group that is in selected 1964 // Since we copy from a source group that is in selected
1918 // state, but the copy is shown deselected in the viewer, 1965 // state, but the copy is shown deselected in the viewer,