aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-03-29 23:10:28 +0000
committerJustin Clark-Casey (justincc)2013-03-29 23:10:28 +0000
commit023faa227ef72a3701dc5fbfc46ab5f831c54953 (patch)
tree6563150f8c610eb721baa56fce859567713f8c59 /OpenSim/Region
parentFix bug where CHANGED_REGION and/or CHANGED_TELEPORT weren't firing for scrip... (diff)
downloadopensim-SC_OLD-023faa227ef72a3701dc5fbfc46ab5f831c54953.zip
opensim-SC_OLD-023faa227ef72a3701dc5fbfc46ab5f831c54953.tar.gz
opensim-SC_OLD-023faa227ef72a3701dc5fbfc46ab5f831c54953.tar.bz2
opensim-SC_OLD-023faa227ef72a3701dc5fbfc46ab5f831c54953.tar.xz
Check viewer 2/3 attachment calls against avatar appearance attachment data rather than actually attached objects
By checking against the grid's Avatar data, we can ignore viewer side attachments but still initiate these calls simulator-side. Initiating simulator-side is always necessary for version 1 viewers. This is a further commit to resolve http://opensimulator.org/mantis/view.php?id=6581
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs36
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs7
3 files changed, 23 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 29a6478..4b53ee0 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -256,10 +256,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
256 { 256 {
257 // If we're an NPC then skip all the item checks and manipulations since we don't have an 257 // If we're an NPC then skip all the item checks and manipulations since we don't have an
258 // inventory right now. 258 // inventory right now.
259 if (sp.PresenceType == PresenceType.Npc) 259 RezSingleAttachmentFromInventoryInternal(
260 RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, true); 260 sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, p | (uint)0x80);
261 else
262 RezSingleAttachmentFromInventory(sp, attach.ItemID, p | (uint)0x80);
263 } 261 }
264 catch (Exception e) 262 catch (Exception e)
265 { 263 {
@@ -456,26 +454,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
456 "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2} in {3}", 454 "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2} in {3}",
457 (AttachmentPoint)AttachmentPt, itemID, sp.Name, m_scene.Name); 455 (AttachmentPoint)AttachmentPt, itemID, sp.Name, m_scene.Name);
458 456
459 bool append = (AttachmentPt & 0x80) != 0; 457 // We check the attachments in the avatar appearance here rather than the objects attached to the
460 AttachmentPt &= 0x7f; 458 // ScenePresence itself so that we can ignore calls by viewer 2/3 to attach objects on startup. We are
461 459 // already doing this in ScenePresence.MakeRootAgent(). Simulator-side attaching needs to be done
462 // Viewer 2/3 sometimes asks to re-wear items that are already worn (and show up in it's inventory as such). 460 // because pre-outfit folder viewers (most version 1 viewers) require it.
463 // This often happens during login - not sure the exact reason.
464 // For now, we will ignore the request. Unfortunately, this means that we need to dig through all the
465 // ScenePresence attachments. We can't use the data in AvatarAppearance because that's present at login
466 // before anything has actually been attached.
467 bool alreadyOn = false; 461 bool alreadyOn = false;
468 List<SceneObjectGroup> existingAttachments = sp.GetAttachments(); 462 List<AvatarAttachment> existingAttachments = sp.Appearance.GetAttachments();
469 foreach (SceneObjectGroup so in existingAttachments) 463 foreach (AvatarAttachment existingAttachment in existingAttachments)
470 { 464 {
471 if (so.FromItemID == itemID) 465 if (existingAttachment.ItemID == itemID)
472 { 466 {
473 alreadyOn = true; 467 alreadyOn = true;
474 break; 468 break;
475 } 469 }
476 } 470 }
477 471
478// if (sp.Appearance.GetAttachmentForItem(itemID) != null)
479 if (alreadyOn) 472 if (alreadyOn)
480 { 473 {
481 if (DebugLevel > 0) 474 if (DebugLevel > 0)
@@ -486,7 +479,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
486 return null; 479 return null;
487 } 480 }
488 481
489 return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, append); 482 return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt);
490 } 483 }
491 484
492 public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist) 485 public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist)
@@ -495,7 +488,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
495 return; 488 return;
496 489
497 if (DebugLevel > 0) 490 if (DebugLevel > 0)
498 m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name); 491 m_log.DebugFormat(
492 "[ATTACHMENTS MODULE]: Rezzing {0} attachments from inventory for {1} in {2}",
493 rezlist.Count, sp.Name, m_scene.Name);
499 494
500 foreach (KeyValuePair<UUID, uint> rez in rezlist) 495 foreach (KeyValuePair<UUID, uint> rez in rezlist)
501 { 496 {
@@ -894,11 +889,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
894 } 889 }
895 890
896 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( 891 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
897 IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, bool append) 892 IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt)
898 { 893 {
899 if (m_invAccessModule == null) 894 if (m_invAccessModule == null)
900 return null; 895 return null;
901 896
897 bool append = (attachmentPt & 0x80) != 0;
898 attachmentPt &= 0x7f;
899
902 SceneObjectGroup objatt; 900 SceneObjectGroup objatt;
903 901
904 if (itemID != UUID.Zero) 902 if (itemID != UUID.Zero)
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 6e4262e..25444e5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -130,7 +130,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
130 config.AddConfig("Modules"); 130 config.AddConfig("Modules");
131 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); 131 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
132 132
133 modules.Add(new AttachmentsModule()); 133 AttachmentsModule attMod = new AttachmentsModule();
134 attMod.DebugLevel = 1;
135 modules.Add(attMod);
134 modules.Add(new BasicInventoryAccessModule()); 136 modules.Add(new BasicInventoryAccessModule());
135 } 137 }
136 138
@@ -728,7 +730,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
728 public void TestRezAttachmentsOnAvatarEntrance() 730 public void TestRezAttachmentsOnAvatarEntrance()
729 { 731 {
730 TestHelpers.InMethod(); 732 TestHelpers.InMethod();
731// log4net.Config.XmlConfigurator.Configure(); 733// TestHelpers.EnableLogging();
732 734
733 Scene scene = CreateTestScene(); 735 Scene scene = CreateTestScene();
734 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); 736 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4930a39..215a689 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -955,15 +955,12 @@ namespace OpenSim.Region.Framework.Scenes
955 { 955 {
956 // Viewers which have a current outfit folder will actually rez their own attachments. However, 956 // Viewers which have a current outfit folder will actually rez their own attachments. However,
957 // viewers without (e.g. v1 viewers) will not, so we still need to make this call. 957 // viewers without (e.g. v1 viewers) will not, so we still need to make this call.
958 //
959 // However, we leave a 5 second pause to try and avoid a clash with viewers that are rezzing
960 // attachments themselves. This should then mean that this call ends up doing nothing.
961 if (Scene.AttachmentsModule != null) 958 if (Scene.AttachmentsModule != null)
962 Util.FireAndForget( 959 Util.FireAndForget(
963 o => 960 o =>
964 { 961 {
965 if (PresenceType != PresenceType.Npc && Util.FireAndForgetMethod != FireAndForgetMethod.None) 962// if (PresenceType != PresenceType.Npc && Util.FireAndForgetMethod != FireAndForgetMethod.None)
966 System.Threading.Thread.Sleep(5000); 963// System.Threading.Thread.Sleep(7000);
967 964
968 Scene.AttachmentsModule.RezAttachments(this); 965 Scene.AttachmentsModule.RezAttachments(this);
969 }); 966 });