From 00d1c88c59c10aa8d34fa36910cf0f1f0e9878b8 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 30 Jan 2012 11:49:22 -0500 Subject: [PATCH 1/6] Pickup map overlay tile from RegionSettings.ParcelImageID --- OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index eac2743b20..bbf6b0552d 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -1026,7 +1026,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r) { block.Access = r.Access; - block.MapImageId = r.TerrainImage; + block.MapImageId = m_scene.RegionInfo.RegionSettings.ParcelImageID; block.Name = r.RegionName; block.X = (ushort)(r.RegionLocX / Constants.RegionSize); block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); From 54e6b2402c280b775c3ad8cba04e118bd8b57bda Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 30 Jan 2012 12:39:08 -0500 Subject: [PATCH 2/6] Revert "Pickup map overlay tile from RegionSettings.ParcelImageID" This reverts commit 00d1c88c59c10aa8d34fa36910cf0f1f0e9878b8. Need to dig a little deeper to see exactly how V1 viewers are using this --- OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index bbf6b0552d..eac2743b20 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -1026,7 +1026,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r) { block.Access = r.Access; - block.MapImageId = m_scene.RegionInfo.RegionSettings.ParcelImageID; + block.MapImageId = r.TerrainImage; block.Name = r.RegionName; block.X = (ushort)(r.RegionLocX / Constants.RegionSize); block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); From df9c35bc0f12cfd64414c5cf1c4a7f135884f2ee Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 30 Jan 2012 19:46:55 +0000 Subject: [PATCH 3/6] Some plumbing for map overlays --- .../World/WorldMap/WorldMapModule.cs | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index bbf6b0552d..103d1282e6 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -955,8 +955,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { List response = new List(); - // this should return one mapblock at most. - // (diva note: why?? in that case we should GetRegionByPosition) + // this should return one mapblock at most. It is triggered by a click + // on an unloaded square. // But make sure: Look whether the one we requested is in there List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, minX * (int)Constants.RegionSize, @@ -973,7 +973,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { // found it => add it to response MapBlockData block = new MapBlockData(); - MapBlockFromGridRegion(block, r); + MapBlockFromGridRegion(block, r, flag); response.Add(block); break; } @@ -989,10 +989,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap block.Access = 254; // means 'simulator is offline' response.Add(block); } - if ((flag & 2) == 2) // V2 !!! - remoteClient.SendMapBlock(response, 2); - else - remoteClient.SendMapBlock(response, 0); + // The lower 16 bits are an unsigned int16 + remoteClient.SendMapBlock(response, flags & 0xffff); } else { @@ -1012,21 +1010,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap foreach (GridRegion r in regions) { MapBlockData block = new MapBlockData(); - MapBlockFromGridRegion(block, r); + MapBlockFromGridRegion(block, r, flag); mapBlocks.Add(block); } - if ((flag & 2) == 2) // V2 !!! - remoteClient.SendMapBlock(mapBlocks, 2); - else - remoteClient.SendMapBlock(mapBlocks, 0); + remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); return mapBlocks; } - protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r) + protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) { block.Access = r.Access; - block.MapImageId = m_scene.RegionInfo.RegionSettings.ParcelImageID; + switch (flag & 0xffff) + { + case 0: + block.MapImageId = m_scene.RegionInfo.RegionSettings.ParcelImageID; + break; + case 2: + block.MapImageId = m_scene.RegionInfo.RegionSettings.ParcelImageID; + break; + default: + block.MapImageId = UUID.Zero; + } block.Name = r.RegionName; block.X = (ushort)(r.RegionLocX / Constants.RegionSize); block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); @@ -1160,7 +1165,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap foreach (GridRegion r in regions) { MapBlockData mapBlock = new MapBlockData(); - MapBlockFromGridRegion(mapBlock, r); + MapBlockFromGridRegion(mapBlock, r, 0); AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); if (texAsset != null) From bde2ff5e78360061be89e4c5717f4d67248d9185 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 30 Jan 2012 20:11:47 +0000 Subject: [PATCH 4/6] Next step for world map overlays --- .../Region/CoreModules/World/WorldMap/WorldMapModule.cs | 5 +++-- OpenSim/Services/Interfaces/IGridService.cs | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 103d1282e6..c81eeebf41 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -263,7 +263,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap foreach (GridRegion r in regions) { MapBlockData block = new MapBlockData(); - MapBlockFromGridRegion(block, r); + MapBlockFromGridRegion(block, r, 0); mapBlocks.Add(block); } avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); @@ -990,7 +990,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap response.Add(block); } // The lower 16 bits are an unsigned int16 - remoteClient.SendMapBlock(response, flags & 0xffff); + remoteClient.SendMapBlock(response, flag & 0xffff); } else { @@ -1031,6 +1031,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap break; default: block.MapImageId = UUID.Zero; + break; } block.Name = r.RegionName; block.X = (ushort)(r.RegionLocX / Constants.RegionSize); diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 7137f9ac71..d80999649f 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -190,6 +190,7 @@ namespace OpenSim.Services.Interfaces public UUID ScopeID = UUID.Zero; public UUID TerrainImage = UUID.Zero; + public UUID ParcelImage = UUID.Zero; public byte Access; public int Maturity; public string RegionSecret = string.Empty; @@ -236,6 +237,7 @@ namespace OpenSim.Services.Interfaces RegionID = ConvertFrom.RegionID; ServerURI = ConvertFrom.ServerURI; TerrainImage = ConvertFrom.RegionSettings.TerrainImageID; + ParcelImage = ConvertFrom.RegionSettings.ParcelImageID; Access = ConvertFrom.AccessLevel; Maturity = ConvertFrom.RegionSettings.Maturity; RegionSecret = ConvertFrom.regionSecret; @@ -253,6 +255,7 @@ namespace OpenSim.Services.Interfaces RegionID = ConvertFrom.RegionID; ServerURI = ConvertFrom.ServerURI; TerrainImage = ConvertFrom.TerrainImage; + ParcelImage = ConvertFrom.ParcelImage; Access = ConvertFrom.Access; Maturity = ConvertFrom.Maturity; RegionSecret = ConvertFrom.RegionSecret; @@ -281,7 +284,7 @@ namespace OpenSim.Services.Interfaces public override int GetHashCode() { - return RegionID.GetHashCode() ^ TerrainImage.GetHashCode(); + return RegionID.GetHashCode() ^ TerrainImage.GetHashCode() ^ ParcelImage.GetHashCode(); } #endregion @@ -359,6 +362,7 @@ namespace OpenSim.Services.Interfaces kvp["serverURI"] = ServerURI; kvp["serverPort"] = InternalEndPoint.Port.ToString(); kvp["regionMapTexture"] = TerrainImage.ToString(); + kvp["parcelMapTexture"] = ParcelImage.ToString(); kvp["access"] = Access.ToString(); kvp["regionSecret"] = RegionSecret; kvp["owner_uuid"] = EstateOwner.ToString(); @@ -411,6 +415,9 @@ namespace OpenSim.Services.Interfaces if (kvp.ContainsKey("regionMapTexture")) UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); + if (kvp.ContainsKey("parcelMapTexture")) + UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); + if (kvp.ContainsKey("access")) Access = Byte.Parse((string)kvp["access"]); From c4cc626dffd87b6ab28f40c847db2def95e189b7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 30 Jan 2012 20:34:32 +0000 Subject: [PATCH 5/6] Add the needed column in the regions table and a few tweaks. Warning: Contains a Migration Warning: Cannot guarantee nut free --- OpenSim/Data/MySQL/Resources/GridStore.migrations | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OpenSim/Data/MySQL/Resources/GridStore.migrations b/OpenSim/Data/MySQL/Resources/GridStore.migrations index eda6dbb2a3..98ba8c5604 100644 --- a/OpenSim/Data/MySQL/Resources/GridStore.migrations +++ b/OpenSim/Data/MySQL/Resources/GridStore.migrations @@ -94,3 +94,12 @@ BEGIN; alter table regions modify column regionName varchar(128) default NULL; COMMIT; + +:VERSION 9 # ------------ + +BEGIN; + +alter table regions add column `parcelMapTexture` varchar(36) default NULL; + +COMMIT; + From 53c3faac5d3102cf9bd7d348acaac9a07804f382 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 30 Jan 2012 21:24:21 +0000 Subject: [PATCH 6/6] Patch in the rest of the maptile stuff --- .../CoreModules/World/WorldMap/WorldMapModule.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index c81eeebf41..ac95598048 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -1348,6 +1348,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); UUID terrainImageID = UUID.Random(); + UUID parcelImageID = UUID.Zero; // UUID.Random(); AssetBase asset = new AssetBase( terrainImageID, @@ -1364,13 +1365,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_scene.AssetService.Store(asset); // Switch to the new one - UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID; + UUID lastTerrainImageID = m_scene.RegionInfo.RegionSettings.TerrainImageID; + UUID lastParcelImageID = m_scene.RegionInfo.RegionSettings.TerrainImageID; m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID; + m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID; m_scene.RegionInfo.RegionSettings.Save(); // Delete the old one - m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastMapRegionUUID); - m_scene.AssetService.Delete(lastMapRegionUUID.ToString()); + // m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID); + m_scene.AssetService.Delete(lastTerrainImageID.ToString()); + m_scene.AssetService.Delete(lastParcelImageID.ToString()); } private void MakeRootAgent(ScenePresence avatar)