From b72c2dc6e88fa2ea6bb97e0b32d0cdbb2ea78c4a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 5 Mar 2010 23:29:24 +0000
Subject: refactor: move user inventory side of RezSingleAttachment to module
---
.../Avatar/Attachments/AttachmentsModule.cs | 30 ++++++++++++++++++++++
.../Framework/Interfaces/IAttachmentsModule.cs | 12 +++++++++
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 30 +---------------------
3 files changed, 43 insertions(+), 29 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 103a813..0ea1f63 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -137,5 +137,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return true;
}
+
+ ///
+ /// Update the user inventory to reflect an attachment
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public UUID SetAttachmentInventoryStatus(
+ SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
+ {
+ m_log.DebugFormat(
+ "[USER INVENTORY]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
+ remoteClient.Name, att.Name, itemID);
+
+ if (!att.IsDeleted)
+ AttachmentPt = att.RootPart.AttachmentPoint;
+
+ ScenePresence presence;
+ if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence))
+ {
+ InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
+ item = m_scene.InventoryService.GetItem(item);
+
+ presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
+ }
+
+ return att.UUID;
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index c965bcf..5e5df4b 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -28,6 +28,7 @@
using System;
using OpenMetaverse;
using OpenSim.Framework;
+using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces
{
@@ -45,5 +46,16 @@ namespace OpenSim.Region.Framework.Interfaces
/// true if the object was successfully attached, false otherwise
bool AttachObject(
IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent);
+
+ ///
+ /// Update the user inventory to the attachment of an item
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ UUID SetAttachmentInventoryStatus(
+ SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
}
}
\ 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 474fba9..6a5dc56 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1862,35 +1862,7 @@ namespace OpenSim.Region.Framework.Scenes
return UUID.Zero;
}
- return RezSingleAttachment(att, remoteClient, itemID, AttachmentPt);
- }
-
- ///
- /// Update the user inventory to reflect an attachment
- ///
- ///
- ///
- ///
- ///
- ///
- public UUID RezSingleAttachment(SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
- {
- m_log.DebugFormat(
- "[USER INVENTORY]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
- remoteClient.Name, att.Name, itemID);
-
- if (!att.IsDeleted)
- AttachmentPt = att.RootPart.AttachmentPoint;
-
- ScenePresence presence;
- if (TryGetAvatar(remoteClient.AgentId, out presence))
- {
- InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
- item = InventoryService.GetItem(item);
-
- presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
- }
- return att.UUID;
+ return AttachmentsModule.SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt);
}
public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
--
cgit v1.1