Compare commits

..

6 Commits

Author SHA1 Message Date
Ubit Umarov
3463388772 Merge pull request #51 from typhartez/maptiles-path
Add MapTilesDirectory setting to configure map tile location
2026-08-07 10:46:23 +01:00
Ubit Umarov
1d7235f864 Merge pull request #53 from holoneon/patch-7
Update MapSearchModule.cs
2026-08-07 10:42:42 +01:00
Ubit Umarov
7607ed99a0 Merge pull request #52 from amandaleeang/enforce-script-hasrun
Mark scripts as HasRun on every run (fix empty state on teleport)
2026-08-07 10:37:38 +01:00
Fiona Sweet
205b8c6018 Update MapSearchModule.cs
'data' isn't used, dead code.
2026-08-07 02:23:48 -07:00
Amanda Lee
6950500b87 Mark scripts as hasRun on event dispatch (fix empty state on teleport) 2026-08-07 13:36:46 +08:00
Typhaine Artez
68b42d860a Add MapTilesDirectory setting to configure map tile location
Introduce a new MapTilesDirectory option in the [Map] config section
that controls where the MAP-<region uuid>.png tile images are saved and
loaded from. Previously these were always written to and read from the
current working directory.

- Warp3DImageModule saves the tile into the configured directory,
  creating it if needed.
- WorldMapModule loads the local tile from the configured directory when
  exporting the world map.
- Document the option in OpenSimDefaults.ini.

When left empty the current working directory is used, preserving the
previous behaviour.
2026-08-06 00:02:50 +02:00
5 changed files with 25 additions and 4 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_mapTilesDirectory = string.Empty; // directory to load/save map tile images
private bool m_Enabled = false;
#region Region Module interface
@@ -132,6 +134,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
m_renderMinHeight = -100f;
else if (m_renderMinHeight > m_renderMaxHeight - 10f)
m_renderMinHeight = m_renderMaxHeight - 10f;
m_mapTilesDirectory =
Util.GetConfigVarFromSections<string>(source, "MapTilesDirectory", configSections, m_mapTilesDirectory);
}
public void AddRegion(Scene scene)
@@ -209,6 +214,11 @@ 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";
if (!string.IsNullOrEmpty(m_mapTilesDirectory))
{
Directory.CreateDirectory(m_mapTilesDirectory);
filename = System.IO.Path.Combine(m_mapTilesDirectory, filename);
}
tile.Save(filename,ImageFormat.Png);
m_primMesher = null;
return tile;

View File

@@ -130,14 +130,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
//m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count);
MapBlockData data;
if (regionInfos != null && regionInfos.Count > 0)
{
foreach (GridRegion info in regionInfos)
{
data = new MapBlockData();
data.Agents = 0;
data.Access = info.Access;
MapBlockData block = new MapBlockData();
MapBlockFromGridRegion(block, info, flags);

View File

@@ -100,6 +100,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
protected bool m_exportPrintScale = false; // prints the scale of map in meters on exported map
protected bool m_exportPrintRegionName = false; // prints the region name exported map
protected bool m_localV1MapAssets = false; // keep V1 map assets only on local cache
protected string m_mapTilesDirectory = string.Empty; // directory to load/save map tile images
private readonly object m_sceneLock = new object();
public WorldMapModule()
@@ -158,6 +159,8 @@ 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_mapTilesDirectory =
Util.GetConfigVarFromSections<string>(config, "MapTilesDirectory", configSections, m_mapTilesDirectory);
}
public virtual void AddRegion(Scene scene)
@@ -1339,6 +1342,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
bool doneLocal = false;
string filename = "MAP-" + m_scene.RegionInfo.RegionID.ToString() + ".png";
if (!string.IsNullOrEmpty(m_mapTilesDirectory))
filename = Path.Combine(m_mapTilesDirectory, filename);
try
{
using(Image localMap = Bitmap.FromFile(filename))

View File

@@ -318,6 +318,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
m_LastRanAt = now;
m_InstEHSlice++;
callMode = CallMode_NORMAL;
// The script really executes here, so it has meaningful
// state to serialize — GetXMLState gates on this flag.
m_HasRun = true;
e = ResumeEx();
}
@@ -393,6 +396,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine
m_DetectParams = evt.DetectParams;
m_LastRanAt = now;
m_InstEHEvent++;
// Starting a new event handler counts as "has run".
m_HasRun = true;
e = StartEventHandler(evc, evt.Params);
}

View File

@@ -467,6 +467,11 @@
; generate better images.
;MapImageModule = "MapImageModule"
; Directory used to load and save the generated MAP-<region uuid>.png tile images.
; If left empty the current working directory is used (default behaviour).
; The directory is created automatically if it does not exist.
;MapTilesDirectory = "./maptiles"
; World map blacklist timeout in seconds
;BlacklistTimeout = 600