Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

user_profiles
Diva Canto 2013-02-25 16:28:12 -08:00
commit a356978c79
8 changed files with 109 additions and 91 deletions

View File

@ -917,7 +917,25 @@ namespace OpenSim.Framework
/// <returns></returns>
public static T GetConfigVarFromSections<T>(IConfigSource config, string varname, string[] sections)
{
object val = default(T);
return GetConfigVarFromSections<T>(config, varname, sections, default(T));
}
/// <summary>
/// Gets the value of a configuration variable by looking into
/// multiple sections in order. The latter sections overwrite
/// any values previously found.
/// </summary>
/// <remarks>
/// If no value is found then the given default value is returned
/// </remarks>
/// <typeparam name="T">Type of the variable</typeparam>
/// <param name="config">The configuration object</param>
/// <param name="varname">The configuration variable</param>
/// <param name="sections">Ordered sequence of sections to look at</param>
/// <param name="val">Default value</param>
/// <returns></returns>
public static T GetConfigVarFromSections<T>(IConfigSource config, string varname, string[] sections, object val)
{
foreach (string section in sections)
{
IConfig cnf = config.Configs[section];
@ -925,11 +943,7 @@ namespace OpenSim.Framework
continue;
if (typeof(T) == typeof(String))
{
if (val == null) // no null strings, please
val = string.Empty;
val = cnf.GetString(varname, (string)val);
}
else if (typeof(T) == typeof(Boolean))
val = cnf.GetBoolean(varname, (bool)val);
else if (typeof(T) == typeof(Int32))
@ -937,8 +951,9 @@ namespace OpenSim.Framework
else if (typeof(T) == typeof(float))
val = cnf.GetFloat(varname, (int)val);
else
m_log.WarnFormat("[UTIL]: Unhandled type {0}", typeof(T));
m_log.ErrorFormat("[UTIL]: Unhandled type {0}", typeof(T));
}
return (T)val;
}

View File

