Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/Framework/Scenes/Scene.cs
avinationmerge
Melanie 2013-01-31 20:16:45 +00:00
commit e497cf6f04
5 changed files with 213 additions and 140 deletions

View File

@ -145,6 +145,7 @@ namespace OpenSim.Framework
public UUID RegionID = UUID.Zero;
public string RemotingAddress;
public UUID ScopeID = UUID.Zero;
private UUID m_maptileStaticUUID = UUID.Zero;
private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>();
@ -340,6 +341,11 @@ namespace OpenSim.Framework
get { return m_regionType; }
}
public UUID MaptileStaticUUID
{
get { return m_maptileStaticUUID; }
}
/// <summary>
/// The port by which http communication occurs with the region (most noticeably, CAPS communication)
/// </summary>
@ -643,7 +649,7 @@ namespace OpenSim.Framework
m_regionType = config.GetString("RegionType", String.Empty);
allKeys.Remove("RegionType");
#region Prim stuff
#region Prim and map stuff
m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0);
allKeys.Remove("NonPhysicalPrimMin");
@ -666,6 +672,13 @@ namespace OpenSim.Framework
m_linksetCapacity = config.GetInt("LinksetPrims", 0);
allKeys.Remove("LinksetPrims");
allKeys.Remove("MaptileStaticUUID");
string mapTileStaticUUID = config.GetString("MaptileStaticUUID", UUID.Zero.ToString());
if (UUID.TryParse(mapTileStaticUUID.Trim(), out m_maptileStaticUUID))
{
config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
}
#endregion
m_agentCapacity = config.GetInt("MaxAgents", 100);
@ -734,6 +747,9 @@ namespace OpenSim.Framework
if (RegionType != String.Empty)
config.Set("RegionType", RegionType);
if (m_maptileStaticUUID != UUID.Zero)
config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
}
public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result)
@ -832,6 +848,9 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Free form string describing the type of region", String.Empty, true);
configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
"UUID of a texture to use as the map for this region", m_maptileStaticUUID.ToString(), true);
}
public void loadConfigurationOptions()
@ -885,6 +904,9 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Region Type", String.Empty, true);
configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
"UUID of a texture to use as the map for this region", String.Empty, true);
}
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@ -957,6 +979,9 @@ namespace OpenSim.Framework
case "region_type":
m_regionType = (string)configuration_result;
break;
case "region_static_maptile":
m_maptileStaticUUID = (UUID)configuration_result;
break;
}
return true;

View File

