Allow defining path where to store generated MAP-uuid.png

Defaults to the folder containing OpenSim.dll/.exe for legacy compatibility
This commit is contained in:
lickx
2024-10-09 16:15:00 +02:00
parent f569e656d5
commit 3f658e414b
3 changed files with 16 additions and 2 deletions

View File

@@ -84,6 +84,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
private float m_renderMinHeight = -100f;
private float m_renderMaxHeight = 4096f;
private string m_tilesPath = ".";
private bool m_Enabled = false;
#region Region Module interface
@@ -132,6 +134,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
m_renderMinHeight = -100f;
else if (m_renderMinHeight > m_renderMaxHeight - 10f)
m_renderMinHeight = m_renderMaxHeight - 10f;
m_tilesPath = Util.GetConfigVarFromSections<string>(source, "GenTilesDirectory", configSections, m_tilesPath);
if (!Directory.Exists(m_tilesPath))
Directory.CreateDirectory(m_tilesPath);
}
public void AddRegion(Scene scene)
@@ -208,7 +214,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
Bitmap tile = GenImage();
// image may be reloaded elsewhere, so no compression format
string filename = "MAP-" + m_scene.RegionInfo.RegionID.ToString() + ".png";
string filename = System.IO.Path.Combine(m_tilesPath, "MAP-" + m_scene.RegionInfo.RegionID.ToString() + ".png");
tile.Save(filename,ImageFormat.Png);
m_primMesher = null;
return tile;

View File

@@ -77,6 +77,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
private string m_regionName;
private byte[] myMapImageJPEG;
private string m_tilesPath = ".";
protected volatile bool m_Enabled = false;
private ManualResetEvent m_mapBlockRequestEvent = new ManualResetEvent(false);
@@ -158,6 +159,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
Util.GetConfigVarFromSections<bool>(config, "ExportMapAddRegionName", configSections, m_exportPrintRegionName);
m_localV1MapAssets =
Util.GetConfigVarFromSections<bool>(config, "LocalV1MapAssets", configSections, m_localV1MapAssets);
m_tilesPath =
Util.GetConfigVarFromSections<string>(config, "GenTilesDirectory", configSections, m_tilesPath);
if (!Directory.Exists(m_tilesPath))
Directory.CreateDirectory(m_tilesPath);
}
public virtual void AddRegion(Scene scene)
@@ -1289,7 +1294,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
startY--;
bool doneLocal = false;
string filename = "MAP-" + m_scene.RegionInfo.RegionID.ToString() + ".png";
string filename = Path.Combine(m_tilesPath, "MAP-" + m_scene.RegionInfo.RegionID.ToString() + ".png");
try
{
using(Image localMap = Bitmap.FromFile(filename))

View File

@@ -506,6 +506,9 @@
; Show NPCs as green world map dots
;ShowNPCs = true
; Where to store generated map tiles in the form of MAP-RegionUUID.png
;GenTilesDirectory = "."
[Permissions]
; ##