@ -52,8 +52,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid
public override void Initialise(IConfigSource config)
{
IConfig startupConfig = config.Configs["Startup"];
if (startupConfig.GetString("WorldMapModule", "WorldMap") == "HGWorldMap")
if (Util.GetConfigVarFromSections<string>(
config, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap")
m_Enabled = true;
}

View File

@ -80,17 +80,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
bool generateMaptiles = true;
Bitmap mapbmp;
try
{
IConfig startupConfig = m_config.Configs["Startup"];
drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume);
textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain);
generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", generateMaptiles);
}
catch
{
m_log.Warn("[MAPTILE]: Failed to load StartupConfig");
}
string[] configSections = new string[] { "Map", "Startup" };
drawPrimVolume
= Util.GetConfigVarFromSections<bool>(m_config, "DrawPrimOnMapTile", configSections, drawPrimVolume);
textureTerrain
= Util.GetConfigVarFromSections<bool>(m_config, "TextureOnMapTile", configSections, textureTerrain);
generateMaptiles
= Util.GetConfigVarFromSections<bool>(m_config, "GenerateMaptiles", configSections, generateMaptiles);
if (generateMaptiles)
{
@ -148,9 +145,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
{
m_config = source;
IConfig startupConfig = m_config.Configs["Startup"];
if (startupConfig.GetString("MapImageModule", "MapImageModule") !=
"MapImageModule")
if (Util.GetConfigVarFromSections<string>(
m_config, "MapImageModule", new string[] { "Startup", "Map" }, "MapImageModule") != "MapImageModule")
return;
m_Enabled = true;

View File

@ -71,8 +71,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
{
m_config = source;
IConfig startupConfig = m_config.Configs["Startup"];
if (startupConfig.GetString("MapImageModule", "MapImageModule") != "Warp3DImageModule")
if (Util.GetConfigVarFromSections<string>(
m_config, "MapImageModule", new string[] { "Startup", "Map" }, "MapImageModule") != "Warp3DImageModule")
return;
m_Enabled = true;
@ -143,16 +143,12 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
bool drawPrimVolume = true;
bool textureTerrain = true;
try
{
IConfig startupConfig = m_config.Configs["Startup"];
drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume);
textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain);
}
catch
{
m_log.Warn("[WARP 3D IMAGE MODULE]: Failed to load StartupConfig");
}
string[] configSections = new string[] { "Map", "Startup" };
drawPrimVolume
= Util.GetConfigVarFromSections<bool>(m_config, "DrawPrimOnMapTile", configSections, drawPrimVolume);
textureTerrain
= Util.GetConfigVarFromSections<bool>(m_config, "TextureOnMapTile", configSections, textureTerrain);
m_colors.Clear();

View File

@ -86,11 +86,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
#region INonSharedRegionModule Members
public virtual void Initialise (IConfigSource config)
{
IConfig startupConfig = config.Configs["Startup"];
if (startupConfig.GetString("WorldMapModule", "WorldMap") == "WorldMap")
string[] configSections = new string[] { "Map", "Startup" };
if (Util.GetConfigVarFromSections<string>(
config, "WorldMapModule", configSections, "WorldMap") == "WorldMap")
m_Enabled = true;
blacklistTimeout = startupConfig.GetInt("BlacklistTimeout", 10*60) * 1000;
blacklistTimeout
= Util.GetConfigVarFromSections<int>(config, "BlacklistTimeout", configSections, 10 * 60) * 1000;
}
public virtual void AddRegion (Scene scene)

View File

@ -897,7 +897,11 @@ namespace OpenSim.Region.Framework.Scenes
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
string[] possibleMapConfigSections = new string[] { "Map", "Startup" };
m_generateMaptiles
= Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true);
if (m_generateMaptiles)
{
int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
@ -911,7 +915,10 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
string tile
= Util.GetConfigVarFromSections<string>(
config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString());
UUID tileID;
if (tile != UUID.Zero.ToString() && UUID.TryParse(tile, out tileID))

View File

@ -268,32 +268,6 @@
;; Default script engine to use. Currently, we only have XEngine
; DefaultScriptEngine = "XEngine"
;# {GenerateMaptiles} {} {Generate map tiles?} {true false} true
;; Map tile options. You can choose to generate normal maptiles or nominate an uploaded texture to
;; be the map tile using the MaptileStaticUUID parameter in this section or for individual regions in
;; the regions config file(s). If you do not want to upload map tiles at all, then you will need
;; to disable the MapImageServiceModule entirely.
; GenerateMaptiles = true
;# {MaptileRefresh} {GenerateMaptiles} {Maptile refresh period?} {} 0
;; If desired, a running region can update the map tiles periodically
;; to reflect building activity. This names no sense of you don't have
;; prims on maptiles. Value is in seconds.
; MaptileRefresh = 0
;# {MaptileStaticUUID} {} {Asset ID for static map texture} {} 00000000-0000-0000-0000-000000000000
;; If not generating maptiles, use this static texture asset ID
; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
;# {TextureOnMapTile} {} {Use terrain textures for map tiles?} {true false} true
;; Use terrain texture for maptiles if true, use shaded green if false
; TextureOnMapTile = true
;# {DrawPrimOnMapTile} {} {Draw prim shapes on map tiles?} {true false} false
;; Draw objects on maptile. This step might take a long time if you've
;; got a large number of objects, so you can turn it off here if you'd like.
; DrawPrimOnMapTile = true
;# {HttpProxy} {} {Proxy URL for llHTTPRequest and dynamic texture loading} {} http://proxy.com:8080
;; Http proxy setting for llHTTPRequest and dynamic texture loading, if
;; required
@ -362,6 +336,35 @@
;; This is a default that can be overwritten in some sections.
; GatekeeperURI = "http://127.0.0.1:9000"
[Map]
;# {GenerateMaptiles} {} {Generate map tiles?} {true false} true
;; Map tile options. You can choose to generate normal maptiles or nominate an uploaded texture to
;; be the map tile using the MaptileStaticUUID parameter in this section or for individual regions in
;; the regions config file(s). If you do not want to upload map tiles at all, then you will need
;; to disable the MapImageServiceModule entirely.
; GenerateMaptiles = true
;# {MaptileRefresh} {GenerateMaptiles} {Maptile refresh period?} {} 0
;; If desired, a running region can update the map tiles periodically
;; to reflect building activity. This names no sense of you don't have
;; prims on maptiles. Value is in seconds.
; MaptileRefresh = 0
;# {MaptileStaticUUID} {} {Asset ID for static map texture} {} 00000000-0000-0000-0000-000000000000
;; If not generating maptiles, use this static texture asset ID
; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
;# {TextureOnMapTile} {} {Use terrain textures for map tiles?} {true false} true
;; Use terrain texture for maptiles if true, use shaded green if false
; TextureOnMapTile = true
;# {DrawPrimOnMapTile} {} {Draw prim shapes on map tiles?} {true false} false
;; Draw objects on maptile. This step might take a long time if you've
;; got a large number of objects, so you can turn it off here if you'd like.
; DrawPrimOnMapTile = true
[Estates]
; If these values are commented out then the user will be asked for estate details when required (this is the normal case).
; If these values are uncommented then they will be used to create a default estate as necessary.

View File

@ -284,32 +284,6 @@
DefaultScriptEngine = "XEngine"
; ##
; ## WORLD MAP
; ##
;WorldMapModule = "WorldMap"
;MapImageModule = "MapImageModule"
; World map blacklist timeout in seconds
;BlacklistTimeout = 600
; Set to false to not generate any maptiles
;GenerateMaptiles = true
; Refresh (in seconds) the map tile periodically
;MaptileRefresh = 0
; If not generating maptiles, use this static texture asset ID
;MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
; Draw objects on maptile. This step might take a long time if you've got a large number of
; objects, so you can turn it off here if you'd like.
DrawPrimOnMapTile = true
; Use terrain texture for maptiles if true, use shaded green if false
TextureOnMapTile = true
; ##
; ## EMAIL MODULE
; ##
@ -347,6 +321,30 @@
UseTrashOnDelete = True
[Map]
;WorldMapModule = "WorldMap"
;MapImageModule = "MapImageModule"
; World map blacklist timeout in seconds
;BlacklistTimeout = 600
; Set to false to not generate any maptiles
;GenerateMaptiles = true
; Refresh (in seconds) the map tile periodically
;MaptileRefresh = 0
; If not generating maptiles, use this static texture asset ID
;MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
; Draw objects on maptile. This step might take a long time if you've got a large number of
; objects, so you can turn it off here if you'd like.
DrawPrimOnMapTile = true
; Use terrain texture for maptiles if true, use shaded green if false
TextureOnMapTile = true
[RegionReady]
; Enable this module to get notified once all items and scripts in the region have been completely loaded and compiled
enabled = true