diff options
author | Melanie | 2011-03-27 21:22:31 +0100 |
---|---|---|
committer | Melanie | 2011-03-27 21:22:31 +0100 |
commit | f25749f0259bdfe334f77ab049ac5f892135bbc6 (patch) | |
tree | 5fd38027cbe794a1da1d87009f9975d3792f085a /OpenSim/Region/Framework | |
parent | Don't send a windlight profile to clients if windlight is not set for (diff) | |
parent | Add SignpostMarv to contributors (diff) | |
download | opensim-SC_OLD-f25749f0259bdfe334f77ab049ac5f892135bbc6.zip opensim-SC_OLD-f25749f0259bdfe334f77ab049ac5f892135bbc6.tar.gz opensim-SC_OLD-f25749f0259bdfe334f77ab049ac5f892135bbc6.tar.bz2 opensim-SC_OLD-f25749f0259bdfe334f77ab049ac5f892135bbc6.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IEstateDataService.cs | 58 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs | 62 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/ILandObject.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 30 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 119 |
6 files changed, 253 insertions, 41 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 c321a15..fd62535 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -242,7 +242,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
242 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); | 242 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); |
243 | 243 | ||
244 | public event EstateToolsSunUpdate OnEstateToolsSunUpdate; | 244 | public event EstateToolsSunUpdate OnEstateToolsSunUpdate; |
245 | |||
246 | /// <summary> | ||
247 | /// Triggered when an object is added to the scene. | ||
248 | /// </summary> | ||
249 | public event Action<SceneObjectGroup> OnObjectAddedToScene; | ||
245 | 250 | ||
251 | /// <summary> | ||
252 | /// Triggered when an object is removed from the scene. | ||
253 | /// </summary> | ||
246 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); | 254 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); |
247 | public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; | 255 | public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; |
248 | 256 | ||
@@ -345,6 +353,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
345 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); | 353 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); |
346 | public event Attach OnAttach; | 354 | public event Attach OnAttach; |
347 | 355 | ||
356 | |||
348 | /// <summary> | 357 | /// <summary> |
349 | /// Called immediately after an object is loaded from storage. | 358 | /// Called immediately after an object is loaded from storage. |
350 | /// </summary> | 359 | /// </summary> |
@@ -800,6 +809,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
800 | } | 809 | } |
801 | } | 810 | } |
802 | 811 | ||
812 | public void TriggerObjectAddedToScene(SceneObjectGroup obj) | ||
813 | { | ||
814 | Action<SceneObjectGroup> handler = OnObjectAddedToScene; | ||
815 | if (handler != null) | ||
816 | { | ||
817 | foreach (Action<SceneObjectGroup> d in handler.GetInvocationList()) | ||
818 | { | ||
819 | try | ||
820 | { | ||
821 | d(obj); | ||
822 | } | ||
823 | catch (Exception e) | ||
824 | { | ||
825 | m_log.ErrorFormat( | ||
826 | "[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}", | ||
827 | e.Message, e.StackTrace); | ||
828 | } | ||
829 | } | ||
830 | } | ||
831 | } | ||
832 | |||
803 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) | 833 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) |
804 | { | 834 | { |
805 | ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; | 835 | ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1a6a70b..d407a6f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1109,7 +1109,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1109 | // | 1109 | // |
1110 | while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) | 1110 | while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) |
1111 | { | 1111 | { |
1112 | MainConsole.Instance.Output("The current estate has no owner set."); | 1112 | MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName); |
1113 | List<char> excluded = new List<char>(new char[1]{' '}); | 1113 | List<char> excluded = new List<char>(new char[1]{' '}); |
1114 | string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); | 1114 | string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); |
1115 | string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); | 1115 | string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); |
@@ -1956,8 +1956,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1956 | /// If false, it is left to the caller to schedule the update | 1956 | /// If false, it is left to the caller to schedule the update |
1957 | /// </param> | 1957 | /// </param> |
1958 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 1958 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
1959 | { | 1959 | { |
1960 | return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); | 1960 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) |
1961 | { | ||
1962 | EventManager.TriggerObjectAddedToScene(sceneObject); | ||
1963 | return true; | ||
1964 | } | ||
1965 | |||
1966 | return false; | ||
1961 | } | 1967 | } |
1962 | 1968 | ||
1963 | /// <summary> | 1969 | /// <summary> |
@@ -1974,7 +1980,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1974 | public bool AddNewSceneObject( | 1980 | public bool AddNewSceneObject( |
1975 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) | 1981 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) |
1976 | { | 1982 | { |
1977 | return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); | 1983 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) |
1984 | { | ||
1985 | EventManager.TriggerObjectAddedToScene(sceneObject); | ||
1986 | return true; | ||
1987 | } | ||
1988 | |||
1989 | return false; | ||
1978 | } | 1990 | } |
1979 | 1991 | ||
1980 | /// <summary> | 1992 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 734ba22..60855b2 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 | } |
@@ -349,6 +363,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
349 | 363 | ||
350 | if (Entities.ContainsKey(sceneObject.UUID)) | 364 | if (Entities.ContainsKey(sceneObject.UUID)) |
351 | return false; | 365 | return false; |
366 | |||
367 | // m_log.DebugFormat( | ||
368 | // "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", | ||
369 | // sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); | ||
352 | 370 | ||
353 | SceneObjectPart[] children = sceneObject.Parts; | 371 | SceneObjectPart[] children = sceneObject.Parts; |
354 | 372 | ||
@@ -385,17 +403,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
385 | OnObjectCreate(sceneObject); | 403 | OnObjectCreate(sceneObject); |
386 | 404 | ||
387 | lock (SceneObjectGroupsByFullID) | 405 | lock (SceneObjectGroupsByFullID) |
388 | { | ||
389 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | 406 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; |
407 | |||
408 | lock (SceneObjectGroupsByFullPartID) | ||
409 | { | ||
410 | SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject; | ||
390 | foreach (SceneObjectPart part in children) | 411 | foreach (SceneObjectPart part in children) |
391 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; | 412 | SceneObjectGroupsByFullPartID[part.UUID] = sceneObject; |
392 | } | 413 | } |
393 | 414 | ||
394 | lock (SceneObjectGroupsByLocalID) | 415 | lock (SceneObjectGroupsByLocalPartID) |
395 | { | 416 | { |
396 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | 417 | SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject; |
397 | foreach (SceneObjectPart part in children) | 418 | foreach (SceneObjectPart part in children) |
398 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; | 419 | SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject; |
399 | } | 420 | } |
400 | 421 | ||
401 | return true; | 422 | return true; |
@@ -426,21 +447,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
426 | 447 | ||
427 | if (OnObjectRemove != null) | 448 | if (OnObjectRemove != null) |
428 | OnObjectRemove(Entities[uuid]); | 449 | OnObjectRemove(Entities[uuid]); |
429 | 450 | ||
430 | lock (SceneObjectGroupsByFullID) | 451 | lock (SceneObjectGroupsByFullID) |
452 | SceneObjectGroupsByFullID.Remove(grp.UUID); | ||
453 | |||
454 | lock (SceneObjectGroupsByFullPartID) | ||
431 | { | 455 | { |
432 | SceneObjectPart[] parts = grp.Parts; | 456 | SceneObjectPart[] parts = grp.Parts; |
433 | for (int i = 0; i < parts.Length; i++) | 457 | for (int i = 0; i < parts.Length; i++) |
434 | SceneObjectGroupsByFullID.Remove(parts[i].UUID); | 458 | SceneObjectGroupsByFullPartID.Remove(parts[i].UUID); |
435 | SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); | 459 | SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID); |
436 | } | 460 | } |
437 | 461 | ||
438 | lock (SceneObjectGroupsByLocalID) | 462 | lock (SceneObjectGroupsByLocalPartID) |
439 | { | 463 | { |
440 | SceneObjectPart[] parts = grp.Parts; | 464 | SceneObjectPart[] parts = grp.Parts; |
441 | for (int i = 0; i < parts.Length; i++) | 465 | for (int i = 0; i < parts.Length; i++) |
442 | SceneObjectGroupsByLocalID.Remove(parts[i].LocalId); | 466 | SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId); |
443 | SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); | 467 | SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId); |
444 | } | 468 | } |
445 | 469 | ||
446 | return Entities.Remove(uuid); | 470 | return Entities.Remove(uuid); |
@@ -627,7 +651,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
627 | if (!Entities.Remove(agentID)) | 651 | if (!Entities.Remove(agentID)) |
628 | { | 652 | { |
629 | m_log.WarnFormat( | 653 | m_log.WarnFormat( |
630 | "[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", | 654 | "[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", |
631 | agentID); | 655 | agentID); |
632 | } | 656 | } |
633 | 657 | ||
@@ -650,7 +674,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
650 | } | 674 | } |
651 | else | 675 | else |
652 | { | 676 | { |
653 | m_log.WarnFormat("[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); | 677 | m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); |
654 | } | 678 | } |
655 | } | 679 | } |
656 | } | 680 | } |
@@ -854,14 +878,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
854 | 878 | ||
855 | //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); | 879 | //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); |
856 | SceneObjectGroup sog; | 880 | SceneObjectGroup sog; |
857 | lock (SceneObjectGroupsByLocalID) | 881 | lock (SceneObjectGroupsByLocalPartID) |
858 | SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); | 882 | SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog); |
859 | 883 | ||
860 | if (sog != null) | 884 | if (sog != null) |
861 | { | 885 | { |
862 | if (sog.HasChildPrim(localID)) | 886 | if (sog.HasChildPrim(localID)) |
863 | return sog; | 887 | return sog; |
864 | SceneObjectGroupsByLocalID.Remove(localID); | 888 | SceneObjectGroupsByLocalPartID.Remove(localID); |
865 | } | 889 | } |
866 | 890 | ||
867 | EntityBase[] entityList = GetEntities(); | 891 | EntityBase[] entityList = GetEntities(); |
@@ -873,8 +897,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
873 | sog = (SceneObjectGroup)ent; | 897 | sog = (SceneObjectGroup)ent; |
874 | if (sog.HasChildPrim(localID)) | 898 | if (sog.HasChildPrim(localID)) |
875 | { | 899 | { |
876 | lock (SceneObjectGroupsByLocalID) | 900 | lock (SceneObjectGroupsByLocalPartID) |
877 | SceneObjectGroupsByLocalID[localID] = sog; | 901 | SceneObjectGroupsByLocalPartID[localID] = sog; |
878 | return sog; | 902 | return sog; |
879 | } | 903 | } |
880 | } | 904 | } |
@@ -891,16 +915,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
891 | private SceneObjectGroup GetGroupByPrim(UUID fullID) | 915 | private SceneObjectGroup GetGroupByPrim(UUID fullID) |
892 | { | 916 | { |
893 | SceneObjectGroup sog; | 917 | SceneObjectGroup sog; |
894 | lock (SceneObjectGroupsByFullID) | 918 | lock (SceneObjectGroupsByFullPartID) |
895 | SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); | 919 | SceneObjectGroupsByFullPartID.TryGetValue(fullID, out sog); |
896 | 920 | ||
897 | if (sog != null) | 921 | if (sog != null) |
898 | { | 922 | { |
899 | if (sog.ContainsPart(fullID)) | 923 | if (sog.ContainsPart(fullID)) |
900 | return sog; | 924 | return sog; |
901 | 925 | ||
902 | lock (SceneObjectGroupsByFullID) | 926 | lock (SceneObjectGroupsByFullPartID) |
903 | SceneObjectGroupsByFullID.Remove(fullID); | 927 | SceneObjectGroupsByFullPartID.Remove(fullID); |
904 | } | 928 | } |
905 | 929 | ||
906 | EntityBase[] entityList = GetEntities(); | 930 | EntityBase[] entityList = GetEntities(); |
@@ -911,8 +935,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
911 | sog = (SceneObjectGroup)ent; | 935 | sog = (SceneObjectGroup)ent; |
912 | if (sog.HasChildPrim(fullID)) | 936 | if (sog.HasChildPrim(fullID)) |
913 | { | 937 | { |
914 | lock (SceneObjectGroupsByFullID) | 938 | lock (SceneObjectGroupsByFullPartID) |
915 | SceneObjectGroupsByFullID[fullID] = sog; | 939 | SceneObjectGroupsByFullPartID[fullID] = sog; |
916 | return sog; | 940 | return sog; |
917 | } | 941 | } |
918 | } | 942 | } |
@@ -1064,11 +1088,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1064 | } | 1088 | } |
1065 | 1089 | ||
1066 | /// <summary> | 1090 | /// <summary> |
1067 | /// Performs action on all scene object groups. | 1091 | /// Performs action once on all scene object groups. |
1068 | /// </summary> | 1092 | /// </summary> |
1069 | /// <param name="action"></param> | 1093 | /// <param name="action"></param> |
1070 | protected internal void ForEachSOG(Action<SceneObjectGroup> action) | 1094 | protected internal void ForEachSOG(Action<SceneObjectGroup> action) |
1071 | { | 1095 | { |
1096 | // FIXME: Need to lock here, really. | ||
1072 | List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); | 1097 | List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); |
1073 | foreach (SceneObjectGroup obj in objlist) | 1098 | foreach (SceneObjectGroup obj in objlist) |
1074 | { | 1099 | { |
@@ -1079,11 +1104,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1079 | catch (Exception e) | 1104 | catch (Exception e) |
1080 | { | 1105 | { |
1081 | // Catch it and move on. This includes situations where splist has inconsistent info | 1106 | // Catch it and move on. This includes situations where splist has inconsistent info |
1082 | m_log.WarnFormat("[SCENE]: Problem processing action in ForEachSOG: ", e.ToString()); | 1107 | m_log.WarnFormat( |
1108 | "[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace); | ||
1083 | } | 1109 | } |
1084 | } | 1110 | } |
1085 | } | 1111 | } |
1086 | |||
1087 | 1112 | ||
1088 | /// <summary> | 1113 | /// <summary> |
1089 | /// Performs action on all scene presences. This can ultimately run the actions in parallel but | 1114 | /// Performs action on all scene presences. This can ultimately run the actions in parallel but |
@@ -1103,8 +1128,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1103 | } | 1128 | } |
1104 | catch (Exception e) | 1129 | catch (Exception e) |
1105 | { | 1130 | { |
1106 | m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); | 1131 | m_log.Info("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); |
1107 | m_log.Info("[BUG] Stack Trace: " + e.StackTrace); | 1132 | m_log.Info("[SCENEGRAPH]: Stack Trace: " + e.StackTrace); |
1108 | } | 1133 | } |
1109 | }); | 1134 | }); |
1110 | Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction); | 1135 | Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction); |
@@ -1119,7 +1144,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1119 | } | 1144 | } |
1120 | catch (Exception e) | 1145 | catch (Exception e) |
1121 | { | 1146 | { |
1122 | m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); | 1147 | m_log.Error("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); |
1123 | } | 1148 | } |
1124 | } | 1149 | } |
1125 | } | 1150 | } |
@@ -1777,7 +1802,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1777 | /// <param name="rot"></param> | 1802 | /// <param name="rot"></param> |
1778 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) | 1803 | public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) |
1779 | { | 1804 | { |
1780 | //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); | 1805 | // m_log.DebugFormat( |
1806 | // "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", | ||
1807 | // originalPrimID, offset, AgentID); | ||
1808 | |||
1781 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); | 1809 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); |
1782 | if (original != null) | 1810 | if (original != null) |
1783 | { | 1811 | { |
@@ -1808,7 +1836,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1808 | copy.RootPart.SalePrice = 10; | 1836 | copy.RootPart.SalePrice = 10; |
1809 | } | 1837 | } |
1810 | 1838 | ||
1839 | // FIXME: This section needs to be refactored so that it just calls AddSceneObject() | ||
1811 | Entities.Add(copy); | 1840 | Entities.Add(copy); |
1841 | |||
1842 | lock (SceneObjectGroupsByFullID) | ||
1843 | SceneObjectGroupsByFullID[copy.UUID] = copy; | ||
1844 | |||
1845 | SceneObjectPart[] children = copy.Parts; | ||
1846 | |||
1847 | lock (SceneObjectGroupsByFullPartID) | ||
1848 | { | ||
1849 | SceneObjectGroupsByFullPartID[copy.UUID] = copy; | ||
1850 | foreach (SceneObjectPart part in children) | ||
1851 | SceneObjectGroupsByFullPartID[part.UUID] = copy; | ||
1852 | } | ||
1853 | |||
1854 | lock (SceneObjectGroupsByLocalPartID) | ||
1855 | { | ||
1856 | SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; | ||
1857 | foreach (SceneObjectPart part in children) | ||
1858 | SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; | ||
1859 | } | ||
1860 | // PROBABLE END OF FIXME | ||
1812 | 1861 | ||
1813 | // Since we copy from a source group that is in selected | 1862 | // Since we copy from a source group that is in selected |
1814 | // state, but the copy is shown deselected in the viewer, | 1863 | // state, but the copy is shown deselected in the viewer, |