aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2012-11-11 21:16:29 +0000
committerMelanie2012-11-11 21:16:29 +0000
commit3c48b44b68002c3983404f48b2a51836793b6433 (patch)
tree42546ba5a6cefee37f07a6097635d78cce1053b8 /OpenSim/Region
parentPrevent datasnapshot from crashing the simulator (diff)
parentmoving windlight-sources to correct namespace-named folder (world); add Light... (diff)
downloadopensim-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 'OpenSim/Region')
-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
-rw-r--r--OpenSim/Region/Framework/Interfaces/ILightShareModule.cs33
3 files changed, 111 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
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
31using System.Reflection; 30using System.Reflection;
32using OpenMetaverse; 31using OpenMetaverse;
33using log4net;
34using Nini.Config;
35using OpenSim.Data;
36using OpenSim.Framework; 32using OpenSim.Framework;
37using OpenSim.Region.CoreModules.Framework.InterfaceCommander; 33using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
38using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
40 36using log4net;
37using Nini.Config;
38using Mono.Addins;
41 39
42namespace OpenSim.Region.CoreModules.World.LightShare 40namespace 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)
diff --git a/OpenSim/Region/Framework/Interfaces/ILightShareModule.cs b/OpenSim/Region/Framework/Interfaces/ILightShareModule.cs
new file mode 100644
index 0000000..b5fd24f
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/ILightShareModule.cs
@@ -0,0 +1,33 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Region.Framework.Interfaces
29{
30 public interface ILightShareModule
31 {
32 }
33} \ No newline at end of file