diff options
author | Justin Clark-Casey (justincc) | 2010-03-12 23:20:38 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-03-12 23:20:38 +0000 |
commit | 315fa06c75d023ef3e4285842dd730a4d94b78d6 (patch) | |
tree | 370ec91ab832e2f24e57c17cf32aea5baa84953d /OpenSim | |
parent | Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-315fa06c75d023ef3e4285842dd730a4d94b78d6.zip opensim-SC-315fa06c75d023ef3e4285842dd730a4d94b78d6.tar.gz opensim-SC-315fa06c75d023ef3e4285842dd730a4d94b78d6.tar.bz2 opensim-SC-315fa06c75d023ef3e4285842dd730a4d94b78d6.tar.xz |
refactor: Move another RezSingleAttachment() from Scene.Inventory to AttachmentsModule
Diffstat (limited to 'OpenSim')
5 files changed, 57 insertions, 37 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 084f3c9..f54e41a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -169,7 +169,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
169 | return true; | 169 | return true; |
170 | } | 170 | } |
171 | 171 | ||
172 | public SceneObjectGroup RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 172 | public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) |
173 | { | ||
174 | m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name); | ||
175 | |||
176 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true); | ||
177 | } | ||
178 | |||
179 | public UUID RezSingleAttachmentFromInventory( | ||
180 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | ||
181 | { | ||
182 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | ||
183 | |||
184 | if (updateInventoryStatus) | ||
185 | { | ||
186 | if (att == null) | ||
187 | { | ||
188 | ShowDetachInUserInventory(itemID, remoteClient); | ||
189 | } | ||
190 | |||
191 | SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt); | ||
192 | } | ||
193 | |||
194 | if (null == att) | ||
195 | return UUID.Zero; | ||
196 | else | ||
197 | return att.UUID; | ||
198 | } | ||
199 | |||
200 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | ||
201 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
173 | { | 202 | { |
174 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 203 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
175 | if (invAccess != null) | 204 | if (invAccess != null) |
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 1fa77e4..0222b02 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -59,13 +59,27 @@ namespace OpenSim.Region.Framework.Interfaces | |||
59 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent); | 59 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent); |
60 | 60 | ||
61 | /// <summary> | 61 | /// <summary> |
62 | /// Rez an attachment from user inventory | 62 | /// Rez an attachment from user inventory and change inventory status to match. |
63 | /// </summary> | 63 | /// </summary> |
64 | /// <param name="remoteClient"></param> | 64 | /// <param name="remoteClient"></param> |
65 | /// <param name="itemID"></param> | 65 | /// <param name="itemID"></param> |
66 | /// <param name="AttachmentPt"></param> | 66 | /// <param name="AttachmentPt"></param> |
67 | /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> | 67 | /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> |
68 | SceneObjectGroup RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt); | 68 | UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt); |
69 | |||
70 | /// <summary> | ||
71 | /// Rez an attachment from user inventory | ||
72 | /// </summary> | ||
73 | /// <param name="remoteClient"></param> | ||
74 | /// <param name="itemID"></param> | ||
75 | /// <param name="AttachmentPt"></param> | ||
76 | /// <param name="updateinventoryStatus"> | ||
77 | /// If true, we also update the user's inventory to show that the attachment is set. If false, we do not. | ||
78 | /// False is required so that we don't attempt to update information when a user enters a scene with the | ||
79 | /// attachment already correctly set up in inventory. | ||
80 | /// <returns>The uuid of the scene object that was attached. Null if the scene object could not be found</returns> | ||
81 | UUID RezSingleAttachmentFromInventory( | ||
82 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus); | ||
69 | 83 | ||
70 | /// <summary> | 84 | /// <summary> |
71 | /// Update the user inventory to the attachment of an item | 85 | /// Update the user inventory to the attachment of an item |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index dcd92d6..41533a1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1842,35 +1842,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1842 | EventManager.TriggerOnAttach(localID, itemID, avatarID); | 1842 | EventManager.TriggerOnAttach(localID, itemID, avatarID); |
1843 | } | 1843 | } |
1844 | 1844 | ||
1845 | /// <summary> | ||
1846 | /// Called when the client receives a request to rez a single attachment on to the avatar from inventory | ||
1847 | /// (RezSingleAttachmentFromInv packet). | ||
1848 | /// </summary> | ||
1849 | /// <param name="remoteClient"></param> | ||
1850 | /// <param name="itemID"></param> | ||
1851 | /// <param name="AttachmentPt"></param> | ||
1852 | /// <returns></returns> | ||
1853 | public UUID RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
1854 | { | ||
1855 | m_log.DebugFormat("[USER INVENTORY]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name); | ||
1856 | |||
1857 | SceneObjectGroup att = AttachmentsModule.RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt); | ||
1858 | |||
1859 | if (att == null) | ||
1860 | { | ||
1861 | AttachmentsModule.ShowDetachInUserInventory(itemID, remoteClient); | ||
1862 | return UUID.Zero; | ||
1863 | } | ||
1864 | |||
1865 | return AttachmentsModule.SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt); | ||
1866 | } | ||
1867 | |||
1868 | public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, | 1845 | public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, |
1869 | RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects) | 1846 | RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects) |
1870 | { | 1847 | { |
1871 | foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects) | 1848 | foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects) |
1872 | { | 1849 | { |
1873 | RezSingleAttachment(remoteClient, obj.ItemID, obj.AttachmentPt); | 1850 | AttachmentsModule.RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt); |
1874 | } | 1851 | } |
1875 | } | 1852 | } |
1876 | 1853 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 50553dd..c510dc8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2642,13 +2642,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2642 | } | 2642 | } |
2643 | 2643 | ||
2644 | public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) | 2644 | public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) |
2645 | { | 2645 | { |
2646 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; | ||
2647 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; | 2646 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; |
2648 | client.OnObjectDetach += m_sceneGraph.DetachObject; | 2647 | client.OnObjectDetach += m_sceneGraph.DetachObject; |
2649 | 2648 | ||
2650 | if (AttachmentsModule != null) | 2649 | if (AttachmentsModule != null) |
2651 | { | 2650 | { |
2651 | client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory; | ||
2652 | client.OnObjectAttach += AttachmentsModule.AttachObject; | 2652 | client.OnObjectAttach += AttachmentsModule.AttachObject; |
2653 | client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory; | 2653 | client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory; |
2654 | } | 2654 | } |
@@ -2799,12 +2799,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2799 | 2799 | ||
2800 | public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) | 2800 | public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) |
2801 | { | 2801 | { |
2802 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; | 2802 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; |
2803 | client.OnRezSingleAttachmentFromInv -= RezSingleAttachment; | ||
2804 | client.OnObjectDetach -= m_sceneGraph.DetachObject; | 2803 | client.OnObjectDetach -= m_sceneGraph.DetachObject; |
2805 | 2804 | ||
2806 | if (AttachmentsModule != null) | 2805 | if (AttachmentsModule != null) |
2807 | { | 2806 | { |
2807 | client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory; | ||
2808 | client.OnObjectAttach -= AttachmentsModule.AttachObject; | 2808 | client.OnObjectAttach -= AttachmentsModule.AttachObject; |
2809 | client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory; | 2809 | client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory; |
2810 | } | 2810 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7661f1e..317c908 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3738,7 +3738,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3738 | { | 3738 | { |
3739 | if (null == m_appearance) | 3739 | if (null == m_appearance) |
3740 | { | 3740 | { |
3741 | m_log.WarnFormat("[ATTACHMENT] Appearance has not been initialized for agent {0}", UUID); | 3741 | m_log.WarnFormat("[ATTACHMENT]: Appearance has not been initialized for agent {0}", UUID); |
3742 | return; | 3742 | return; |
3743 | } | 3743 | } |
3744 | 3744 | ||
@@ -3762,12 +3762,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3762 | try | 3762 | try |
3763 | { | 3763 | { |
3764 | // Rez from inventory | 3764 | // Rez from inventory |
3765 | UUID asset = m_scene.RezSingleAttachment(ControllingClient, | 3765 | UUID asset |
3766 | itemID, (uint)p); | 3766 | = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p); |
3767 | |||
3768 | m_log.InfoFormat("[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})", | ||
3769 | p, itemID, assetID, asset); | ||
3770 | 3767 | ||
3768 | m_log.InfoFormat( | ||
3769 | "[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})", | ||
3770 | p, itemID, assetID, asset); | ||
3771 | } | 3771 | } |
3772 | catch (Exception e) | 3772 | catch (Exception e) |
3773 | { | 3773 | { |