diff options
author | Justin Clark-Casey (justincc) | 2010-07-26 20:13:26 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-07-26 23:34:22 +0100 |
commit | 586ae0f6a07358f8367c4f916bff9fd688a43aa3 (patch) | |
tree | f6784a92603ed9e31a235316d32fac9e88c7b075 | |
parent | Put a wrapper around the media texture region serialization (diff) | |
download | opensim-SC-586ae0f6a07358f8367c4f916bff9fd688a43aa3.zip opensim-SC-586ae0f6a07358f8367c4f916bff9fd688a43aa3.tar.gz opensim-SC-586ae0f6a07358f8367c4f916bff9fd688a43aa3.tar.bz2 opensim-SC-586ae0f6a07358f8367c4f916bff9fd688a43aa3.tar.xz |
Add EventManager.OnSceneObjectLoaded() for future use. This is fired immediately after a scene object is loaded from storage.
-rw-r--r-- | OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | 19 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 32 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 4 |
3 files changed, 46 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 0130ff9..2771492 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | |||
@@ -98,17 +98,19 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
98 | 98 | ||
99 | public void RegionLoaded(Scene scene) | 99 | public void RegionLoaded(Scene scene) |
100 | { | 100 | { |
101 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | 101 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; |
102 | m_scene.EventManager.OnDeregisterCaps += DeregisterCaps; | 102 | m_scene.EventManager.OnDeregisterCaps += OnDeregisterCaps; |
103 | m_scene.EventManager.OnSceneObjectLoaded += OnSceneObjectLoaded; | ||
103 | } | 104 | } |
104 | 105 | ||
105 | public void Close() | 106 | public void Close() |
106 | { | 107 | { |
107 | m_scene.EventManager.OnRegisterCaps -= RegisterCaps; | 108 | m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; |
108 | m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps; | 109 | m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; |
110 | m_scene.EventManager.OnSceneObjectLoaded -= OnSceneObjectLoaded; | ||
109 | } | 111 | } |
110 | 112 | ||
111 | public void RegisterCaps(UUID agentID, Caps caps) | 113 | public void OnRegisterCaps(UUID agentID, Caps caps) |
112 | { | 114 | { |
113 | m_log.DebugFormat( | 115 | m_log.DebugFormat( |
114 | "[MOAP]: Registering ObjectMedia and ObjectMediaNavigate capabilities for agent {0}", agentID); | 116 | "[MOAP]: Registering ObjectMedia and ObjectMediaNavigate capabilities for agent {0}", agentID); |
@@ -138,7 +140,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
138 | } | 140 | } |
139 | } | 141 | } |
140 | 142 | ||
141 | public void DeregisterCaps(UUID agentID, Caps caps) | 143 | public void OnDeregisterCaps(UUID agentID, Caps caps) |
142 | { | 144 | { |
143 | lock (m_omCapUsers) | 145 | lock (m_omCapUsers) |
144 | { | 146 | { |
@@ -155,6 +157,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
155 | } | 157 | } |
156 | } | 158 | } |
157 | 159 | ||
160 | public void OnSceneObjectLoaded(SceneObjectGroup sog) | ||
161 | { | ||
162 | m_log.DebugFormat("[MOAP]: OnSceneObjectLoaded fired for {0} {1}", sog.Name, sog.UUID); | ||
163 | } | ||
164 | |||
158 | public MediaEntry GetMediaEntry(SceneObjectPart part, int face) | 165 | public MediaEntry GetMediaEntry(SceneObjectPart part, int face) |
159 | { | 166 | { |
160 | MediaEntry me = null; | 167 | MediaEntry me = null; |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 9db2e41..0b1f593 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -331,9 +331,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
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 | |||
337 | /// <summary> | ||
338 | /// Called immediately after an object is loaded from storage. | ||
339 | /// </summary> | ||
340 | public event SceneObjectDelegate OnSceneObjectLoaded; | ||
334 | 341 | ||
335 | public delegate void RegionUp(GridRegion region); | 342 | public delegate void RegionUp(GridRegion region); |
336 | public event RegionUp OnRegionUp; | 343 | public event RegionUp OnRegionUp; |
337 | 344 | ||
338 | public class MoneyTransferArgs : EventArgs | 345 | public class MoneyTransferArgs : EventArgs |
339 | { | 346 | { |
@@ -2013,5 +2020,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
2013 | } | 2020 | } |
2014 | } | 2021 | } |
2015 | } | 2022 | } |
2023 | |||
2024 | public void TriggerOnSceneObjectLoaded(SceneObjectGroup so) | ||
2025 | { | ||
2026 | SceneObjectDelegate handler = OnSceneObjectLoaded; | ||
2027 | if (handler != null) | ||
2028 | { | ||
2029 | foreach (SceneObjectDelegate d in handler.GetInvocationList()) | ||
2030 | { | ||
2031 | try | ||
2032 | { | ||
2033 | d(so); | ||
2034 | } | ||
2035 | catch (Exception e) | ||
2036 | { | ||
2037 | m_log.ErrorFormat( | ||
2038 | "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectLoaded failed - continuing. {0} {1}", | ||
2039 | e.Message, e.StackTrace); | ||
2040 | } | ||
2041 | } | ||
2042 | } | ||
2043 | } | ||
2016 | } | 2044 | } |
2017 | } | 2045 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9141d44..e8dce08 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1887,9 +1887,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1887 | 1887 | ||
1888 | foreach (SceneObjectGroup group in PrimsFromDB) | 1888 | foreach (SceneObjectGroup group in PrimsFromDB) |
1889 | { | 1889 | { |
1890 | EventManager.TriggerOnSceneObjectLoaded(group); | ||
1891 | |||
1890 | if (group.RootPart == null) | 1892 | if (group.RootPart == null) |
1891 | { | 1893 | { |
1892 | m_log.ErrorFormat("[SCENE] Found a SceneObjectGroup with m_rootPart == null and {0} children", | 1894 | m_log.ErrorFormat("[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children", |
1893 | group.Children == null ? 0 : group.Children.Count); | 1895 | group.Children == null ? 0 : group.Children.Count); |
1894 | } | 1896 | } |
1895 | 1897 | ||