aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs78
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs131
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs120
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs22
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs65
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs515
12 files changed, 556 insertions, 431 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 74784ae..38152cc 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -471,12 +471,86 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
471 SceneObjectSerializer.ToOriginalXmlFormat(group); 471 SceneObjectSerializer.ToOriginalXmlFormat(group);
472 group.DetachToInventoryPrep(); 472 group.DetachToInventoryPrep();
473 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); 473 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
474 m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); 474 UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
475 m_scene.DeleteSceneObject(group, false); 475 m_scene.DeleteSceneObject(group, false);
476 return; 476 return;
477 } 477 }
478 } 478 }
479 } 479 }
480 } 480 }
481
482 public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos)
483 {
484 // If this is an attachment, then we need to save the modified
485 // object back into the avatar's inventory. First we save the
486 // attachment point information, then we update the relative
487 // positioning (which caused this method to get driven in the
488 // first place. Then we have to mark the object as NOT an
489 // attachment. This is necessary in order to correctly save
490 // and retrieve GroupPosition information for the attachment.
491 // Then we save the asset back into the appropriate inventory
492 // entry. Finally, we restore the object's attachment status.
493 byte attachmentPoint = sog.GetAttachmentPoint();
494 sog.UpdateGroupPosition(pos);
495 sog.RootPart.IsAttachment = false;
496 sog.AbsolutePosition = sog.RootPart.AttachedPos;
497 UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
498 sog.SetAttachmentPoint(attachmentPoint);
499 }
500
501 /// <summary>
502 /// Update the attachment asset for the new sog details if they have changed.
503 /// </summary>
504 ///
505 /// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects,
506 /// these details are not stored on the region.
507 ///
508 /// <param name="remoteClient"></param>
509 /// <param name="grp"></param>
510 /// <param name="itemID"></param>
511 /// <param name="agentID"></param>
512 protected void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
513 {
514 if (grp != null)
515 {
516 if (!grp.HasGroupChanged)
517 {
518 m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID);
519 return;
520 }
521
522 m_log.DebugFormat(
523 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
524 grp.UUID, grp.GetAttachmentPoint());
525
526 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
527
528 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
529 item = m_scene.InventoryService.GetItem(item);
530
531 if (item != null)
532 {
533 AssetBase asset = m_scene.CreateAsset(
534 grp.GetPartName(grp.LocalId),
535 grp.GetPartDescription(grp.LocalId),
536 (sbyte)AssetType.Object,
537 Utils.StringToBytes(sceneObjectXml),
538 remoteClient.AgentId);
539 m_scene.AssetService.Store(asset);
540
541 item.AssetID = asset.FullID;
542 item.Description = asset.Description;
543 item.Name = asset.Name;
544 item.AssetType = asset.Type;
545 item.InvType = (int)InventoryType.Object;
546
547 m_scene.InventoryService.UpdateItem(item);
548
549 // this gets called when the agent logs off!
550 if (remoteClient != null)
551 remoteClient.SendInventoryItemCreateUpdate(item, 0);
552 }
553 }
554 }
481 } 555 }
482} 556} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 7683288..22c84e9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
261 261
262 while (archivePath.Length > 0) 262 while (archivePath.Length > 0)
263 { 263 {
264 m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); 264// m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath);
265 265
266 if (resolvedFolders.ContainsKey(archivePath)) 266 if (resolvedFolders.ContainsKey(archivePath))
267 { 267 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index 84afb40..8343091 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
41 /// </summary> 41 /// </summary>
42 public static class InventoryArchiveUtils 42 public static class InventoryArchiveUtils
43 { 43 {
44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings 46 // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings
47 public static readonly char ESCAPE_CHARACTER = '\\'; 47 public static readonly char ESCAPE_CHARACTER = '\\';
@@ -120,6 +120,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
120 foundFolders.Add(startFolder); 120 foundFolders.Add(startFolder);
121 return foundFolders; 121 return foundFolders;
122 } 122 }
123
124 // If the path isn't just / then trim any starting extraneous slashes
125 path = path.TrimStart(new char[] { PATH_DELIMITER });
126
127// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Adjusted path in FindFolderByPath() is [{0}]", path);
123 128
124 string[] components = SplitEscapedPath(path); 129 string[] components = SplitEscapedPath(path);
125 components[0] = UnescapePath(components[0]); 130 components[0] = UnescapePath(components[0]);
@@ -199,6 +204,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
199 public static InventoryItemBase FindItemByPath( 204 public static InventoryItemBase FindItemByPath(
200 IInventoryService inventoryService, InventoryFolderBase startFolder, string path) 205 IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
201 { 206 {
207 // If the path isn't just / then trim any starting extraneous slashes
208 path = path.TrimStart(new char[] { PATH_DELIMITER });
209
202 string[] components = SplitEscapedPath(path); 210 string[] components = SplitEscapedPath(path);
203 components[0] = UnescapePath(components[0]); 211 components[0] = UnescapePath(components[0]);
204 212
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 25a78ff..9908018 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -221,7 +221,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
221 InventoryItemBase inventoryItem = null; 221 InventoryItemBase inventoryItem = null;
222 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); 222 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
223 223
224 bool foundStar = false; 224 bool saveFolderContentsOnly = false;
225 225
226 // Eliminate double slashes and any leading / on the path. 226 // Eliminate double slashes and any leading / on the path.
227 string[] components 227 string[] components
@@ -234,7 +234,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
234 // folder itself. This may get more sophisicated later on 234 // folder itself. This may get more sophisicated later on
235 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) 235 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
236 { 236 {
237 foundStar = true; 237 saveFolderContentsOnly = true;
238 maxComponentIndex--; 238 maxComponentIndex--;
239 } 239 }
240 240
@@ -281,10 +281,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
281 { 281 {
282 m_log.DebugFormat( 282 m_log.DebugFormat(
283 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", 283 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
284 inventoryFolder.Name, inventoryFolder.ID, m_invPath); 284 inventoryFolder.Name,
285 inventoryFolder.ID,
286 m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath );
285 287
286 //recurse through all dirs getting dirs and files 288 //recurse through all dirs getting dirs and files
287 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar); 289 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly);
288 } 290 }
289 else if (inventoryItem != null) 291 else if (inventoryItem != null)
290 { 292 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 3fb2c8c..0218f86 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -55,12 +55,58 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
55 { 55 {
56 protected ManualResetEvent mre = new ManualResetEvent(false); 56 protected ManualResetEvent mre = new ManualResetEvent(false);
57 57
58 /// <summary>
59 /// Stream of data representing a common IAR that can be reused in load tests.
60 /// </summary>
61 protected MemoryStream m_iarStream;
62
63 protected UserAccount m_ua1
64 = new UserAccount {
65 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
66 FirstName = "Mr",
67 LastName = "Tiddles" };
68 protected UserAccount m_ua2
69 = new UserAccount {
70 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
71 FirstName = "Lord",
72 LastName = "Lucan" };
73 string m_item1Name = "b.lsl";
74
58 private void SaveCompleted( 75 private void SaveCompleted(
59 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, 76 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
60 Exception reportedException) 77 Exception reportedException)
61 { 78 {
62 mre.Set(); 79 mre.Set();
63 } 80 }
81
82 [SetUp]
83 public void Init()
84 {
85 ConstructDefaultIarForTestLoad();
86 }
87
88 protected void ConstructDefaultIarForTestLoad()
89 {
90 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
91
92 MemoryStream archiveWriteStream = new MemoryStream();
93 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
94
95 InventoryItemBase item1 = new InventoryItemBase();
96 item1.Name = m_item1Name;
97 item1.AssetID = UUID.Random();
98 item1.GroupID = UUID.Random();
99 item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName);
100 //item1.CreatorId = userUuid.ToString();
101 //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
102 item1.Owner = UUID.Zero;
103
104 string item1FileName
105 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
106 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
107 tar.Close();
108 m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
109 }
64 110
65 /// <summary> 111 /// <summary>
66 /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive 112 /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
@@ -122,6 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
122 MemoryStream archiveWriteStream = new MemoryStream(); 168 MemoryStream archiveWriteStream = new MemoryStream();
123 archiverModule.OnInventoryArchiveSaved += SaveCompleted; 169 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
124 170
171 // Test saving a particular path
125 mre.Reset(); 172 mre.Reset();
126 archiverModule.ArchiveInventory( 173 archiverModule.ArchiveInventory(
127 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); 174 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
@@ -148,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
148 195
149 while (tar.ReadEntry(out filePath, out tarEntryType) != null) 196 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
150 { 197 {
151 Console.WriteLine("Got {0}", filePath); 198// Console.WriteLine("Got {0}", filePath);
152 199
153// if (ArchiveConstants.CONTROL_FILE_PATH == filePath) 200// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
154// { 201// {
@@ -297,6 +344,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
297 } 344 }
298 345
299 /// <summary> 346 /// <summary>
347 /// Test that things work when the load path specified starts with a slash
348 /// </summary>
349 [Test]
350 public void TestLoadIarPathStartsWithSlash()
351 {
352 TestHelper.InMethod();
353// log4net.Config.XmlConfigurator.Configure();
354
355 SerialiserModule serialiserModule = new SerialiserModule();
356 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
357 Scene scene = SceneSetupHelpers.SetupScene("inventory");
358 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
359
360 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
361 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream);
362
363 InventoryItemBase foundItem1
364 = InventoryArchiveUtils.FindItemByPath(
365 scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name);
366
367 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
368 }
369
370 /// <summary>
300 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 371 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
301 /// an account exists with the creator name. 372 /// an account exists with the creator name.
302 /// </summary> 373 /// </summary>
@@ -308,34 +379,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
308 TestHelper.InMethod(); 379 TestHelper.InMethod();
309 //log4net.Config.XmlConfigurator.Configure(); 380 //log4net.Config.XmlConfigurator.Configure();
310 381
311 string userFirstName = "Mr";
312 string userLastName = "Tiddles";
313 UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555");
314 string userItemCreatorFirstName = "Lord";
315 string userItemCreatorLastName = "Lucan";
316 UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
317
318 string item1Name = "b.lsl";
319 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1Name, UUID.Random());
320
321 MemoryStream archiveWriteStream = new MemoryStream();
322 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
323
324 InventoryItemBase item1 = new InventoryItemBase();
325 item1.Name = item1Name;
326 item1.AssetID = UUID.Random();
327 item1.GroupID = UUID.Random();
328 item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
329 //item1.CreatorId = userUuid.ToString();
330 //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
331 item1.Owner = UUID.Zero;
332
333 string item1FileName
334 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
335 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
336 tar.Close();
337
338 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
339 SerialiserModule serialiserModule = new SerialiserModule(); 382 SerialiserModule serialiserModule = new SerialiserModule();
340 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 383 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
341 384
@@ -344,15 +387,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
344 387
345 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 388 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
346 389
347 UserProfileTestUtils.CreateUserWithInventory( 390 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
348 scene, userFirstName, userLastName, userUuid, "meowfood"); 391 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
349 UserProfileTestUtils.CreateUserWithInventory(
350 scene, userItemCreatorFirstName, userItemCreatorLastName, userItemCreatorUuid, "hampshire");
351 392
352 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); 393 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
353 394
354 InventoryItemBase foundItem1 395 InventoryItemBase foundItem1
355 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, item1Name); 396 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name);
356 397
357 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); 398 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
358 399
@@ -362,31 +403,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
362// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), 403// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
363// "Loaded item non-uuid creator doesn't match original"); 404// "Loaded item non-uuid creator doesn't match original");
364 Assert.That( 405 Assert.That(
365 foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()), 406 foundItem1.CreatorId, Is.EqualTo(m_ua2.PrincipalID.ToString()),
366 "Loaded item non-uuid creator doesn't match original"); 407 "Loaded item non-uuid creator doesn't match original");
367 408
368 Assert.That( 409 Assert.That(
369 foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), 410 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua2.PrincipalID),
370 "Loaded item uuid creator doesn't match original"); 411 "Loaded item uuid creator doesn't match original");
371 Assert.That(foundItem1.Owner, Is.EqualTo(userUuid), 412 Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID),
372 "Loaded item owner doesn't match inventory reciever"); 413 "Loaded item owner doesn't match inventory reciever");
373 414
374 // Now try loading to a root child folder 415 // Now try loading to a root child folder
375 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xA"); 416 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xA");
376 archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); 417 MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
377 archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream); 418 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xA", "meowfood", archiveReadStream);
378 419
379 InventoryItemBase foundItem2 420 InventoryItemBase foundItem2
380 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xA/" + item1Name); 421 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xA/" + m_item1Name);
381 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); 422 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
382 423
383 // Now try loading to a more deeply nested folder 424 // Now try loading to a more deeply nested folder
384 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xB/xC"); 425 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xB/xC");
385 archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); 426 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
386 archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream); 427 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xB/xC", "meowfood", archiveReadStream);
387 428
388 InventoryItemBase foundItem3 429 InventoryItemBase foundItem3
389 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xB/xC/" + item1Name); 430 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xB/xC/" + m_item1Name);
390 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); 431 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
391 } 432 }
392 433
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index ee07f30..314e163 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -200,6 +200,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
200 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", 200 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}",
201 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID); 201 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID);
202 202
203 // Check that these are not the same coordinates
204 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
205 finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY)
206 {
207 // Can't do. Viewer crashes
208 sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again.");
209 return;
210 }
211
203 // 212 //
204 // This is it 213 // This is it
205 // 214 //
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 0c6cb1b..35b70de 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -34,6 +34,7 @@ using System.Threading;
34using log4net; 34using log4net;
35using Nini.Config; 35using Nini.Config;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.Messages.Linden;
37using OpenMetaverse.Packets; 38using OpenMetaverse.Packets;
38using OpenMetaverse.StructuredData; 39using OpenMetaverse.StructuredData;
39using OpenSim.Framework; 40using OpenSim.Framework;
@@ -137,10 +138,11 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
137 { 138 {
138 if (!queues.ContainsKey(agentId)) 139 if (!queues.ContainsKey(agentId))
139 { 140 {
141 /*
140 m_log.DebugFormat( 142 m_log.DebugFormat(
141 "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", 143 "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
142 agentId, m_scene.RegionInfo.RegionName); 144 agentId, m_scene.RegionInfo.RegionName);
143 145 */
144 queues[agentId] = new Queue<OSD>(); 146 queues[agentId] = new Queue<OSD>();
145 } 147 }
146 148
@@ -200,7 +202,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
200 202
201 private void ClientClosed(UUID AgentID, Scene scene) 203 private void ClientClosed(UUID AgentID, Scene scene)
202 { 204 {
203 m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName); 205 //m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName);
204 206
205 int count = 0; 207 int count = 0;
206 while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5) 208 while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5)
@@ -284,7 +286,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
284 // Reuse open queues. The client does! 286 // Reuse open queues. The client does!
285 if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) 287 if (m_AvatarQueueUUIDMapping.ContainsKey(agentID))
286 { 288 {
287 m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); 289 //m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!");
288 EventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; 290 EventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID];
289 } 291 }
290 else 292 else
@@ -365,7 +367,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
365 { 367 {
366 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! 368 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
367 array.Add(EventQueueHelper.KeepAliveEvent()); 369 array.Add(EventQueueHelper.KeepAliveEvent());
368 m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName); 370 //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName);
369 } 371 }
370 else 372 else
371 { 373 {
@@ -394,8 +396,8 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
394 responsedata["keepalive"] = false; 396 responsedata["keepalive"] = false;
395 responsedata["reusecontext"] = false; 397 responsedata["reusecontext"] = false;
396 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events); 398 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
399 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
397 return responsedata; 400 return responsedata;
398 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
399 } 401 }
400 402
401 public Hashtable NoEvents(UUID requestID, UUID agentID) 403 public Hashtable NoEvents(UUID requestID, UUID agentID)
@@ -461,7 +463,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
461 { 463 {
462 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! 464 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
463 array.Add(EventQueueHelper.KeepAliveEvent()); 465 array.Add(EventQueueHelper.KeepAliveEvent());
464 m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); 466 //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName);
465 } 467 }
466 else 468 else
467 { 469 {
@@ -697,9 +699,9 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
697 //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item); 699 //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item);
698 } 700 }
699 701
700 public void ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket, UUID avatarID) 702 public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
701 { 703 {
702 OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesPacket); 704 OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
703 Enqueue(item, avatarID); 705 Enqueue(item, avatarID);
704 } 706 }
705 707
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
index e9bcae3..6294935 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
@@ -30,6 +30,7 @@ using System.Net;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenMetaverse.Packets; 31using OpenMetaverse.Packets;
32using OpenMetaverse.StructuredData; 32using OpenMetaverse.StructuredData;
33using OpenMetaverse.Messages.Linden;
33 34
34namespace OpenSim.Region.CoreModules.Framework.EventQueue 35namespace OpenSim.Region.CoreModules.Framework.EventQueue
35{ 36{
@@ -309,116 +310,6 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
309 return chatterBoxSessionAgentListUpdates; 310 return chatterBoxSessionAgentListUpdates;
310 } 311 }
311 312
312 public static OSD ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket)
313 {
314 OSDMap parcelProperties = new OSDMap();
315 OSDMap body = new OSDMap();
316
317 OSDArray ageVerificationBlock = new OSDArray();
318 OSDMap ageVerificationMap = new OSDMap();
319 ageVerificationMap.Add("RegionDenyAgeUnverified",
320 OSD.FromBoolean(parcelPropertiesPacket.AgeVerificationBlock.RegionDenyAgeUnverified));
321 ageVerificationBlock.Add(ageVerificationMap);
322 body.Add("AgeVerificationBlock", ageVerificationBlock);
323
324 // LL sims send media info in this event queue message but it's not in the UDP
325 // packet we construct this event queue message from. This should be refactored in
326 // other areas of the code so it can all be send in the same message. Until then we will
327 // still send the media info via UDP
328
329 //OSDArray mediaData = new OSDArray();
330 //OSDMap mediaDataMap = new OSDMap();
331 //mediaDataMap.Add("MediaDesc", OSD.FromString(""));
332 //mediaDataMap.Add("MediaHeight", OSD.FromInteger(0));
333 //mediaDataMap.Add("MediaLoop", OSD.FromInteger(0));
334 //mediaDataMap.Add("MediaType", OSD.FromString("type/type"));
335 //mediaDataMap.Add("MediaWidth", OSD.FromInteger(0));
336 //mediaDataMap.Add("ObscureMedia", OSD.FromInteger(0));
337 //mediaDataMap.Add("ObscureMusic", OSD.FromInteger(0));
338 //mediaData.Add(mediaDataMap);
339 //body.Add("MediaData", mediaData);
340
341 OSDArray parcelData = new OSDArray();
342 OSDMap parcelDataMap = new OSDMap();
343 OSDArray AABBMax = new OSDArray(3);
344 AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.X));
345 AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.Y));
346 AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.Z));
347 parcelDataMap.Add("AABBMax", AABBMax);
348
349 OSDArray AABBMin = new OSDArray(3);
350 AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.X));
351 AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.Y));
352 AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.Z));
353 parcelDataMap.Add("AABBMin", AABBMin);
354
355 parcelDataMap.Add("Area", OSD.FromInteger(parcelPropertiesPacket.ParcelData.Area));
356 parcelDataMap.Add("AuctionID", OSD.FromBinary(uintToByteArray(parcelPropertiesPacket.ParcelData.AuctionID)));
357 parcelDataMap.Add("AuthBuyerID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.AuthBuyerID));
358 parcelDataMap.Add("Bitmap", OSD.FromBinary(parcelPropertiesPacket.ParcelData.Bitmap));
359 parcelDataMap.Add("Category", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.Category));
360 parcelDataMap.Add("ClaimDate", OSD.FromInteger(parcelPropertiesPacket.ParcelData.ClaimDate));
361 parcelDataMap.Add("ClaimPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.ClaimPrice));
362 parcelDataMap.Add("Desc", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.Desc)));
363 parcelDataMap.Add("GroupID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.GroupID));
364 parcelDataMap.Add("GroupPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.GroupPrims));
365 parcelDataMap.Add("IsGroupOwned", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.IsGroupOwned));
366 parcelDataMap.Add("LandingType", OSD.FromInteger(parcelPropertiesPacket.ParcelData.LandingType));
367 parcelDataMap.Add("LocalID", OSD.FromInteger(parcelPropertiesPacket.ParcelData.LocalID));
368 parcelDataMap.Add("MaxPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.MaxPrims));
369 parcelDataMap.Add("MediaAutoScale", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.MediaAutoScale));
370 parcelDataMap.Add("MediaID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.MediaID));
371 parcelDataMap.Add("MediaURL", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.MediaURL)));
372 parcelDataMap.Add("MusicURL", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.MusicURL)));
373 parcelDataMap.Add("Name", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.Name)));
374 parcelDataMap.Add("OtherCleanTime", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherCleanTime));
375 parcelDataMap.Add("OtherCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherCount));
376 parcelDataMap.Add("OtherPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherPrims));
377 parcelDataMap.Add("OwnerID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.OwnerID));
378 parcelDataMap.Add("OwnerPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OwnerPrims));
379 parcelDataMap.Add("ParcelFlags", OSD.FromBinary(uintToByteArray(parcelPropertiesPacket.ParcelData.ParcelFlags)));
380 parcelDataMap.Add("ParcelPrimBonus", OSD.FromReal(parcelPropertiesPacket.ParcelData.ParcelPrimBonus));
381 parcelDataMap.Add("PassHours", OSD.FromReal(parcelPropertiesPacket.ParcelData.PassHours));
382 parcelDataMap.Add("PassPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.PassPrice));
383 parcelDataMap.Add("PublicCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.PublicCount));
384 parcelDataMap.Add("RegionDenyAnonymous", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyAnonymous));
385 parcelDataMap.Add("RegionDenyIdentified", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyIdentified));
386 parcelDataMap.Add("RegionDenyTransacted", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyTransacted));
387
388 parcelDataMap.Add("RegionPushOverride", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionPushOverride));
389 parcelDataMap.Add("RentPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.RentPrice));
390 parcelDataMap.Add("RequestResult", OSD.FromInteger(parcelPropertiesPacket.ParcelData.RequestResult));
391 parcelDataMap.Add("SalePrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SalePrice));
392 parcelDataMap.Add("SelectedPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SelectedPrims));
393 parcelDataMap.Add("SelfCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SelfCount));
394 parcelDataMap.Add("SequenceID", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SequenceID));
395 parcelDataMap.Add("SimWideMaxPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SimWideMaxPrims));
396 parcelDataMap.Add("SimWideTotalPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SimWideTotalPrims));
397 parcelDataMap.Add("SnapSelection", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.SnapSelection));
398 parcelDataMap.Add("SnapshotID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.SnapshotID));
399 parcelDataMap.Add("Status", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.Status));
400 parcelDataMap.Add("TotalPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.TotalPrims));
401
402 OSDArray UserLocation = new OSDArray(3);
403 UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.X));
404 UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.Y));
405 UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.Z));
406 parcelDataMap.Add("UserLocation", UserLocation);
407
408 OSDArray UserLookAt = new OSDArray(3);
409 UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.X));
410 UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.Y));
411 UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.Z));
412 parcelDataMap.Add("UserLookAt", UserLookAt);
413
414 parcelData.Add(parcelDataMap);
415 body.Add("ParcelData", parcelData);
416 parcelProperties.Add("body", body);
417 parcelProperties.Add("message", OSD.FromString("ParcelProperties"));
418
419 return parcelProperties;
420 }
421
422 public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket) 313 public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket)
423 { 314 {
424 OSDMap groupUpdate = new OSDMap(); 315 OSDMap groupUpdate = new OSDMap();
@@ -495,5 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
495 return placesReply; 386 return placesReply;
496 } 387 }
497 388
389 public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
390 {
391 OSDMap message = new OSDMap();
392 message.Add("message", OSD.FromString("ParcelProperties"));
393 OSD message_body = parcelPropertiesMessage.Serialize();
394 message.Add("body", message_body);
395 return message;
396 }
397
498 } 398 }
499} 399}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index a402f4f..e51f118 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -243,9 +243,29 @@ namespace OpenSim.Region.CoreModules.World.Archiver
243 // to the same scene (when this is possible). 243 // to the same scene (when this is possible).
244 sceneObject.ResetIDs(); 244 sceneObject.ResetIDs();
245 245
246 List<SceneObjectPart> partList = null;
246 lock (sceneObject.Children) 247 lock (sceneObject.Children)
248 partList = new List<SceneObjectPart>(sceneObject.Children.Values);
249
250 foreach (SceneObjectPart part in partList)
247 { 251 {
248 foreach (SceneObjectPart part in sceneObject.Children.Values) 252 if (!ResolveUserUuid(part.CreatorID))
253 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
254
255 if (!ResolveUserUuid(part.OwnerID))
256 part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
257
258 if (!ResolveUserUuid(part.LastOwnerID))
259 part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
260
261 // And zap any troublesome sit target information
262 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
263 part.SitTargetPosition = new Vector3(0, 0, 0);
264
265 // Fix ownership/creator of inventory items
266 // Not doing so results in inventory items
267 // being no copy/no mod for everyone
268 lock (part.TaskInventory)
249 { 269 {
250 if (!ResolveUserUuid(part.CreatorID)) 270 if (!ResolveUserUuid(part.CreatorID))
251 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; 271 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index d00cb07..776fe30 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -33,6 +33,8 @@ using System.Reflection;
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenMetaverse.StructuredData;
37using OpenMetaverse.Messages.Linden;
36using OpenSim.Framework; 38using OpenSim.Framework;
37using OpenSim.Framework.Capabilities; 39using OpenSim.Framework.Capabilities;
38using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
@@ -1078,7 +1080,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1078 { 1080 {
1079 for (int y = 0; y < inc_y; y++) 1081 for (int y = 0; y < inc_y; y++)
1080 { 1082 {
1081
1082 ILandObject currentParcel = GetLandObject(start_x + x, start_y + y); 1083 ILandObject currentParcel = GetLandObject(start_x + x, start_y + y);
1083 1084
1084 if (currentParcel != null) 1085 if (currentParcel != null)
@@ -1378,8 +1379,68 @@ namespace OpenSim.Region.CoreModules.World.Land
1378 { 1379 {
1379 return RemoteParcelRequest(request, path, param, agentID, caps); 1380 return RemoteParcelRequest(request, path, param, agentID, caps);
1380 })); 1381 }));
1381 } 1382 UUID parcelCapID = UUID.Random();
1383 caps.RegisterHandler("ParcelPropertiesUpdate",
1384 new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
1385 delegate(string request, string path, string param,
1386 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
1387 {
1388 return ProcessPropertiesUpdate(request, path, param, agentID, caps);
1389 }));
1390 }
1391 private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
1392 {
1393 IClientAPI client;
1394 if ( ! m_scene.TryGetClient(agentID, out client) ) {
1395 m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() );
1396 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
1397 }
1398
1399 ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
1400 OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
1401
1402 properties.Deserialize(args);
1403
1404 LandUpdateArgs land_update = new LandUpdateArgs();
1405 int parcelID = properties.LocalID;
1406 land_update.AuthBuyerID = properties.AuthBuyerID;
1407 land_update.Category = properties.Category;
1408 land_update.Desc = properties.Desc;
1409 land_update.GroupID = properties.GroupID;
1410 land_update.LandingType = (byte) properties.Landing;
1411 land_update.MediaAutoScale = (byte) Convert.ToInt32(properties.MediaAutoScale);
1412 land_update.MediaID = properties.MediaID;
1413 land_update.MediaURL = properties.MediaURL;
1414 land_update.MusicURL = properties.MusicURL;
1415 land_update.Name = properties.Name;
1416 land_update.ParcelFlags = (uint) properties.ParcelFlags;
1417 land_update.PassHours = (int) properties.PassHours;
1418 land_update.PassPrice = (int) properties.PassPrice;
1419 land_update.SalePrice = (int) properties.SalePrice;
1420 land_update.SnapshotID = properties.SnapshotID;
1421 land_update.UserLocation = properties.UserLocation;
1422 land_update.UserLookAt = properties.UserLookAt;
1423 land_update.MediaDescription = properties.MediaDesc;
1424 land_update.MediaType = properties.MediaType;
1425 land_update.MediaWidth = properties.MediaWidth;
1426 land_update.MediaHeight = properties.MediaHeight;
1427 land_update.MediaLoop = properties.MediaLoop;
1428 land_update.ObscureMusic = properties.ObscureMusic;
1429 land_update.ObscureMedia = properties.ObscureMedia;
1430
1431 ILandObject land;
1432 lock (m_landList)
1433 {
1434 m_landList.TryGetValue(parcelID, out land);
1435 }
1382 1436
1437 if (land != null) {
1438 land.UpdateLandProperties(land_update, client);
1439 } else {
1440 m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
1441 }
1442 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
1443 }
1383 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the 1444 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
1384 // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. 1445 // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to.
1385 // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x 1446 // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 9e9934e..1b2cabb 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -229,6 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land
229 newData.SnapshotID = args.SnapshotID; 229 newData.SnapshotID = args.SnapshotID;
230 newData.UserLocation = args.UserLocation; 230 newData.UserLocation = args.UserLocation;
231 newData.UserLookAt = args.UserLookAt; 231 newData.UserLookAt = args.UserLookAt;
232 newData.MediaType = args.MediaType;
233 newData.MediaDescription = args.MediaDescription;
234 newData.MediaWidth = args.MediaWidth;
235 newData.MediaHeight = args.MediaHeight;
236 newData.MediaLoop = args.MediaLoop;
237 newData.ObscureMusic = args.ObscureMusic;
238 newData.ObscureMedia = args.ObscureMedia;
232 239
233 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 240 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
234 241
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index 2f70c0a..57eff8a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -228,280 +228,281 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
228 SceneObjectGroup mapdot = (SceneObjectGroup)obj; 228 SceneObjectGroup mapdot = (SceneObjectGroup)obj;
229 Color mapdotspot = Color.Gray; // Default color when prim color is white 229 Color mapdotspot = Color.Gray; // Default color when prim color is white
230 230
231 // Loop over prim in group 231 // Loop over prim in group
232 List<SceneObjectPart> partList = null;
232 lock (mapdot.Children) 233 lock (mapdot.Children)
234 partList = new List<SceneObjectPart>(mapdot.Children.Values);
235
236 foreach (SceneObjectPart part in partList)
233 { 237 {
234 foreach (SceneObjectPart part in mapdot.Children.Values) 238 if (part == null)
239 continue;
240
241 // Draw if the object is at least 1 meter wide in any direction
242 if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f)
235 { 243 {
236 if (part == null) 244 // Try to get the RGBA of the default texture entry..
237 continue; 245 //
238 246 try
239 // Draw if the object is at least 1 meter wide in any direction
240 if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f)
241 { 247 {
242 // Try to get the RGBA of the default texture entry.. 248 // get the null checks out of the way
243 // 249 // skip the ones that break
244 try 250 if (part == null)
251 continue;
252
253 if (part.Shape == null)
254 continue;
255
256 if (part.Shape.PCode == (byte)PCode.Tree || part.Shape.PCode == (byte)PCode.NewTree || part.Shape.PCode == (byte)PCode.Grass)
257 continue; // eliminates trees from this since we don't really have a good tree representation
258 // if you want tree blocks on the map comment the above line and uncomment the below line
259 //mapdotspot = Color.PaleGreen;
260
261 Primitive.TextureEntry textureEntry = part.Shape.Textures;
262
263 if (textureEntry == null || textureEntry.DefaultTexture == null)
264 continue;
265
266 Color4 texcolor = textureEntry.DefaultTexture.RGBA;
267
268 // Not sure why some of these are null, oh well.
269
270 int colorr = 255 - (int)(texcolor.R * 255f);
271 int colorg = 255 - (int)(texcolor.G * 255f);
272 int colorb = 255 - (int)(texcolor.B * 255f);
273
274 if (!(colorr == 255 && colorg == 255 && colorb == 255))
245 { 275 {
246 // get the null checks out of the way 276 //Try to set the map spot color
247 // skip the ones that break 277 try
248 if (part == null) 278 {
249 continue; 279 // If the color gets goofy somehow, skip it *shakes fist at Color4
250 280 mapdotspot = Color.FromArgb(colorr, colorg, colorb);
251 if (part.Shape == null) 281 }
252 continue; 282 catch (ArgumentException)
253
254 if (part.Shape.PCode == (byte)PCode.Tree || part.Shape.PCode == (byte)PCode.NewTree || part.Shape.PCode == (byte)PCode.Grass)
255 continue; // eliminates trees from this since we don't really have a good tree representation
256 // if you want tree blocks on the map comment the above line and uncomment the below line
257 //mapdotspot = Color.PaleGreen;
258
259 Primitive.TextureEntry textureEntry = part.Shape.Textures;
260
261 if (textureEntry == null || textureEntry.DefaultTexture == null)
262 continue;
263
264 Color4 texcolor = textureEntry.DefaultTexture.RGBA;
265
266 // Not sure why some of these are null, oh well.
267
268 int colorr = 255 - (int)(texcolor.R * 255f);
269 int colorg = 255 - (int)(texcolor.G * 255f);
270 int colorb = 255 - (int)(texcolor.B * 255f);
271
272 if (!(colorr == 255 && colorg == 255 && colorb == 255))
273 { 283 {
274 //Try to set the map spot color
275 try
276 {
277 // If the color gets goofy somehow, skip it *shakes fist at Color4
278 mapdotspot = Color.FromArgb(colorr, colorg, colorb);
279 }
280 catch (ArgumentException)
281 {
282 }
283 } 284 }
284 } 285 }
285 catch (IndexOutOfRangeException) 286 }
286 { 287 catch (IndexOutOfRangeException)
287 // Windows Array 288 {
288 } 289 // Windows Array
289 catch (ArgumentOutOfRangeException) 290 }
290 { 291 catch (ArgumentOutOfRangeException)
291 // Mono Array 292 {
292 } 293 // Mono Array
293 294 }
294 Vector3 pos = part.GetWorldPosition(); 295
295 296 Vector3 pos = part.GetWorldPosition();
296 // skip prim outside of retion 297
297 if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f) 298 // skip prim outside of retion
298 continue; 299 if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f)
299 300 continue;
300 // skip prim in non-finite position 301
301 if (Single.IsNaN(pos.X) || Single.IsNaN(pos.Y) || 302 // skip prim in non-finite position
302 Single.IsInfinity(pos.X) || Single.IsInfinity(pos.Y)) 303 if (Single.IsNaN(pos.X) || Single.IsNaN(pos.Y) ||
304 Single.IsInfinity(pos.X) || Single.IsInfinity(pos.Y))
305 continue;
306
307 // Figure out if object is under 256m above the height of the terrain
308 bool isBelow256AboveTerrain = false;
309
310 try
311 {
312 isBelow256AboveTerrain = (pos.Z < ((float)hm[(int)pos.X, (int)pos.Y] + 256f));
313 }
314 catch (Exception)
315 {
316 }
317
318 if (isBelow256AboveTerrain)
319 {
320 // Translate scale by rotation so scale is represented properly when object is rotated
321 Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z);
322 Vector3 scale = new Vector3();
323 Vector3 tScale = new Vector3();
324 Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z);
325
326 Quaternion llrot = part.GetWorldRotation();
327 Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z);
328 scale = lscale * rot;
329
330 // negative scales don't work in this situation
331 scale.X = Math.Abs(scale.X);
332 scale.Y = Math.Abs(scale.Y);
333 scale.Z = Math.Abs(scale.Z);
334
335 // This scaling isn't very accurate and doesn't take into account the face rotation :P
336 int mapdrawstartX = (int)(pos.X - scale.X);
337 int mapdrawstartY = (int)(pos.Y - scale.Y);
338 int mapdrawendX = (int)(pos.X + scale.X);
339 int mapdrawendY = (int)(pos.Y + scale.Y);
340
341 // If object is beyond the edge of the map, don't draw it to avoid errors
342 if (mapdrawstartX < 0 || mapdrawstartX > ((int)Constants.RegionSize - 1) || mapdrawendX < 0 || mapdrawendX > ((int)Constants.RegionSize - 1)
343 || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0
344 || mapdrawendY > ((int)Constants.RegionSize - 1))
303 continue; 345 continue;
304 346
305 // Figure out if object is under 256m above the height of the terrain 347#region obb face reconstruction part duex
306 bool isBelow256AboveTerrain = false; 348 Vector3[] vertexes = new Vector3[8];
307 349
308 try 350 // float[] distance = new float[6];
309 { 351 Vector3[] FaceA = new Vector3[6]; // vertex A for Facei
310 isBelow256AboveTerrain = (pos.Z < ((float)hm[(int)pos.X, (int)pos.Y] + 256f)); 352 Vector3[] FaceB = new Vector3[6]; // vertex B for Facei
311 } 353 Vector3[] FaceC = new Vector3[6]; // vertex C for Facei
312 catch (Exception) 354 Vector3[] FaceD = new Vector3[6]; // vertex D for Facei
355
356 tScale = new Vector3(lscale.X, -lscale.Y, lscale.Z);
357 scale = ((tScale * rot));
358 vertexes[0] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
359 // vertexes[0].x = pos.X + vertexes[0].x;
360 //vertexes[0].y = pos.Y + vertexes[0].y;
361 //vertexes[0].z = pos.Z + vertexes[0].z;
362
363 FaceA[0] = vertexes[0];
364 FaceB[3] = vertexes[0];
365 FaceA[4] = vertexes[0];
366
367 tScale = lscale;
368 scale = ((tScale * rot));
369 vertexes[1] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
370
371 // vertexes[1].x = pos.X + vertexes[1].x;
372 // vertexes[1].y = pos.Y + vertexes[1].y;
373 //vertexes[1].z = pos.Z + vertexes[1].z;
374
375 FaceB[0] = vertexes[1];
376 FaceA[1] = vertexes[1];
377 FaceC[4] = vertexes[1];
378
379 tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z);
380 scale = ((tScale * rot));
381
382 vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
383
384 //vertexes[2].x = pos.X + vertexes[2].x;
385 //vertexes[2].y = pos.Y + vertexes[2].y;
386 //vertexes[2].z = pos.Z + vertexes[2].z;
387
388 FaceC[0] = vertexes[2];
389 FaceD[3] = vertexes[2];
390 FaceC[5] = vertexes[2];
391
392 tScale = new Vector3(lscale.X, lscale.Y, -lscale.Z);
393 scale = ((tScale * rot));
394 vertexes[3] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
395
396 //vertexes[3].x = pos.X + vertexes[3].x;
397 // vertexes[3].y = pos.Y + vertexes[3].y;
398 // vertexes[3].z = pos.Z + vertexes[3].z;
399
400 FaceD[0] = vertexes[3];
401 FaceC[1] = vertexes[3];
402 FaceA[5] = vertexes[3];
403
404 tScale = new Vector3(-lscale.X, lscale.Y, lscale.Z);
405 scale = ((tScale * rot));
406 vertexes[4] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
407
408 // vertexes[4].x = pos.X + vertexes[4].x;
409 // vertexes[4].y = pos.Y + vertexes[4].y;
410 // vertexes[4].z = pos.Z + vertexes[4].z;
411
412 FaceB[1] = vertexes[4];
413 FaceA[2] = vertexes[4];
414 FaceD[4] = vertexes[4];
415
416 tScale = new Vector3(-lscale.X, lscale.Y, -lscale.Z);
417 scale = ((tScale * rot));
418 vertexes[5] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
419
420 // vertexes[5].x = pos.X + vertexes[5].x;
421 // vertexes[5].y = pos.Y + vertexes[5].y;
422 // vertexes[5].z = pos.Z + vertexes[5].z;
423
424 FaceD[1] = vertexes[5];
425 FaceC[2] = vertexes[5];
426 FaceB[5] = vertexes[5];
427
428 tScale = new Vector3(-lscale.X, -lscale.Y, lscale.Z);
429 scale = ((tScale * rot));
430 vertexes[6] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
431
432 // vertexes[6].x = pos.X + vertexes[6].x;
433 // vertexes[6].y = pos.Y + vertexes[6].y;
434 // vertexes[6].z = pos.Z + vertexes[6].z;
435
436 FaceB[2] = vertexes[6];
437 FaceA[3] = vertexes[6];
438 FaceB[4] = vertexes[6];
439
440 tScale = new Vector3(-lscale.X, -lscale.Y, -lscale.Z);
441 scale = ((tScale * rot));
442 vertexes[7] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
443
444 // vertexes[7].x = pos.X + vertexes[7].x;
445 // vertexes[7].y = pos.Y + vertexes[7].y;
446 // vertexes[7].z = pos.Z + vertexes[7].z;
447
448 FaceD[2] = vertexes[7];
449 FaceC[3] = vertexes[7];
450 FaceD[5] = vertexes[7];
451#endregion
452
453 //int wy = 0;
454
455 //bool breakYN = false; // If we run into an error drawing, break out of the
456 // loop so we don't lag to death on error handling
457 DrawStruct ds = new DrawStruct();
458 ds.brush = new SolidBrush(mapdotspot);
459 //ds.rect = new Rectangle(mapdrawstartX, (255 - mapdrawstartY), mapdrawendX - mapdrawstartX, mapdrawendY - mapdrawstartY);
460
461 ds.trns = new face[FaceA.Length];
462
463 for (int i = 0; i < FaceA.Length; i++)
313 { 464 {
465 Point[] working = new Point[5];
466 working[0] = project(FaceA[i], axPos);
467 working[1] = project(FaceB[i], axPos);
468 working[2] = project(FaceD[i], axPos);
469 working[3] = project(FaceC[i], axPos);
470 working[4] = project(FaceA[i], axPos);
471
472 face workingface = new face();
473 workingface.pts = working;
474
475 ds.trns[i] = workingface;
314 } 476 }
315 477
316 if (isBelow256AboveTerrain) 478 z_sort.Add(part.LocalId, ds);
317 { 479 z_localIDs.Add(part.LocalId);
318 // Translate scale by rotation so scale is represented properly when object is rotated 480 z_sortheights.Add(pos.Z);
319 Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z); 481
320 Vector3 scale = new Vector3(); 482 //for (int wx = mapdrawstartX; wx < mapdrawendX; wx++)
321 Vector3 tScale = new Vector3(); 483 //{
322 Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z); 484 //for (wy = mapdrawstartY; wy < mapdrawendY; wy++)
323
324 Quaternion llrot = part.GetWorldRotation();
325 Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z);
326 scale = lscale * rot;
327
328 // negative scales don't work in this situation
329 scale.X = Math.Abs(scale.X);
330 scale.Y = Math.Abs(scale.Y);
331 scale.Z = Math.Abs(scale.Z);
332
333 // This scaling isn't very accurate and doesn't take into account the face rotation :P
334 int mapdrawstartX = (int)(pos.X - scale.X);
335 int mapdrawstartY = (int)(pos.Y - scale.Y);
336 int mapdrawendX = (int)(pos.X + scale.X);
337 int mapdrawendY = (int)(pos.Y + scale.Y);
338
339 // If object is beyond the edge of the map, don't draw it to avoid errors
340 if (mapdrawstartX < 0 || mapdrawstartX > ((int)Constants.RegionSize - 1) || mapdrawendX < 0 || mapdrawendX > ((int)Constants.RegionSize - 1)
341 || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0
342 || mapdrawendY > ((int)Constants.RegionSize - 1))
343 continue;
344
345 #region obb face reconstruction part duex
346 Vector3[] vertexes = new Vector3[8];
347
348 // float[] distance = new float[6];
349 Vector3[] FaceA = new Vector3[6]; // vertex A for Facei
350 Vector3[] FaceB = new Vector3[6]; // vertex B for Facei
351 Vector3[] FaceC = new Vector3[6]; // vertex C for Facei
352 Vector3[] FaceD = new Vector3[6]; // vertex D for Facei
353
354 tScale = new Vector3(lscale.X, -lscale.Y, lscale.Z);
355 scale = ((tScale * rot));
356 vertexes[0] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
357 // vertexes[0].x = pos.X + vertexes[0].x;
358 //vertexes[0].y = pos.Y + vertexes[0].y;
359 //vertexes[0].z = pos.Z + vertexes[0].z;
360
361 FaceA[0] = vertexes[0];
362 FaceB[3] = vertexes[0];
363 FaceA[4] = vertexes[0];
364
365 tScale = lscale;
366 scale = ((tScale * rot));
367 vertexes[1] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
368
369 // vertexes[1].x = pos.X + vertexes[1].x;
370 // vertexes[1].y = pos.Y + vertexes[1].y;
371 //vertexes[1].z = pos.Z + vertexes[1].z;
372
373 FaceB[0] = vertexes[1];
374 FaceA[1] = vertexes[1];
375 FaceC[4] = vertexes[1];
376
377 tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z);
378 scale = ((tScale * rot));
379
380 vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
381
382 //vertexes[2].x = pos.X + vertexes[2].x;
383 //vertexes[2].y = pos.Y + vertexes[2].y;
384 //vertexes[2].z = pos.Z + vertexes[2].z;
385
386 FaceC[0] = vertexes[2];
387 FaceD[3] = vertexes[2];
388 FaceC[5] = vertexes[2];
389
390 tScale = new Vector3(lscale.X, lscale.Y, -lscale.Z);
391 scale = ((tScale * rot));
392 vertexes[3] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
393
394 //vertexes[3].x = pos.X + vertexes[3].x;
395 // vertexes[3].y = pos.Y + vertexes[3].y;
396 // vertexes[3].z = pos.Z + vertexes[3].z;
397
398 FaceD[0] = vertexes[3];
399 FaceC[1] = vertexes[3];
400 FaceA[5] = vertexes[3];
401
402 tScale = new Vector3(-lscale.X, lscale.Y, lscale.Z);
403 scale = ((tScale * rot));
404 vertexes[4] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
405
406 // vertexes[4].x = pos.X + vertexes[4].x;
407 // vertexes[4].y = pos.Y + vertexes[4].y;
408 // vertexes[4].z = pos.Z + vertexes[4].z;
409
410 FaceB[1] = vertexes[4];
411 FaceA[2] = vertexes[4];
412 FaceD[4] = vertexes[4];
413
414 tScale = new Vector3(-lscale.X, lscale.Y, -lscale.Z);
415 scale = ((tScale * rot));
416 vertexes[5] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
417
418 // vertexes[5].x = pos.X + vertexes[5].x;
419 // vertexes[5].y = pos.Y + vertexes[5].y;
420 // vertexes[5].z = pos.Z + vertexes[5].z;
421
422 FaceD[1] = vertexes[5];
423 FaceC[2] = vertexes[5];
424 FaceB[5] = vertexes[5];
425
426 tScale = new Vector3(-lscale.X, -lscale.Y, lscale.Z);
427 scale = ((tScale * rot));
428 vertexes[6] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
429
430 // vertexes[6].x = pos.X + vertexes[6].x;
431 // vertexes[6].y = pos.Y + vertexes[6].y;
432 // vertexes[6].z = pos.Z + vertexes[6].z;
433
434 FaceB[2] = vertexes[6];
435 FaceA[3] = vertexes[6];
436 FaceB[4] = vertexes[6];
437
438 tScale = new Vector3(-lscale.X, -lscale.Y, -lscale.Z);
439 scale = ((tScale * rot));
440 vertexes[7] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
441
442 // vertexes[7].x = pos.X + vertexes[7].x;
443 // vertexes[7].y = pos.Y + vertexes[7].y;
444 // vertexes[7].z = pos.Z + vertexes[7].z;
445
446 FaceD[2] = vertexes[7];
447 FaceC[3] = vertexes[7];
448 FaceD[5] = vertexes[7];
449 #endregion
450
451 //int wy = 0;
452
453 //bool breakYN = false; // If we run into an error drawing, break out of the
454 // loop so we don't lag to death on error handling
455 DrawStruct ds = new DrawStruct();
456 ds.brush = new SolidBrush(mapdotspot);
457 //ds.rect = new Rectangle(mapdrawstartX, (255 - mapdrawstartY), mapdrawendX - mapdrawstartX, mapdrawendY - mapdrawstartY);
458
459 ds.trns = new face[FaceA.Length];
460
461 for (int i = 0; i < FaceA.Length; i++)
462 {
463 Point[] working = new Point[5];
464 working[0] = project(FaceA[i], axPos);
465 working[1] = project(FaceB[i], axPos);
466 working[2] = project(FaceD[i], axPos);
467 working[3] = project(FaceC[i], axPos);
468 working[4] = project(FaceA[i], axPos);
469
470 face workingface = new face();
471 workingface.pts = working;
472
473 ds.trns[i] = workingface;
474 }
475
476 z_sort.Add(part.LocalId, ds);
477 z_localIDs.Add(part.LocalId);
478 z_sortheights.Add(pos.Z);
479
480 //for (int wx = mapdrawstartX; wx < mapdrawendX; wx++)
481 //{ 485 //{
482 //for (wy = mapdrawstartY; wy < mapdrawendY; wy++) 486 //m_log.InfoFormat("[MAPDEBUG]: {0},{1}({2})", wx, (255 - wy),wy);
487 //try
483 //{ 488 //{
484 //m_log.InfoFormat("[MAPDEBUG]: {0},{1}({2})", wx, (255 - wy),wy); 489 // Remember, flip the y!
485 //try 490 // mapbmp.SetPixel(wx, (255 - wy), mapdotspot);
486 //{
487 // Remember, flip the y!
488 // mapbmp.SetPixel(wx, (255 - wy), mapdotspot);
489 //}
490 //catch (ArgumentException)
491 //{
492 // breakYN = true;
493 //}
494
495 //if (breakYN)
496 // break;
497 //} 491 //}
498 492 //catch (ArgumentException)
493 //{
494 // breakYN = true;
495 //}
496
499 //if (breakYN) 497 //if (breakYN)
500 // break; 498 // break;
501 //} 499 //}
502 } // Object is within 256m Z of terrain 500
503 } // object is at least a meter wide 501 //if (breakYN)
504 } // mapdot.Children lock 502 // break;
503 //}
504 } // Object is within 256m Z of terrain
505 } // object is at least a meter wide
505 } // loop over group children 506 } // loop over group children
506 } // entitybase is sceneobject group 507 } // entitybase is sceneobject group
507 } // foreach loop over entities 508 } // foreach loop over entities