diff options
author | Diva Canto | 2009-09-26 07:48:21 -0700 |
---|---|---|
committer | Diva Canto | 2009-09-26 07:48:21 -0700 |
commit | 5757afe7665543e8b3ed4a322a7d6e095dafcdb3 (patch) | |
tree | bed3c7ab11459e84baa5a0fbd98dde4a81fd5e16 /OpenSim/Region/CoreModules/World | |
parent | More small changes to FlotsamAssetCache as per mcortez' request. (diff) | |
download | opensim-SC_OLD-5757afe7665543e8b3ed4a322a7d6e095dafcdb3.zip opensim-SC_OLD-5757afe7665543e8b3ed4a322a7d6e095dafcdb3.tar.gz opensim-SC_OLD-5757afe7665543e8b3ed4a322a7d6e095dafcdb3.tar.bz2 opensim-SC_OLD-5757afe7665543e8b3ed4a322a7d6e095dafcdb3.tar.xz |
First pass at the heart surgery for grid services. Compiles and runs minimally. A few bugs to catch now.
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
3 files changed, 102 insertions, 44 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 76ff6da..fdff61e 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -36,10 +36,12 @@ using OpenSim.Framework; | |||
36 | using OpenSim.Framework.Capabilities; | 36 | using OpenSim.Framework.Capabilities; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Framework.Servers.HttpServer; | 38 | using OpenSim.Framework.Servers.HttpServer; |
39 | using OpenSim.Services.Interfaces; | ||
39 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Region.Physics.Manager; | 42 | using OpenSim.Region.Physics.Manager; |
42 | using Caps=OpenSim.Framework.Capabilities.Caps; | 43 | using Caps=OpenSim.Framework.Capabilities.Caps; |
44 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
43 | 45 | ||
44 | namespace OpenSim.Region.CoreModules.World.Land | 46 | namespace OpenSim.Region.CoreModules.World.Land |
45 | { | 47 | { |
@@ -1301,7 +1303,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1301 | else | 1303 | else |
1302 | { | 1304 | { |
1303 | // a parcel request for a parcel in another region. Ask the grid about the region | 1305 | // a parcel request for a parcel in another region. Ask the grid about the region |
1304 | RegionInfo info = m_scene.CommsManager.GridService.RequestNeighbourInfo(regionID); | 1306 | GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, regionID); |
1305 | if (info != null) | 1307 | if (info != null) |
1306 | parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y); | 1308 | parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y); |
1307 | } | 1309 | } |
@@ -1359,9 +1361,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1359 | } | 1361 | } |
1360 | else | 1362 | else |
1361 | { | 1363 | { |
1362 | extLandData.landData = m_scene.CommsManager.GridService.RequestLandData(extLandData.regionHandle, | 1364 | ILandService landService = m_scene.RequestModuleInterface<ILandService>(); |
1363 | extLandData.x, | 1365 | extLandData.landData = landService.GetLandData(extLandData.regionHandle, |
1364 | extLandData.y); | 1366 | extLandData.x, |
1367 | extLandData.y); | ||
1365 | if (extLandData.landData == null) | 1368 | if (extLandData.landData == null) |
1366 | { | 1369 | { |
1367 | // we didn't find the region/land => don't cache | 1370 | // we didn't find the region/land => don't cache |
@@ -1373,20 +1376,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1373 | 1376 | ||
1374 | if (data != null) // if we found some data, send it | 1377 | if (data != null) // if we found some data, send it |
1375 | { | 1378 | { |
1376 | RegionInfo info; | 1379 | GridRegion info; |
1377 | if (data.regionHandle == m_scene.RegionInfo.RegionHandle) | 1380 | if (data.regionHandle == m_scene.RegionInfo.RegionHandle) |
1378 | { | 1381 | { |
1379 | info = m_scene.RegionInfo; | 1382 | info = new GridRegion(m_scene.RegionInfo); |
1380 | } | 1383 | } |
1381 | else | 1384 | else |
1382 | { | 1385 | { |
1383 | // most likely still cached from building the extLandData entry | 1386 | // most likely still cached from building the extLandData entry |
1384 | info = m_scene.CommsManager.GridService.RequestNeighbourInfo(data.regionHandle); | 1387 | uint x = 0, y = 0; |
1388 | Utils.LongToUInts(data.regionHandle, out x, out y); | ||
1389 | info = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
1385 | } | 1390 | } |
1386 | // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. | 1391 | // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. |
1387 | m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...", | 1392 | m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...", |
1388 | data.landData.Name, data.regionHandle); | 1393 | data.landData.Name, data.regionHandle); |
1389 | remoteClient.SendParcelInfo(info, data.landData, parcelID, data.x, data.y); | 1394 | // HACK for now |
1395 | RegionInfo r = new RegionInfo(); | ||
1396 | r.RegionName = info.RegionName; | ||
1397 | r.RegionLocX = (uint)info.RegionLocX; | ||
1398 | r.RegionLocY = (uint)info.RegionLocY; | ||
1399 | remoteClient.SendParcelInfo(r, data.landData, parcelID, data.x, data.y); | ||
1390 | } | 1400 | } |
1391 | else | 1401 | else |
1392 | m_log.Debug("[LAND] got no parcelinfo; not sending"); | 1402 | m_log.Debug("[LAND] got no parcelinfo; not sending"); |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 4783b35..e3661fa 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -33,6 +33,8 @@ using OpenSim.Framework; | |||
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Region.Framework.Scenes.Hypergrid; | 35 | using OpenSim.Region.Framework.Scenes.Hypergrid; |
36 | using OpenSim.Services.Interfaces; | ||
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
36 | 38 | ||
37 | namespace OpenSim.Region.CoreModules.World.WorldMap | 39 | namespace OpenSim.Region.CoreModules.World.WorldMap |
38 | { | 40 | { |
@@ -92,13 +94,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
92 | } | 94 | } |
93 | 95 | ||
94 | // try to fetch from GridServer | 96 | // try to fetch from GridServer |
95 | List<RegionInfo> regionInfos = m_scene.SceneGridService.RequestNamedRegions(mapName, 20); | 97 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(UUID.Zero, mapName, 20); |
96 | if (regionInfos == null) | 98 | if (regionInfos == null) |
97 | { | 99 | { |
98 | m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?"); | 100 | m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?"); |
99 | // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region | 101 | // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region |
100 | regionInfos = new List<RegionInfo>(); | 102 | regionInfos = new List<GridRegion>(); |
101 | RegionInfo info = m_scene.SceneGridService.RequestClosestRegion(mapName); | 103 | GridRegion info = m_scene.GridService.GetRegionByName(UUID.Zero, mapName); |
102 | if (info != null) regionInfos.Add(info); | 104 | if (info != null) regionInfos.Add(info); |
103 | } | 105 | } |
104 | 106 | ||
@@ -109,11 +111,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
109 | if (mapName.Contains(".") && mapName.Contains(":")) | 111 | if (mapName.Contains(".") && mapName.Contains(":")) |
110 | { | 112 | { |
111 | // It probably is a domain name. Try to link to it. | 113 | // It probably is a domain name. Try to link to it. |
112 | RegionInfo regInfo; | 114 | GridRegion regInfo; |
113 | Scene cScene = GetClientScene(remoteClient); | 115 | Scene cScene = GetClientScene(remoteClient); |
114 | regInfo = HGHyperlink.TryLinkRegion(cScene, remoteClient, mapName); | 116 | IHyperlinkService hyperService = cScene.RequestModuleInterface<IHyperlinkService>(); |
115 | if (regInfo != null) | 117 | if (hyperService != null) |
116 | regionInfos.Add(regInfo); | 118 | { |
119 | regInfo = hyperService.TryLinkRegion(remoteClient, mapName); | ||
120 | if (regInfo != null) | ||
121 | regionInfos.Add(regInfo); | ||
122 | } | ||
117 | } | 123 | } |
118 | } | 124 | } |
119 | 125 | ||
@@ -122,12 +128,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
122 | MapBlockData data; | 128 | MapBlockData data; |
123 | if (regionInfos.Count > 0) | 129 | if (regionInfos.Count > 0) |
124 | { | 130 | { |
125 | foreach (RegionInfo info in regionInfos) | 131 | foreach (GridRegion info in regionInfos) |
126 | { | 132 | { |
127 | data = new MapBlockData(); | 133 | data = new MapBlockData(); |
128 | data.Agents = 0; | 134 | data.Agents = 0; |
129 | data.Access = info.AccessLevel; | 135 | data.Access = info.Access; |
130 | data.MapImageId = info.RegionSettings.TerrainImageID; | 136 | data.MapImageId = info.TerrainImage; |
131 | data.Name = info.RegionName; | 137 | data.Name = info.RegionName; |
132 | data.RegionFlags = 0; // TODO not used? | 138 | data.RegionFlags = 0; // TODO not used? |
133 | data.WaterHeight = 0; // not used | 139 | data.WaterHeight = 0; // not used |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 1f25f28..bd12218 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -48,6 +48,7 @@ using OpenSim.Region.Framework.Scenes; | |||
48 | using Caps=OpenSim.Framework.Capabilities.Caps; | 48 | using Caps=OpenSim.Framework.Capabilities.Caps; |
49 | using OSDArray=OpenMetaverse.StructuredData.OSDArray; | 49 | using OSDArray=OpenMetaverse.StructuredData.OSDArray; |
50 | using OSDMap=OpenMetaverse.StructuredData.OSDMap; | 50 | using OSDMap=OpenMetaverse.StructuredData.OSDMap; |
51 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
51 | 52 | ||
52 | namespace OpenSim.Region.CoreModules.World.WorldMap | 53 | namespace OpenSim.Region.CoreModules.World.WorldMap |
53 | { | 54 | { |
@@ -232,10 +233,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
232 | } | 233 | } |
233 | if (lookup) | 234 | if (lookup) |
234 | { | 235 | { |
235 | List<MapBlockData> mapBlocks; | 236 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); ; |
236 | 237 | ||
237 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)m_scene.RegionInfo.RegionLocX - 8, (int)m_scene.RegionInfo.RegionLocY - 8, (int)m_scene.RegionInfo.RegionLocX + 8, (int)m_scene.RegionInfo.RegionLocY + 8); | 238 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, |
238 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks,0); | 239 | (int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize, |
240 | (int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize, | ||
241 | (int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize, | ||
242 | (int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize); | ||
243 | foreach (GridRegion r in regions) | ||
244 | { | ||
245 | MapBlockData block = new MapBlockData(); | ||
246 | MapBlockFromGridRegion(block, r); | ||
247 | mapBlocks.Add(block); | ||
248 | } | ||
249 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); | ||
239 | 250 | ||
240 | lock (cachedMapBlocks) | 251 | lock (cachedMapBlocks) |
241 | cachedMapBlocks = mapBlocks; | 252 | cachedMapBlocks = mapBlocks; |
@@ -579,7 +590,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
579 | } | 590 | } |
580 | if (httpserver.Length == 0) | 591 | if (httpserver.Length == 0) |
581 | { | 592 | { |
582 | RegionInfo mreg = m_scene.SceneGridService.RequestNeighbouringRegionInfo(regionhandle); | 593 | uint x = 0, y = 0; |
594 | Utils.LongToUInts(regionhandle, out x, out y); | ||
595 | GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); | ||
583 | 596 | ||
584 | if (mreg != null) | 597 | if (mreg != null) |
585 | { | 598 | { |
@@ -719,15 +732,23 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
719 | { | 732 | { |
720 | List<MapBlockData> response = new List<MapBlockData>(); | 733 | List<MapBlockData> response = new List<MapBlockData>(); |
721 | 734 | ||
722 | // this should return one mapblock at most. But make sure: Look whether the one we requested is in there | 735 | // this should return one mapblock at most. |
723 | List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); | 736 | // (diva note: why?? in that case we should GetRegionByPosition) |
724 | if (mapBlocks != null) | 737 | // But make sure: Look whether the one we requested is in there |
738 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | ||
739 | minX * (int)Constants.RegionSize, minY * (int)Constants.RegionSize, | ||
740 | maxX * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize); | ||
741 | |||
742 | if (regions != null) | ||
725 | { | 743 | { |
726 | foreach (MapBlockData block in mapBlocks) | 744 | foreach (GridRegion r in regions) |
727 | { | 745 | { |
728 | if (block.X == minX && block.Y == minY) | 746 | if ((r.RegionLocX == minX * (int)Constants.RegionSize) && |
747 | (r.RegionLocY == minY * (int)Constants.RegionSize)) | ||
729 | { | 748 | { |
730 | // found it => add it to response | 749 | // found it => add it to response |
750 | MapBlockData block = new MapBlockData(); | ||
751 | MapBlockFromGridRegion(block, r); | ||
731 | response.Add(block); | 752 | response.Add(block); |
732 | break; | 753 | break; |
733 | } | 754 | } |
@@ -754,10 +775,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
754 | 775 | ||
755 | protected virtual void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) | 776 | protected virtual void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) |
756 | { | 777 | { |
757 | List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); | 778 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); |
779 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | ||
780 | (minX - 4) * (int)Constants.RegionSize, (minY - 4) * (int)Constants.RegionSize, | ||
781 | (maxX + 4) * (int)Constants.RegionSize, (maxY + 4) * (int)Constants.RegionSize); | ||
782 | foreach (GridRegion r in regions) | ||
783 | { | ||
784 | MapBlockData block = new MapBlockData(); | ||
785 | MapBlockFromGridRegion(block, r); | ||
786 | mapBlocks.Add(block); | ||
787 | } | ||
758 | remoteClient.SendMapBlock(mapBlocks, flag); | 788 | remoteClient.SendMapBlock(mapBlocks, flag); |
759 | } | 789 | } |
760 | 790 | ||
791 | protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r) | ||
792 | { | ||
793 | block.Access = r.Access; | ||
794 | block.MapImageId = r.TerrainImage; | ||
795 | block.Name = r.RegionName; | ||
796 | block.X = (ushort)(r.RegionLocX / Constants.RegionSize); | ||
797 | block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); | ||
798 | } | ||
799 | |||
761 | public Hashtable OnHTTPGetMapImage(Hashtable keysvals) | 800 | public Hashtable OnHTTPGetMapImage(Hashtable keysvals) |
762 | { | 801 | { |
763 | m_log.Debug("[WORLD MAP]: Sending map image jpeg"); | 802 | m_log.Debug("[WORLD MAP]: Sending map image jpeg"); |
@@ -874,31 +913,34 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
874 | m_log.InfoFormat( | 913 | m_log.InfoFormat( |
875 | "[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath); | 914 | "[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath); |
876 | 915 | ||
877 | List<MapBlockData> mapBlocks = | 916 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); |
878 | m_scene.CommsManager.GridService.RequestNeighbourMapBlocks( | 917 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, |
879 | (int)(m_scene.RegionInfo.RegionLocX - 9), | 918 | (int)(m_scene.RegionInfo.RegionLocX - 9) * (int)Constants.RegionSize, |
880 | (int)(m_scene.RegionInfo.RegionLocY - 9), | 919 | (int)(m_scene.RegionInfo.RegionLocY - 9) * (int)Constants.RegionSize, |
881 | (int)(m_scene.RegionInfo.RegionLocX + 9), | 920 | (int)(m_scene.RegionInfo.RegionLocX + 9) * (int)Constants.RegionSize, |
882 | (int)(m_scene.RegionInfo.RegionLocY + 9)); | 921 | (int)(m_scene.RegionInfo.RegionLocY + 9) * (int)Constants.RegionSize); |
883 | List<AssetBase> textures = new List<AssetBase>(); | 922 | List<AssetBase> textures = new List<AssetBase>(); |
884 | List<Image> bitImages = new List<Image>(); | 923 | List<Image> bitImages = new List<Image>(); |
885 | 924 | ||
886 | foreach (MapBlockData mapBlock in mapBlocks) | 925 | foreach (GridRegion r in regions) |
887 | { | 926 | { |
927 | MapBlockData mapBlock = new MapBlockData(); | ||
928 | MapBlockFromGridRegion(mapBlock, r); | ||
888 | AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); | 929 | AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); |
889 | 930 | ||
890 | if (texAsset != null) | 931 | if (texAsset != null) |
891 | { | 932 | { |
892 | textures.Add(texAsset); | 933 | textures.Add(texAsset); |
893 | } | 934 | } |
894 | else | 935 | //else |
895 | { | 936 | //{ |
896 | texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); | 937 | // // WHAT?!? This doesn't seem right. Commenting (diva) |
897 | if (texAsset != null) | 938 | // texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); |
898 | { | 939 | // if (texAsset != null) |
899 | textures.Add(texAsset); | 940 | // { |
900 | } | 941 | // textures.Add(texAsset); |
901 | } | 942 | // } |
943 | //} | ||
902 | } | 944 | } |
903 | 945 | ||
904 | foreach (AssetBase asset in textures) | 946 | foreach (AssetBase asset in textures) |