aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Util.cs27
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs24
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs20
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs11
-rw-r--r--bin/OpenSim.ini.example55
-rw-r--r--bin/OpenSimDefaults.ini50
8 files changed, 109 insertions, 91 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 8b8e507..0fa54b2 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -917,7 +917,25 @@ namespace OpenSim.Framework
917 /// <returns></returns> 917 /// <returns></returns>
918 public static T GetConfigVarFromSections<T>(IConfigSource config, string varname, string[] sections) 918 public static T GetConfigVarFromSections<T>(IConfigSource config, string varname, string[] sections)
919 { 919 {
920 object val = default(T); 920 return GetConfigVarFromSections<T>(config, varname, sections, default(T));
921 }
922
923 /// <summary>
924 /// Gets the value of a configuration variable by looking into
925 /// multiple sections in order. The latter sections overwrite
926 /// any values previously found.
927 /// </summary>
928 /// <remarks>
929 /// If no value is found then the given default value is returned
930 /// </remarks>
931 /// <typeparam name="T">Type of the variable</typeparam>
932 /// <param name="config">The configuration object</param>
933 /// <param name="varname">The configuration variable</param>
934 /// <param name="sections">Ordered sequence of sections to look at</param>
935 /// <param name="val">Default value</param>
936 /// <returns></returns>
937 public static T GetConfigVarFromSections<T>(IConfigSource config, string varname, string[] sections, object val)
938 {
921 foreach (string section in sections) 939 foreach (string section in sections)
922 { 940 {
923 IConfig cnf = config.Configs[section]; 941 IConfig cnf = config.Configs[section];
@@ -925,11 +943,7 @@ namespace OpenSim.Framework
925 continue; 943 continue;
926 944
927 if (typeof(T) == typeof(String)) 945 if (typeof(T) == typeof(String))
928 {
929 if (val == null) // no null strings, please
930 val = string.Empty;
931 val = cnf.GetString(varname, (string)val); 946 val = cnf.GetString(varname, (string)val);
932 }
933 else if (typeof(T) == typeof(Boolean)) 947 else if (typeof(T) == typeof(Boolean))
934 val = cnf.GetBoolean(varname, (bool)val); 948 val = cnf.GetBoolean(varname, (bool)val);
935 else if (typeof(T) == typeof(Int32)) 949 else if (typeof(T) == typeof(Int32))
@@ -937,8 +951,9 @@ namespace OpenSim.Framework
937 else if (typeof(T) == typeof(float)) 951 else if (typeof(T) == typeof(float))
938 val = cnf.GetFloat(varname, (int)val); 952 val = cnf.GetFloat(varname, (int)val);
939 else 953 else
940 m_log.WarnFormat("[UTIL]: Unhandled type {0}", typeof(T)); 954 m_log.ErrorFormat("[UTIL]: Unhandled type {0}", typeof(T));
941 } 955 }
956
942 return (T)val; 957 return (T)val;
943 } 958 }
944 959
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
index e0921ad..c4255b9 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
@@ -52,8 +52,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid
52 52
53 public override void Initialise(IConfigSource config) 53 public override void Initialise(IConfigSource config)
54 { 54 {
55 IConfig startupConfig = config.Configs["Startup"]; 55 if (Util.GetConfigVarFromSections<string>(
56 if (startupConfig.GetString("WorldMapModule", "WorldMap") == "HGWorldMap") 56 config, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap")
57 m_Enabled = true; 57 m_Enabled = true;
58 } 58 }
59 59
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index e7065dc..40638f8 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
@@ -80,17 +80,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
80 bool generateMaptiles = true; 80 bool generateMaptiles = true;
81 Bitmap mapbmp; 81 Bitmap mapbmp;
82 82
83 try 83 string[] configSections = new string[] { "Map", "Startup" };
84 { 84
85 IConfig startupConfig = m_config.Configs["Startup"]; 85 drawPrimVolume
86 drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume); 86 = Util.GetConfigVarFromSections<bool>(m_config, "DrawPrimOnMapTile", configSections, drawPrimVolume);
87 textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain); 87 textureTerrain
88 generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", generateMaptiles); 88 = Util.GetConfigVarFromSections<bool>(m_config, "TextureOnMapTile", configSections, textureTerrain);
89 } 89 generateMaptiles
90 catch 90 = Util.GetConfigVarFromSections<bool>(m_config, "GenerateMaptiles", configSections, generateMaptiles);
91 {
92 m_log.Warn("[MAPTILE]: Failed to load StartupConfig");
93 }
94 91
95 if (generateMaptiles) 92 if (generateMaptiles)
96 { 93 {
@@ -148,9 +145,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
148 { 145 {
149 m_config = source; 146 m_config = source;
150 147
151 IConfig startupConfig = m_config.Configs["Startup"]; 148 if (Util.GetConfigVarFromSections<string>(
152 if (startupConfig.GetString("MapImageModule", "MapImageModule") != 149 m_config, "MapImageModule", new string[] { "Startup", "Map" }, "MapImageModule") != "MapImageModule")
153 "MapImageModule")
154 return; 150 return;
155 151
156 m_Enabled = true; 152 m_Enabled = true;
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
index 5e0dfa7..ed2b06a 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
@@ -71,8 +71,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
71 { 71 {
72 m_config = source; 72 m_config = source;
73 73
74 IConfig startupConfig = m_config.Configs["Startup"]; 74 if (Util.GetConfigVarFromSections<string>(
75 if (startupConfig.GetString("MapImageModule", "MapImageModule") != "Warp3DImageModule") 75 m_config, "MapImageModule", new string[] { "Startup", "Map" }, "MapImageModule") != "Warp3DImageModule")
76 return; 76 return;
77 77
78 m_Enabled = true; 78 m_Enabled = true;
@@ -143,16 +143,12 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
143 bool drawPrimVolume = true; 143 bool drawPrimVolume = true;
144 bool textureTerrain = true; 144 bool textureTerrain = true;
145 145
146 try 146 string[] configSections = new string[] { "Map", "Startup" };
147 { 147
148 IConfig startupConfig = m_config.Configs["Startup"]; 148 drawPrimVolume
149 drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume); 149 = Util.GetConfigVarFromSections<bool>(m_config, "DrawPrimOnMapTile", configSections, drawPrimVolume);
150 textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain); 150 textureTerrain
151 } 151 = Util.GetConfigVarFromSections<bool>(m_config, "TextureOnMapTile", configSections, textureTerrain);
152 catch
153 {
154 m_log.Warn("[WARP 3D IMAGE MODULE]: Failed to load StartupConfig");
155 }
156 152
157 m_colors.Clear(); 153 m_colors.Clear();
158 154
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index e2f525c..912d50a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -86,11 +86,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
86 #region INonSharedRegionModule Members 86 #region INonSharedRegionModule Members
87 public virtual void Initialise (IConfigSource config) 87 public virtual void Initialise (IConfigSource config)
88 { 88 {
89 IConfig startupConfig = config.Configs["Startup"]; 89 string[] configSections = new string[] { "Map", "Startup" };
90 if (startupConfig.GetString("WorldMapModule", "WorldMap") == "WorldMap") 90
91 if (Util.GetConfigVarFromSections<string>(
92 config, "WorldMapModule", configSections, "WorldMap") == "WorldMap")
91 m_Enabled = true; 93 m_Enabled = true;
92 94
93 blacklistTimeout = startupConfig.GetInt("BlacklistTimeout", 10*60) * 1000; 95 blacklistTimeout
96 = Util.GetConfigVarFromSections<int>(config, "BlacklistTimeout", configSections, 10 * 60) * 1000;
94 } 97 }
95 98
96 public virtual void AddRegion (Scene scene) 99 public virtual void AddRegion (Scene scene)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 9b17b7f..5b61538 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -897,7 +897,11 @@ namespace OpenSim.Region.Framework.Scenes
897 897
898 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); 898 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
899 899
900 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); 900 string[] possibleMapConfigSections = new string[] { "Map", "Startup" };
901
902 m_generateMaptiles
903 = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true);
904
901 if (m_generateMaptiles) 905 if (m_generateMaptiles)
902 { 906 {
903 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); 907 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
@@ -911,7 +915,10 @@ namespace OpenSim.Region.Framework.Scenes
911 } 915 }
912 else 916 else
913 { 917 {
914 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); 918 string tile
919 = Util.GetConfigVarFromSections<string>(
920 config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString());
921
915 UUID tileID; 922 UUID tileID;
916 923
917 if (tile != UUID.Zero.ToString() && UUID.TryParse(tile, out tileID)) 924 if (tile != UUID.Zero.ToString() && UUID.TryParse(tile, out tileID))
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 5aeae8a..2756b32 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -268,32 +268,6 @@
268 ;; Default script engine to use. Currently, we only have XEngine 268 ;; Default script engine to use. Currently, we only have XEngine
269 ; DefaultScriptEngine = "XEngine" 269 ; DefaultScriptEngine = "XEngine"
270 270
271 ;# {GenerateMaptiles} {} {Generate map tiles?} {true false} true
272 ;; Map tile options. You can choose to generate normal maptiles or nominate an uploaded texture to
273 ;; be the map tile using the MaptileStaticUUID parameter in this section or for individual regions in
274 ;; the regions config file(s). If you do not want to upload map tiles at all, then you will need
275 ;; to disable the MapImageServiceModule entirely.
276 ; GenerateMaptiles = true
277
278 ;# {MaptileRefresh} {GenerateMaptiles} {Maptile refresh period?} {} 0
279 ;; If desired, a running region can update the map tiles periodically
280 ;; to reflect building activity. This names no sense of you don't have
281 ;; prims on maptiles. Value is in seconds.
282 ; MaptileRefresh = 0
283
284 ;# {MaptileStaticUUID} {} {Asset ID for static map texture} {} 00000000-0000-0000-0000-000000000000
285 ;; If not generating maptiles, use this static texture asset ID
286 ; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
287
288 ;# {TextureOnMapTile} {} {Use terrain textures for map tiles?} {true false} true
289 ;; Use terrain texture for maptiles if true, use shaded green if false
290 ; TextureOnMapTile = true
291
292 ;# {DrawPrimOnMapTile} {} {Draw prim shapes on map tiles?} {true false} false
293 ;; Draw objects on maptile. This step might take a long time if you've
294 ;; got a large number of objects, so you can turn it off here if you'd like.
295 ; DrawPrimOnMapTile = true
296
297 ;# {HttpProxy} {} {Proxy URL for llHTTPRequest and dynamic texture loading} {} http://proxy.com:8080 271 ;# {HttpProxy} {} {Proxy URL for llHTTPRequest and dynamic texture loading} {} http://proxy.com:8080
298 ;; Http proxy setting for llHTTPRequest and dynamic texture loading, if 272 ;; Http proxy setting for llHTTPRequest and dynamic texture loading, if
299 ;; required 273 ;; required
@@ -362,6 +336,35 @@
362 ;; This is a default that can be overwritten in some sections. 336 ;; This is a default that can be overwritten in some sections.
363 ; GatekeeperURI = "http://127.0.0.1:9000" 337 ; GatekeeperURI = "http://127.0.0.1:9000"
364 338
339
340[Map]
341 ;# {GenerateMaptiles} {} {Generate map tiles?} {true false} true
342 ;; Map tile options. You can choose to generate normal maptiles or nominate an uploaded texture to
343 ;; be the map tile using the MaptileStaticUUID parameter in this section or for individual regions in
344 ;; the regions config file(s). If you do not want to upload map tiles at all, then you will need
345 ;; to disable the MapImageServiceModule entirely.
346 ; GenerateMaptiles = true
347
348 ;# {MaptileRefresh} {GenerateMaptiles} {Maptile refresh period?} {} 0
349 ;; If desired, a running region can update the map tiles periodically
350 ;; to reflect building activity. This names no sense of you don't have
351 ;; prims on maptiles. Value is in seconds.
352 ; MaptileRefresh = 0
353
354 ;# {MaptileStaticUUID} {} {Asset ID for static map texture} {} 00000000-0000-0000-0000-000000000000
355 ;; If not generating maptiles, use this static texture asset ID
356 ; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
357
358 ;# {TextureOnMapTile} {} {Use terrain textures for map tiles?} {true false} true
359 ;; Use terrain texture for maptiles if true, use shaded green if false
360 ; TextureOnMapTile = true
361
362 ;# {DrawPrimOnMapTile} {} {Draw prim shapes on map tiles?} {true false} false
363 ;; Draw objects on maptile. This step might take a long time if you've
364 ;; got a large number of objects, so you can turn it off here if you'd like.
365 ; DrawPrimOnMapTile = true
366
367
365[Estates] 368[Estates]
366 ; If these values are commented out then the user will be asked for estate details when required (this is the normal case). 369 ; If these values are commented out then the user will be asked for estate details when required (this is the normal case).
367 ; If these values are uncommented then they will be used to create a default estate as necessary. 370 ; If these values are uncommented then they will be used to create a default estate as necessary.
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 2512428..6ecb5df 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -285,32 +285,6 @@
285 DefaultScriptEngine = "XEngine" 285 DefaultScriptEngine = "XEngine"
286 286
287 ; ## 287 ; ##
288 ; ## WORLD MAP
289 ; ##
290
291 ;WorldMapModule = "WorldMap"
292 ;MapImageModule = "MapImageModule"
293
294 ; World map blacklist timeout in seconds
295 ;BlacklistTimeout = 600
296
297 ; Set to false to not generate any maptiles
298 ;GenerateMaptiles = true
299
300 ; Refresh (in seconds) the map tile periodically
301 ;MaptileRefresh = 0
302
303 ; If not generating maptiles, use this static texture asset ID
304 ;MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
305
306 ; Draw objects on maptile. This step might take a long time if you've got a large number of
307 ; objects, so you can turn it off here if you'd like.
308 DrawPrimOnMapTile = true
309
310 ; Use terrain texture for maptiles if true, use shaded green if false
311 TextureOnMapTile = true
312
313 ; ##
314 ; ## EMAIL MODULE 288 ; ## EMAIL MODULE
315 ; ## 289 ; ##
316 290
@@ -347,6 +321,30 @@
347 UseTrashOnDelete = True 321 UseTrashOnDelete = True
348 322
349 323
324[Map]
325 ;WorldMapModule = "WorldMap"
326 ;MapImageModule = "MapImageModule"
327
328 ; World map blacklist timeout in seconds
329 ;BlacklistTimeout = 600
330
331 ; Set to false to not generate any maptiles
332 ;GenerateMaptiles = true
333
334 ; Refresh (in seconds) the map tile periodically
335 ;MaptileRefresh = 0
336
337 ; If not generating maptiles, use this static texture asset ID
338 ;MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
339
340 ; Draw objects on maptile. This step might take a long time if you've got a large number of
341 ; objects, so you can turn it off here if you'd like.
342 DrawPrimOnMapTile = true
343
344 ; Use terrain texture for maptiles if true, use shaded green if false
345 TextureOnMapTile = true
346
347
350[RegionReady] 348[RegionReady]
351 ; Enable this module to get notified once all items and scripts in the region have been completely loaded and compiled 349 ; Enable this module to get notified once all items and scripts in the region have been completely loaded and compiled
352 enabled = true 350 enabled = true