@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using OpenSim.Region.Framework.Interfaces;
using OpenMetaverse;
namespace OpenSim.Region.CoreModules.Framework.InterfaceCommander
{
@ -152,6 +153,9 @@ namespace OpenSim.Region.CoreModules.Framework.InterfaceCommander
case "Boolean":
m_args[i].ArgumentValue = Boolean.Parse(arg.ToString());
break;
case "UUID":
m_args[i].ArgumentValue = UUID.Parse(arg.ToString());
break;
default:
Console.WriteLine("ERROR: Unknown desired type for argument " + m_args[i].Name + " on command " + m_name);
break;

View File

@ -77,42 +77,52 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
{
bool drawPrimVolume = true;
bool textureTerrain = false;
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");
}
if (textureTerrain)
if (generateMaptiles)
{
terrainRenderer = new TexturedMapTileRenderer();
if (textureTerrain)
{
terrainRenderer = new TexturedMapTileRenderer();
}
else
{
terrainRenderer = new ShadedMapTileRenderer();
}
terrainRenderer.Initialise(m_scene, m_config);
mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
//long t = System.Environment.TickCount;
//for (int i = 0; i < 10; ++i) {
terrainRenderer.TerrainToBitmap(mapbmp);
//}
//t = System.Environment.TickCount - t;
//m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
if (drawPrimVolume)
{
DrawObjectVolume(m_scene, mapbmp);
}
}
else
{
terrainRenderer = new ShadedMapTileRenderer();
mapbmp = fetchTexture(m_scene.RegionInfo.RegionSettings.TerrainImageID);
}
terrainRenderer.Initialise(m_scene, m_config);
Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
//long t = System.Environment.TickCount;
//for (int i = 0; i < 10; ++i) {
terrainRenderer.TerrainToBitmap(mapbmp);
//}
//t = System.Environment.TickCount - t;
//m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
if (drawPrimVolume)
{
DrawObjectVolume(m_scene, mapbmp);
}
return mapbmp;
}
@ -222,6 +232,41 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
// }
// }
private Bitmap fetchTexture(UUID id)
{
AssetBase asset = m_scene.AssetService.Get(id.ToString());
m_log.DebugFormat("[MAPTILE]: Fetched static texture {0}, found: {1}", id, asset != null);
if (asset == null) return null;
ManagedImage managedImage;
Image image;
try
{
if (OpenJPEG.DecodeToImage(asset.Data, out managedImage, out image))
return new Bitmap(image);
else
return null;
}
catch (DllNotFoundException)
{
m_log.ErrorFormat("[MAPTILE]: OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", id);
}
catch (IndexOutOfRangeException)
{
m_log.ErrorFormat("[MAPTILE]: OpenJpeg was unable to decode this. Asset Data is empty for {0}", id);
}
catch (Exception)
{
m_log.ErrorFormat("[MAPTILE]: OpenJpeg was unable to decode this. Asset Data is empty for {0}", id);
}
return null;
}
private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp)
{
int tc = 0;

View File

@ -847,141 +847,139 @@ namespace OpenSim.Region.Framework.Scenes
// Region config overrides global config
//
try
if (m_config.Configs["Startup"] != null)
{
if (m_config.Configs["Startup"] != null)
IConfig startupConfig = m_config.Configs["Startup"];
StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup);
if (!UseBackup)
m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
//Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys);
if (RegionInfo.NonphysPrimMin > 0)
{
IConfig startupConfig = m_config.Configs["Startup"];
m_minNonphys = RegionInfo.NonphysPrimMin;
}
StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
if (RegionInfo.NonphysPrimMax > 0)
{
m_maxNonphys = RegionInfo.NonphysPrimMax;
}
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup);
if (!UseBackup)
m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys);
if (RegionInfo.PhysPrimMin > 0)
{
m_minPhys = RegionInfo.PhysPrimMin;
}
//Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
if (RegionInfo.PhysPrimMax > 0)
{
m_maxPhys = RegionInfo.PhysPrimMax;
}
m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys);
if (RegionInfo.NonphysPrimMin > 0)
m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity);
if (RegionInfo.LinksetCapacity > 0)
{
m_linksetCapacity = RegionInfo.LinksetCapacity;
}
SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
// Here, if clamping is requested in either global or
// local config, it will be used
//
m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize);
if (RegionInfo.ClampPrimSize)
{
m_clampPrimSize = true;
}
m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete);
m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
m_dontPersistBefore =
startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
m_dontPersistBefore *= 10000000;
m_persistAfter =
startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
m_persistAfter *= 10000000;
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
if (m_generateMaptiles)
{
int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
if (maptileRefresh != 0)
{
m_minNonphys = RegionInfo.NonphysPrimMin;
m_mapGenerationTimer.Interval = maptileRefresh * 1000;
m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
m_mapGenerationTimer.AutoReset = true;
m_mapGenerationTimer.Start();
}
}
else
{
string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
UUID tileID;
m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
if (RegionInfo.NonphysPrimMax > 0)
if ((tile!=UUID.Zero.ToString()) && UUID.TryParse(tile, out tileID))
{
m_maxNonphys = RegionInfo.NonphysPrimMax;
}
m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys);
if (RegionInfo.PhysPrimMin > 0)
{
m_minPhys = RegionInfo.PhysPrimMin;
}
m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
if (RegionInfo.PhysPrimMax > 0)
{
m_maxPhys = RegionInfo.PhysPrimMax;
}
m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity);
if (RegionInfo.LinksetCapacity > 0)
{
m_linksetCapacity = RegionInfo.LinksetCapacity;
}
SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
// Here, if clamping is requested in either global or
// local config, it will be used
//
m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize);
if (RegionInfo.ClampPrimSize)
{
m_clampPrimSize = true;
}
m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete);
m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
m_dontPersistBefore =
startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
m_dontPersistBefore *= 10000000;
m_persistAfter =
startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
m_persistAfter *= 10000000;
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
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 += RegenerateMaptileAndReregister;
m_mapGenerationTimer.AutoReset = true;
m_mapGenerationTimer.Start();
}
RegionInfo.RegionSettings.TerrainImageID = tileID;
}
else
{
string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
UUID tileID;
if (UUID.TryParse(tile, out tileID))
{
RegionInfo.RegionSettings.TerrainImageID = tileID;
}
RegionInfo.RegionSettings.TerrainImageID = RegionInfo.MaptileStaticUUID;
m_log.InfoFormat("[SCENE]: Region {0}, maptile set to {1}", RegionInfo.RegionName, RegionInfo.MaptileStaticUUID.ToString());
}
string grant = startupConfig.GetString("AllowedClients", String.Empty);
if (grant.Length > 0)
{
foreach (string viewer in grant.Split(','))
{
m_AllowedViewers.Add(viewer.Trim().ToLower());
}
}
grant = startupConfig.GetString("BannedClients", String.Empty);
if (grant.Length > 0)
{
foreach (string viewer in grant.Split(','))
{
m_BannedViewers.Add(viewer.Trim().ToLower());
}
}
MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
}
}
catch (Exception e)
{
m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString());
string grant = startupConfig.GetString("AllowedClients", String.Empty);
if (grant.Length > 0)
{
foreach (string viewer in grant.Split(','))
{
m_AllowedViewers.Add(viewer.Trim().ToLower());
}
}
grant = startupConfig.GetString("BannedClients", String.Empty);
if (grant.Length > 0)
{
foreach (string viewer in grant.Split(','))
{
m_BannedViewers.Add(viewer.Trim().ToLower());
}
}
MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
}
// FIXME: Ultimately this should be in a module.

View File

@ -45,3 +45,4 @@ ExternalHostName = "SYSTEMIP"
; *
; RegionType = "Mainland"
; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"