aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs34
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs50
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs50
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs28
8 files changed, 88 insertions, 94 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 60d1720..b4f1ed6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -219,40 +219,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
219 CreateFoldersForPath(destFolder, archivePathSectionToCreate, resolvedFolders, loadedNodes); 219 CreateFoldersForPath(destFolder, archivePathSectionToCreate, resolvedFolders, loadedNodes);
220 220
221 return destFolder; 221 return destFolder;
222
223 /*
224 string[] rawFolders = filePath.Split(new char[] { '/' });
225
226 // Find the folders that do exist along the path given
227 int i = 0;
228 bool noFolder = false;
229 InventoryFolderImpl foundFolder = rootDestinationFolder;
230 while (!noFolder && i < rawFolders.Length)
231 {
232 InventoryFolderImpl folder = foundFolder.FindFolderByPath(rawFolders[i]);
233 if (null != folder)
234 {
235 m_log.DebugFormat("[INVENTORY ARCHIVER]: Found folder {0}", folder.Name);
236 foundFolder = folder;
237 i++;
238 }
239 else
240 {
241 noFolder = true;
242 }
243 }
244
245 // Create any folders that did not previously exist
246 while (i < rawFolders.Length)
247 {
248 m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawFolders[i]);
249
250 UUID newFolderId = UUID.Random();
251 m_userInfo.CreateFolder(
252 rawFolders[i++], newFolderId, (ushort)AssetType.Folder, foundFolder.ID);
253 foundFolder = foundFolder.GetChildFolder(newFolderId);
254 }
255 */
256 } 222 }
257 223
258 /// <summary> 224 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 59cd386..00bd27a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
279 public void TestIarV0_1WithEscapedChars() 279 public void TestIarV0_1WithEscapedChars()
280 { 280 {
281 TestHelper.InMethod(); 281 TestHelper.InMethod();
282 log4net.Config.XmlConfigurator.Configure(); 282// log4net.Config.XmlConfigurator.Configure();
283 283
284 string itemName = "You & you are a mean/man/"; 284 string itemName = "You & you are a mean/man/";
285 string humanEscapedItemName = @"You & you are a mean\/man\/"; 285 string humanEscapedItemName = @"You & you are a mean\/man\/";
@@ -505,7 +505,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
505 /// Test replication of an archive path to the user's inventory. 505 /// Test replication of an archive path to the user's inventory.
506 /// </summary> 506 /// </summary>
507 [Test] 507 [Test]
508 public void TestReplicateArchivePathToUserInventory() 508 public void TestNewIarPath()
509 { 509 {
510 TestHelper.InMethod(); 510 TestHelper.InMethod();
511 //log4net.Config.XmlConfigurator.Configure(); 511 //log4net.Config.XmlConfigurator.Configure();
@@ -540,5 +540,51 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
540 InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b"); 540 InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
541 Assert.That(folder2, Is.Not.Null, "Could not find folder b"); 541 Assert.That(folder2, Is.Not.Null, "Could not find folder b");
542 } 542 }
543
544 /// <summary>
545 /// Test replication of a partly existing archive path to the user's inventory.
546 /// </summary>
547 [Test]
548 public void TestPartExistingIarPath()
549 {
550 TestHelper.InMethod();
551 //log4net.Config.XmlConfigurator.Configure();
552
553 Scene scene = SceneSetupHelpers.SetupScene("inventory");
554 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
555
556 string folder1ExistingName = "a";
557 string folder2Name = "b";
558 string itemName = "c.lsl";
559
560 InventoryFolderBase folder1
561 = UserInventoryTestUtils.CreateInventoryFolder(
562 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
563
564 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
565 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
566 string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
567
568 string itemArchivePath
569 = string.Format(
570 "{0}{1}{2}{3}",
571 ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
572
573 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
574 .ReplicateArchivePathToUserInventory(
575 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
576 new Dictionary<string, InventoryFolderBase>(), new List<InventoryNodeBase>());
577
578 InventoryFolderBase folder1Post
579 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
580 Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
581 /*
582 InventoryFolderBase folder2
583 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
584 Assert.That(folder2, Is.Not.Null);
585 InventoryItemBase item = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, folder2, itemName);
586 Assert.That(item, Is.Not.Null);
587 */
588 }
543 } 589 }
544} \ No newline at end of file 590} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index c333812..2f1e9dd 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -154,17 +154,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
154 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 154 private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
155 { 155 {
156 m_log.InfoFormat("[INVENTORY TRANSFER]: OnInstantMessage {0}", im.dialog); 156 m_log.InfoFormat("[INVENTORY TRANSFER]: OnInstantMessage {0}", im.dialog);
157
157 Scene scene = FindClientScene(client.AgentId); 158 Scene scene = FindClientScene(client.AgentId);
158 159
159 if (scene == null) // Something seriously wrong here. 160 if (scene == null) // Something seriously wrong here.
160 return; 161 return;
161 162
162 163
163
164 if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) 164 if (im.dialog == (byte) InstantMessageDialog.InventoryOffered)
165 { 165 {
166 //m_log.DebugFormat("Asset type {0}", ((AssetType)im.binaryBucket[0])); 166 //m_log.DebugFormat("Asset type {0}", ((AssetType)im.binaryBucket[0]));
167 167
168 if (im.binaryBucket.Length < 17) // Invalid
169 return;
170
168 UUID receipientID = new UUID(im.toAgentID); 171 UUID receipientID = new UUID(im.toAgentID);
169 ScenePresence user = scene.GetScenePresence(receipientID); 172 ScenePresence user = scene.GetScenePresence(receipientID);
170 UUID copyID; 173 UUID copyID;
@@ -420,8 +423,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
420 { 423 {
421 // Check if this is ours to handle 424 // Check if this is ours to handle
422 // 425 //
423 m_log.Info("OnGridInstantMessage");
424
425 Scene scene = FindClientScene(new UUID(msg.toAgentID)); 426 Scene scene = FindClientScene(new UUID(msg.toAgentID));
426 427
427 if (scene == null) 428 if (scene == null)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 266621f..5e2c04c 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -180,6 +180,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
180 180
181 sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); 181 sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
182 sp.Teleport(position); 182 sp.Teleport(position);
183
184 foreach (SceneObjectGroup grp in sp.Attachments)
185 sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT);
183 } 186 }
184 else // Another region possibly in another simulator 187 else // Another region possibly in another simulator
185 { 188 {
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index b71b5f6..b96d95a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -70,10 +70,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
70 70
71 #region IMapImageGenerator Members 71 #region IMapImageGenerator Members
72 72
73 public byte[] WriteJpeg2000Image(string gradientmap) 73 public Bitmap CreateMapTile(string gradientmap)
74 { 74 {
75 byte[] imageData = null;
76
77 bool drawPrimVolume = true; 75 bool drawPrimVolume = true;
78 bool textureTerrain = false; 76 bool textureTerrain = false;
79 77
@@ -98,32 +96,36 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
98 } 96 }
99 terrainRenderer.Initialise(m_scene, m_config); 97 terrainRenderer.Initialise(m_scene, m_config);
100 98
101 using (Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize)) 99 Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
102 { 100 //long t = System.Environment.TickCount;
103 //long t = System.Environment.TickCount; 101 //for (int i = 0; i < 10; ++i) {
104 //for (int i = 0; i < 10; ++i) { 102 terrainRenderer.TerrainToBitmap(mapbmp);
105 terrainRenderer.TerrainToBitmap(mapbmp); 103 //}
106 //} 104 //t = System.Environment.TickCount - t;
107 //t = System.Environment.TickCount - t; 105 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
108 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
109 106
110 107
111 if (drawPrimVolume) 108 if (drawPrimVolume)
112 { 109 {
113 DrawObjectVolume(m_scene, mapbmp); 110 DrawObjectVolume(m_scene, mapbmp);
114 } 111 }
115 112
116 try 113 return mapbmp;
117 { 114 }
118 imageData = OpenJPEG.EncodeFromImage(mapbmp, true); 115
119 } 116 public byte[] WriteJpeg2000Image(string gradientmap)
120 catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke 117 {
121 { 118 try
122 m_log.Error("Failed generating terrain map: " + e); 119 {
123 } 120 using (Bitmap mapbmp = CreateMapTile(gradientmap))
121 return OpenJPEG.EncodeFromImage(mapbmp, true);
122 }
123 catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
124 {
125 m_log.Error("Failed generating terrain map: " + e);
124 } 126 }
125 127
126 return imageData; 128 return null;
127 } 129 }
128 130
129 #endregion 131 #endregion
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs
index a297cf3..fef2ef3 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs
@@ -37,6 +37,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
37{ 37{
38 public class ShadedMapTileRenderer : IMapTileTerrainRenderer 38 public class ShadedMapTileRenderer : IMapTileTerrainRenderer
39 { 39 {
40 private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
41
40 private static readonly ILog m_log = 42 private static readonly ILog m_log =
41 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 44
@@ -221,8 +223,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
221 223
222 try 224 try
223 { 225 {
224 Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255); 226 mapbmp.SetPixel(x, yr, WATER_COLOR);
225 mapbmp.SetPixel(x, yr, water);
226 } 227 }
227 catch (ArgumentException) 228 catch (ArgumentException)
228 { 229 {
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs
index 4ecad74..8b34f6e 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs
@@ -136,6 +136,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
136 private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c"); 136 private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c");
137 private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200); 137 private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200);
138 138
139 private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
140
139 #endregion 141 #endregion
140 142
141 143
@@ -406,8 +408,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
406 408
407 heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0 409 heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0
408 410
409 Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255); 411 mapbmp.SetPixel(x, yr, WATER_COLOR);
410 mapbmp.SetPixel(x, yr, water);
411 } 412 }
412 } 413 }
413 } 414 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index c6fb18d..0e849e5 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -1002,41 +1002,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1002 1002
1003 public void RegenerateMaptile(byte[] data) 1003 public void RegenerateMaptile(byte[] data)
1004 { 1004 {
1005 // Overwrites the local Asset cache with new maptile data
1006 // Assets are single write, this causes the asset server to ignore this update,
1007 // but the local asset cache does not
1008
1009 // this is on purpose! The net result of this is the region always has the most up to date
1010 // map tile while protecting the (grid) asset database from bloat caused by a new asset each
1011 // time a mapimage is generated!
1012
1013 UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID; 1005 UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
1014 1006
1015 int lastMapRefresh = 0;
1016 int twoDays = 172800;
1017// int RefreshSeconds = twoDays;
1018
1019 try
1020 {
1021 lastMapRefresh = Convert.ToInt32(m_scene.RegionInfo.lastMapRefresh);
1022 }
1023 catch (ArgumentException)
1024 {
1025 }
1026 catch (FormatException)
1027 {
1028 }
1029 catch (OverflowException)
1030 {
1031 }
1032
1033 m_log.Debug("[MAPTILE]: STORING MAPTILE IMAGE"); 1007 m_log.Debug("[MAPTILE]: STORING MAPTILE IMAGE");
1034 1008
1035 m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random(); 1009 m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random();
1036 1010
1037 AssetBase asset = new AssetBase( 1011 AssetBase asset = new AssetBase(
1038 m_scene.RegionInfo.RegionSettings.TerrainImageID, 1012 m_scene.RegionInfo.RegionSettings.TerrainImageID,
1039 "terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(), 1013 "terrainImage_" + m_scene.RegionInfo.RegionID.ToString(),
1040 (sbyte)AssetType.Texture, 1014 (sbyte)AssetType.Texture,
1041 m_scene.RegionInfo.RegionID.ToString()); 1015 m_scene.RegionInfo.RegionID.ToString());
1042 asset.Data = data; 1016 asset.Data = data;