Add some maptile options, change maptile generation from OpenSimBase to Scene

to make it more configurable.
avinationmerge
Melanie Thielker 2010-08-20 08:46:46 +02:00
parent 1ab631f015
commit 47838e5fb3
3 changed files with 59 additions and 21 deletions

View File

@ -390,19 +390,6 @@ namespace OpenSim
// Prims have to be loaded after module configuration since some modules may be invoked during the load // Prims have to be loaded after module configuration since some modules may be invoked during the load
scene.LoadPrimsFromStorage(regionInfo.originRegionID); scene.LoadPrimsFromStorage(regionInfo.originRegionID);
if (scene.SnmpService != null)
{
scene.SnmpService.BootInfo("Creating region texture", scene);
}
// moved these here as the map texture has to be created after the modules are initialized
// and has to happen before the region is registered with the grid.
IWorldMapModule mapModule = scene.RequestModuleInterface<IWorldMapModule>();
if (mapModule != null)
mapModule.GenerateMaptile();
else
m_log.WarnFormat("[STARTUP]: No map module available to generate map tile");
// TODO : Try setting resource for region xstats here on scene // TODO : Try setting resource for region xstats here on scene
MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo));

View File

@ -411,6 +411,9 @@ namespace OpenSim.Region.Framework.Scenes
private double m_rootReprioritizationDistance = 10.0; private double m_rootReprioritizationDistance = 10.0;
private double m_childReprioritizationDistance = 20.0; private double m_childReprioritizationDistance = 20.0;
private Timer m_mapGenerationTimer = new Timer();
bool m_generateMaptiles = false;
#endregion #endregion
#region Properties #region Properties
@ -665,6 +668,29 @@ namespace OpenSim.Region.Framework.Scenes
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
if (m_generateMaptiles)
{
int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
if (maptileRefresh != 0)
{
m_mapGenerationTimer.Interval = maptileRefresh * 1000;
m_mapGenerationTimer.Elapsed += RegenerateMaptile;
m_mapGenerationTimer.AutoReset = true;
m_mapGenerationTimer.Start();
}
}
else
{
string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
UUID tileID;
if (UUID.TryParse(tile, out tileID))
{
RegionInfo.RegionSettings.TerrainImageID = tileID;
}
}
} }
catch catch
{ {
@ -1694,16 +1720,21 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.SetScene(this); m_sceneGridService.SetScene(this);
// These two 'commands' *must be* next to each other or sim rebooting fails. // If we generate maptiles internally at all, the maptile generator
//m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); // will register the region. If not, do it here
if (m_generateMaptiles)
{
RegenerateMaptile(null, null);
}
else
{
GridRegion region = new GridRegion(RegionInfo); GridRegion region = new GridRegion(RegionInfo);
string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
if (error != String.Empty) if (error != String.Empty)
{ {
throw new Exception(error); throw new Exception(error);
} }
}
} }
#endregion #endregion
@ -4995,5 +5026,19 @@ namespace OpenSim.Region.Framework.Scenes
return offsets.ToArray(); return offsets.ToArray();
} }
public void RegenerateMaptile(object sender, ElapsedEventArgs e)
{
IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>();
if (mapModule != null)
{
mapModule.GenerateMaptile();
string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo));
if (error != String.Empty)
throw new Exception(error);
}
}
} }
} }

View File

@ -225,6 +225,12 @@
;WorldMapModule = "WorldMap" ;WorldMapModule = "WorldMap"
;MapImageModule = "MapImageModule" ;MapImageModule = "MapImageModule"
; Set to false to not generate any maptiles
;GenerateMaptiles = "true"
; Refreah (in seconds) the map tile periodically
;MaptileRefresh = 0
; If not generating maptiles, use this static texture asset ID
;MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
; ## ; ##
; ## EMAIL MODULE ; ## EMAIL MODULE