aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/EventManager.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-07-26 20:36:28 +0100
committerJustin Clark-Casey (justincc)2010-07-26 20:36:28 +0100
commitc70d57ff983d42b6898d766eb5536e56868b3213 (patch)
tree326eb90579dd02f15ebafe5017f405e03a55ffbf /OpenSim/Region/Framework/Scenes/EventManager.cs
parentAdd EventManager.OnSceneObjectLoaded() for future use. This is fired immedia... (diff)
downloadopensim-SC-c70d57ff983d42b6898d766eb5536e56868b3213.zip
opensim-SC-c70d57ff983d42b6898d766eb5536e56868b3213.tar.gz
opensim-SC-c70d57ff983d42b6898d766eb5536e56868b3213.tar.bz2
opensim-SC-c70d57ff983d42b6898d766eb5536e56868b3213.tar.xz
Add EventManager.OnSceneObjectPreSave() for future use. This is triggered immediately before a copy of the group is persisted to storage
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs39
1 files changed, 36 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 46e17c5..a4dd170 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -330,14 +330,26 @@ namespace OpenSim.Region.Framework.Scenes
330 /// If the object is being attached, then the avatarID will be present. If the object is being detached then 330 /// If the object is being attached, then the avatarID will be present. If the object is being detached then
331 /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). 331 /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical).
332 public delegate void Attach(uint localID, UUID itemID, UUID avatarID); 332 public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
333 public event Attach OnAttach; 333 public event Attach OnAttach;
334
335 public delegate void SceneObjectDelegate(SceneObjectGroup so);
336 334
337 /// <summary> 335 /// <summary>
338 /// Called immediately after an object is loaded from storage. 336 /// Called immediately after an object is loaded from storage.
339 /// </summary> 337 /// </summary>
340 public event SceneObjectDelegate OnSceneObjectLoaded; 338 public event SceneObjectDelegate OnSceneObjectLoaded;
339 public delegate void SceneObjectDelegate(SceneObjectGroup so);
340
341 /// <summary>
342 /// Called immediately before an object is saved to storage.
343 /// </summary>
344 /// <param name="persistingSo">
345 /// The scene object being persisted.
346 /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory.
347 /// </param>
348 /// <param name="originalSo">
349 /// The original scene object being persisted. Changes here will stay in memory but will not be saved to storage on this save.
350 /// </param>
351 public event SceneObjectPreSaveDelegate OnSceneObjectPreSave;
352 public delegate void SceneObjectPreSaveDelegate(SceneObjectGroup persistingSo, SceneObjectGroup originalSo);
341 353
342 public delegate void RegionUp(GridRegion region); 354 public delegate void RegionUp(GridRegion region);
343 public event RegionUp OnRegionUp; 355 public event RegionUp OnRegionUp;
@@ -2040,6 +2052,27 @@ namespace OpenSim.Region.Framework.Scenes
2040 } 2052 }
2041 } 2053 }
2042 } 2054 }
2055 }
2056
2057 public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo)
2058 {
2059 SceneObjectPreSaveDelegate handler = OnSceneObjectPreSave;
2060 if (handler != null)
2061 {
2062 foreach (SceneObjectPreSaveDelegate d in handler.GetInvocationList())
2063 {
2064 try
2065 {
2066 d(persistingSo, originalSo);
2067 }
2068 catch (Exception e)
2069 {
2070 m_log.ErrorFormat(
2071 "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPreSave failed - continuing. {0} {1}",
2072 e.Message, e.StackTrace);
2073 }
2074 }
2075 }
2043 } 2076 }
2044 } 2077 }
2045} \ No newline at end of file 2078} \ No newline at end of file