From 71797af540bfa1ccb1ccfe856b42350844531607 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 5 Mar 2010 23:35:49 +0000 Subject: [PATCH] refactor: move another AttachObject method --- .../Avatar/Attachments/AttachmentsModule.cs | 47 ++++++++++++++++++- .../Framework/Scenes/Scene.Inventory.cs | 44 ----------------- 2 files changed, 46 insertions(+), 45 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 0ea1f63168..530a21ce70 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -112,7 +112,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments itemId = group.GetFromItemID(); } - m_scene.AttachObject(remoteClient, AttachmentPt, itemId, group); + SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group); group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); @@ -167,5 +167,50 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return att.UUID; } + + /// + /// Update the user inventory to reflect an attachment + /// + /// + /// + /// + /// + public void SetAttachmentInventoryStatus( + IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) + { +// m_log.DebugFormat( +// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", +// att.Name, remoteClient.Name, AttachmentPt, itemID); + + if (UUID.Zero == itemID) + { + m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID."); + return; + } + + if (0 == AttachmentPt) + { + m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error attachment point."); + return; + } + + if (null == att.RootPart) + { + m_log.Error("[SCENE INVENTORY]: Unable to save attachment for a prim without the rootpart!"); + return; + } + + ScenePresence presence; + if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) + { + // XXYY!! + InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); + item = m_scene.InventoryService.GetItem(item); + presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); + + if (m_scene.AvatarFactory != null) + m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); + } + } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6a5dc56276..bd3b433b5b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1874,50 +1874,6 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// This registers the item as attached in a user's inventory - /// - /// - /// - /// - /// - public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) - { -// m_log.DebugFormat( -// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", -// att.Name, remoteClient.Name, AttachmentPt, itemID); - - if (UUID.Zero == itemID) - { - m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID."); - return; - } - - if (0 == AttachmentPt) - { - m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error attachment point."); - return; - } - - if (null == att.RootPart) - { - m_log.Error("[SCENE INVENTORY]: Unable to save attachment for a prim without the rootpart!"); - return; - } - - ScenePresence presence; - if (TryGetAvatar(remoteClient.AgentId, out presence)) - { - // XXYY!! - InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); - item = InventoryService.GetItem(item); - presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); - - if (m_AvatarFactory != null) - m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); - } - } - public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) { SceneObjectPart part = GetSceneObjectPart(itemID);