Allow use of MaptileStaticUUID in Regions.ini to override the global setting in OpenSim.ini for each region.
Signed-off-by: BlueWall <jamesh@bluewallgroup.com>user_profiles
parent
52ea6eadae
commit
fac72d540b
|
@ -143,6 +143,7 @@ namespace OpenSim.Framework
|
||||||
public UUID RegionID = UUID.Zero;
|
public UUID RegionID = UUID.Zero;
|
||||||
public string RemotingAddress;
|
public string RemotingAddress;
|
||||||
public UUID ScopeID = UUID.Zero;
|
public UUID ScopeID = UUID.Zero;
|
||||||
|
private UUID m_maptileStaticUUID = UUID.Zero;
|
||||||
|
|
||||||
private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>();
|
private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
@ -338,6 +339,11 @@ namespace OpenSim.Framework
|
||||||
get { return m_regionType; }
|
get { return m_regionType; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID MaptileStaticUUID
|
||||||
|
{
|
||||||
|
get { return m_maptileStaticUUID; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The port by which http communication occurs with the region (most noticeably, CAPS communication)
|
/// The port by which http communication occurs with the region (most noticeably, CAPS communication)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -641,7 +647,7 @@ namespace OpenSim.Framework
|
||||||
m_regionType = config.GetString("RegionType", String.Empty);
|
m_regionType = config.GetString("RegionType", String.Empty);
|
||||||
allKeys.Remove("RegionType");
|
allKeys.Remove("RegionType");
|
||||||
|
|
||||||
#region Prim stuff
|
#region Prim and map stuff
|
||||||
|
|
||||||
m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0);
|
m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0);
|
||||||
allKeys.Remove("NonPhysicalPrimMin");
|
allKeys.Remove("NonPhysicalPrimMin");
|
||||||
|
@ -664,6 +670,13 @@ namespace OpenSim.Framework
|
||||||
m_linksetCapacity = config.GetInt("LinksetPrims", 0);
|
m_linksetCapacity = config.GetInt("LinksetPrims", 0);
|
||||||
allKeys.Remove("LinksetPrims");
|
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
|
#endregion
|
||||||
|
|
||||||
m_agentCapacity = config.GetInt("MaxAgents", 100);
|
m_agentCapacity = config.GetInt("MaxAgents", 100);
|
||||||
|
@ -729,6 +742,9 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
if (RegionType != String.Empty)
|
if (RegionType != String.Empty)
|
||||||
config.Set("RegionType", RegionType);
|
config.Set("RegionType", RegionType);
|
||||||
|
|
||||||
|
if (m_maptileStaticUUID != UUID.Zero)
|
||||||
|
config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result)
|
public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result)
|
||||||
|
@ -827,6 +843,9 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
"Free form string describing the type of region", String.Empty, true);
|
"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()
|
public void loadConfigurationOptions()
|
||||||
|
@ -880,6 +899,9 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
"Region Type", String.Empty, true);
|
"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)
|
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
||||||
|
@ -949,6 +971,9 @@ namespace OpenSim.Framework
|
||||||
case "region_type":
|
case "region_type":
|
||||||
m_regionType = (string)configuration_result;
|
m_regionType = (string)configuration_result;
|
||||||
break;
|
break;
|
||||||
|
case "region_static_maptile":
|
||||||
|
m_maptileStaticUUID = (UUID)configuration_result;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -77,42 +77,52 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
||||||
{
|
{
|
||||||
bool drawPrimVolume = true;
|
bool drawPrimVolume = true;
|
||||||
bool textureTerrain = false;
|
bool textureTerrain = false;
|
||||||
|
bool generateMaptiles = true;
|
||||||
|
Bitmap mapbmp;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IConfig startupConfig = m_config.Configs["Startup"];
|
IConfig startupConfig = m_config.Configs["Startup"];
|
||||||
drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume);
|
drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume);
|
||||||
textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain);
|
textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain);
|
||||||
|
generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", generateMaptiles);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
m_log.Warn("[MAPTILE]: Failed to load StartupConfig");
|
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
|
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;
|
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)
|
private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp)
|
||||||
{
|
{
|
||||||
int tc = 0;
|
int tc = 0;
|
||||||
|
|
|
@ -917,10 +917,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
|
string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
|
||||||
UUID tileID;
|
UUID tileID;
|
||||||
|
|
||||||
if (UUID.TryParse(tile, out tileID))
|
if ((tile!=UUID.Zero.ToString()) && UUID.TryParse(tile, out tileID))
|
||||||
{
|
{
|
||||||
RegionInfo.RegionSettings.TerrainImageID = tileID;
|
RegionInfo.RegionSettings.TerrainImageID = tileID;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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);
|
string grant = startupConfig.GetString("AllowedClients", String.Empty);
|
||||||
|
|
Loading…
Reference in New Issue