diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 39 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 1 |
3 files changed, 46 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 2771492..263ee57 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | |||
@@ -101,6 +101,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
101 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; | 101 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; |
102 | m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps; | 102 | m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps; |
103 | m_scene.EventManager.OnSceneObjectLoaded += OnSceneObjectLoaded; | 103 | m_scene.EventManager.OnSceneObjectLoaded += OnSceneObjectLoaded; |
104 | m_scene.EventManager.OnSceneObjectPreSave += OnSceneObjectPreSave; | ||
104 | } | 105 | } |
105 | 106 | ||
106 | public void Close() | 107 | public void Close() |
@@ -108,6 +109,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
108 | m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; | 109 | m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; |
109 | m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; | 110 | m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; |
110 | m_scene.EventManager.OnSceneObjectLoaded -= OnSceneObjectLoaded; | 111 | m_scene.EventManager.OnSceneObjectLoaded -= OnSceneObjectLoaded; |
112 | m_scene.EventManager.OnSceneObjectPreSave -= OnSceneObjectPreSave; | ||
111 | } | 113 | } |
112 | 114 | ||
113 | public void OnRegisterCaps(UUID agentID, Caps caps) | 115 | public void OnRegisterCaps(UUID agentID, Caps caps) |
@@ -157,11 +159,16 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
157 | } | 159 | } |
158 | } | 160 | } |
159 | 161 | ||
160 | public void OnSceneObjectLoaded(SceneObjectGroup sog) | 162 | public void OnSceneObjectLoaded(SceneObjectGroup so) |
161 | { | 163 | { |
162 | m_log.DebugFormat("[MOAP]: OnSceneObjectLoaded fired for {0} {1}", sog.Name, sog.UUID); | 164 | m_log.DebugFormat("[MOAP]: OnSceneObjectLoaded fired for {0} {1}", so.Name, so.UUID); |
163 | } | 165 | } |
164 | 166 | ||
167 | public void OnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) | ||
168 | { | ||
169 | m_log.DebugFormat("[MOAP]: OnSceneObjectPreSave fired for {0} {1}", persistingSo.Name, persistingSo.UUID); | ||
170 | } | ||
171 | |||
165 | public MediaEntry GetMediaEntry(SceneObjectPart part, int face) | 172 | public MediaEntry GetMediaEntry(SceneObjectPart part, int face) |
166 | { | 173 | { |
167 | MediaEntry me = null; | 174 | MediaEntry me = null; |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 0b1f593..3b8d727 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 |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 17275d0..c2f9117 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1479,6 +1479,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1479 | backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; | 1479 | backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; |
1480 | HasGroupChanged = false; | 1480 | HasGroupChanged = false; |
1481 | 1481 | ||
1482 | m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); | ||
1482 | datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); | 1483 | datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); |
1483 | 1484 | ||
1484 | backup_group.ForEachPart(delegate(SceneObjectPart part) | 1485 | backup_group.ForEachPart(delegate(SceneObjectPart part) |