diff options
author | Melanie | 2012-11-11 21:16:29 +0000 |
---|---|---|
committer | Melanie | 2012-11-11 21:16:29 +0000 |
commit | 3c48b44b68002c3983404f48b2a51836793b6433 (patch) | |
tree | 42546ba5a6cefee37f07a6097635d78cce1053b8 /OpenSim/Region/CoreModules | |
parent | Prevent datasnapshot from crashing the simulator (diff) | |
parent | moving windlight-sources to correct namespace-named folder (world); add Light... (diff) | |
download | opensim-SC_OLD-3c48b44b68002c3983404f48b2a51836793b6433.zip opensim-SC_OLD-3c48b44b68002c3983404f48b2a51836793b6433.tar.gz opensim-SC_OLD-3c48b44b68002c3983404f48b2a51836793b6433.tar.bz2 opensim-SC_OLD-3c48b44b68002c3983404f48b2a51836793b6433.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs (renamed from OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs) | 20 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs (renamed from OpenSim/Region/CoreModules/LightShare/LightShareModule.cs) | 122 |
2 files changed, 78 insertions, 64 deletions
diff --git a/OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs index 1526886..c3cea7a 100644 --- a/OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs +++ b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs | |||
@@ -51,10 +51,10 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
51 | private Scene m_scene = null; | 51 | private Scene m_scene = null; |
52 | private UUID regionID = UUID.Zero; | 52 | private UUID regionID = UUID.Zero; |
53 | private static bool Enabled = false; | 53 | private static bool Enabled = false; |
54 | 54 | ||
55 | private static readonly string capsName = "EnvironmentSettings"; | 55 | private static readonly string capsName = "EnvironmentSettings"; |
56 | private static readonly string capsBase = "/CAPS/0020/"; | 56 | private static readonly string capsBase = "/CAPS/0020/"; |
57 | 57 | ||
58 | private LLSDEnvironmentSetResponse setResponse = null; | 58 | private LLSDEnvironmentSetResponse setResponse = null; |
59 | 59 | ||
60 | #region INonSharedRegionModule | 60 | #region INonSharedRegionModule |
@@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
72 | } | 72 | } |
73 | 73 | ||
74 | Enabled = true; | 74 | Enabled = true; |
75 | 75 | ||
76 | m_log.InfoFormat("[{0}]: Module is enabled.", Name); | 76 | m_log.InfoFormat("[{0}]: Module is enabled.", Name); |
77 | } | 77 | } |
78 | 78 | ||
@@ -132,8 +132,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
132 | #region Events | 132 | #region Events |
133 | private void OnRegisterCaps(UUID agentID, Caps caps) | 133 | private void OnRegisterCaps(UUID agentID, Caps caps) |
134 | { | 134 | { |
135 | // m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}", | 135 | // m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}", |
136 | // Name, agentID, caps.RegionName); | 136 | // Name, agentID, caps.RegionName); |
137 | 137 | ||
138 | string capsPath = capsBase + UUID.Random(); | 138 | string capsPath = capsBase + UUID.Random(); |
139 | 139 | ||
@@ -163,8 +163,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
163 | private string GetEnvironmentSettings(string request, string path, string param, | 163 | private string GetEnvironmentSettings(string request, string path, string param, |
164 | UUID agentID, Caps caps) | 164 | UUID agentID, Caps caps) |
165 | { | 165 | { |
166 | // m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}", | 166 | // m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}", |
167 | // Name, agentID, caps.RegionName); | 167 | // Name, agentID, caps.RegionName); |
168 | 168 | ||
169 | string env = String.Empty; | 169 | string env = String.Empty; |
170 | 170 | ||
@@ -188,8 +188,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
188 | UUID agentID, Caps caps) | 188 | UUID agentID, Caps caps) |
189 | { | 189 | { |
190 | 190 | ||
191 | // m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}", | 191 | // m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}", |
192 | // Name, agentID, caps.RegionName); | 192 | // Name, agentID, caps.RegionName); |
193 | 193 | ||
194 | setResponse.regionID = regionID; | 194 | setResponse.regionID = regionID; |
195 | setResponse.success = false; | 195 | setResponse.success = false; |
@@ -204,7 +204,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
204 | { | 204 | { |
205 | m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, request); | 205 | m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, request); |
206 | setResponse.success = true; | 206 | setResponse.success = true; |
207 | 207 | ||
208 | m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}", | 208 | m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}", |
209 | Name, agentID, caps.RegionName); | 209 | Name, agentID, caps.RegionName); |
210 | } | 210 | } |
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs index 16cbbf5..bd04ded 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs | |||
@@ -27,21 +27,20 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | ||
31 | using System.Reflection; | 30 | using System.Reflection; |
32 | using OpenMetaverse; | 31 | using OpenMetaverse; |
33 | using log4net; | ||
34 | using Nini.Config; | ||
35 | using OpenSim.Data; | ||
36 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
37 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | 33 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; |
38 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
40 | 36 | using log4net; | |
37 | using Nini.Config; | ||
38 | using Mono.Addins; | ||
41 | 39 | ||
42 | namespace OpenSim.Region.CoreModules.World.LightShare | 40 | namespace OpenSim.Region.CoreModules.World.LightShare |
43 | { | 41 | { |
44 | public class LightShareModule : IRegionModule, ICommandableModule | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
43 | public class LightShareModule : INonSharedRegionModule, ILightShareModule, ICommandableModule | ||
45 | { | 44 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | private readonly Commander m_commander = new Commander("windlight"); | 46 | private readonly Commander m_commander = new Commander("windlight"); |
@@ -57,48 +56,86 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
57 | 56 | ||
58 | #endregion | 57 | #endregion |
59 | 58 | ||
60 | #region IRegionModule Members | 59 | #region INonSharedRegionModule Members |
61 | 60 | ||
62 | public static bool EnableWindlight | 61 | public void Initialise(IConfigSource config) |
63 | { | 62 | { |
64 | get | 63 | try |
65 | { | 64 | { |
66 | return m_enableWindlight; | 65 | m_enableWindlight = config.Configs["LightShare"].GetBoolean("enable_windlight", false); |
67 | } | 66 | } |
68 | set | 67 | catch (Exception) |
69 | { | 68 | { |
69 | m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default"); | ||
70 | } | 70 | } |
71 | |||
72 | m_log.DebugFormat("[WINDLIGHT]: windlight module {0}", (m_enableWindlight ? "enabled" : "disabled")); | ||
71 | } | 73 | } |
72 | 74 | ||
73 | public void Initialise(Scene scene, IConfigSource config) | 75 | public void AddRegion(Scene scene) |
74 | { | 76 | { |
77 | if (!m_enableWindlight) | ||
78 | return; | ||
79 | |||
75 | m_scene = scene; | 80 | m_scene = scene; |
76 | m_scene.RegisterModuleInterface<IRegionModule>(this); | 81 | m_scene.RegisterModuleInterface<ILightShareModule>(this); |
77 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | 82 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; |
78 | 83 | ||
79 | // ini file settings | 84 | m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; |
80 | try | 85 | m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; |
81 | { | 86 | m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted; |
82 | m_enableWindlight = config.Configs["LightShare"].GetBoolean("enable_windlight", false); | 87 | m_scene.LoadWindlightProfile(); |
83 | } | 88 | |
84 | catch (Exception) | 89 | InstallCommands(); |
90 | } | ||
91 | |||
92 | public void RemoveRegion(Scene scene) | ||
93 | { | ||
94 | if (!m_enableWindlight) | ||
95 | return; | ||
96 | |||
97 | m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; | ||
98 | |||
99 | m_scene.EventManager.OnMakeRootAgent -= EventManager_OnMakeRootAgent; | ||
100 | m_scene.EventManager.OnSaveNewWindlightProfile -= EventManager_OnSaveNewWindlightProfile; | ||
101 | m_scene.EventManager.OnSendNewWindlightProfileTargeted -= EventManager_OnSendNewWindlightProfileTargeted; | ||
102 | |||
103 | m_scene = null; | ||
104 | } | ||
105 | |||
106 | public void Close() | ||
107 | { | ||
108 | } | ||
109 | |||
110 | public string Name | ||
111 | { | ||
112 | get { return "LightShareModule"; } | ||
113 | } | ||
114 | |||
115 | public void RegionLoaded(Scene scene) | ||
116 | { | ||
117 | } | ||
118 | |||
119 | public Type ReplaceableInterface | ||
120 | { | ||
121 | get { return null; } | ||
122 | } | ||
123 | |||
124 | #endregion | ||
125 | |||
126 | public static bool EnableWindlight | ||
127 | { | ||
128 | get | ||
85 | { | 129 | { |
86 | m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default"); | 130 | return m_enableWindlight; |
87 | } | 131 | } |
88 | 132 | set | |
89 | if (m_enableWindlight) | ||
90 | { | 133 | { |
91 | m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; | ||
92 | m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; | ||
93 | m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted; | ||
94 | m_scene.LoadWindlightProfile(); | ||
95 | } | 134 | } |
96 | |||
97 | InstallCommands(); | ||
98 | |||
99 | m_log.Debug("[WINDLIGHT]: Initialised windlight module"); | ||
100 | } | 135 | } |
101 | 136 | ||
137 | #region events | ||
138 | |||
102 | private List<byte[]> compileWindlightSettings(RegionLightShareData wl) | 139 | private List<byte[]> compileWindlightSettings(RegionLightShareData wl) |
103 | { | 140 | { |
104 | byte[] mBlock = new Byte[249]; | 141 | byte[] mBlock = new Byte[249]; |
@@ -186,29 +223,6 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
186 | m_scene.ForEachRootClient(SendProfileToClient); | 223 | m_scene.ForEachRootClient(SendProfileToClient); |
187 | } | 224 | } |
188 | 225 | ||
189 | public void PostInitialise() | ||
190 | { | ||
191 | |||
192 | } | ||
193 | |||
194 | public void Close() | ||
195 | { | ||
196 | } | ||
197 | |||
198 | public string Name | ||
199 | { | ||
200 | get { return "LightShareModule"; } | ||
201 | } | ||
202 | |||
203 | public bool IsSharedModule | ||
204 | { | ||
205 | get { return false; } | ||
206 | } | ||
207 | |||
208 | #endregion | ||
209 | |||
210 | #region events | ||
211 | |||
212 | #endregion | 226 | #endregion |
213 | 227 | ||
214 | #region ICommandableModule Members | 228 | #region ICommandableModule Members |
@@ -243,7 +257,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
243 | private void HandleDisable(Object[] args) | 257 | private void HandleDisable(Object[] args) |
244 | { | 258 | { |
245 | m_log.InfoFormat("[WINDLIGHT]: Plugin now disabled"); | 259 | m_log.InfoFormat("[WINDLIGHT]: Plugin now disabled"); |
246 | m_enableWindlight=false; | 260 | m_enableWindlight = false; |
247 | } | 261 | } |
248 | 262 | ||
249 | private void HandleEnable(Object[] args) | 263 | private void HandleEnable(Object[] args) |