diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 36 |
1 files changed, 17 insertions, 19 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) |