diff options
5 files changed, 60 insertions, 58 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 3c2cc42..084f3c9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -168,6 +168,52 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
168 | 168 | ||
169 | return true; | 169 | return true; |
170 | } | 170 | } |
171 | |||
172 | public SceneObjectGroup RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
173 | { | ||
174 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | ||
175 | if (invAccess != null) | ||
176 | { | ||
177 | SceneObjectGroup objatt = invAccess.RezObject(remoteClient, | ||
178 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
179 | false, false, remoteClient.AgentId, true); | ||
180 | |||
181 | // m_log.DebugFormat( | ||
182 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | ||
183 | // objatt.Name, remoteClient.Name, AttachmentPt); | ||
184 | |||
185 | if (objatt != null) | ||
186 | { | ||
187 | bool tainted = false; | ||
188 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) | ||
189 | tainted = true; | ||
190 | |||
191 | AttachObject( | ||
192 | remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); | ||
193 | //objatt.ScheduleGroupForFullUpdate(); | ||
194 | |||
195 | if (tainted) | ||
196 | objatt.HasGroupChanged = true; | ||
197 | |||
198 | // Fire after attach, so we don't get messy perms dialogs | ||
199 | // 3 == AttachedRez | ||
200 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); | ||
201 | |||
202 | // Do this last so that event listeners have access to all the effects of the attachment | ||
203 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | ||
204 | } | ||
205 | else | ||
206 | { | ||
207 | m_log.WarnFormat( | ||
208 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | ||
209 | itemID, remoteClient.Name, AttachmentPt); | ||
210 | } | ||
211 | |||
212 | return objatt; | ||
213 | } | ||
214 | |||
215 | return null; | ||
216 | } | ||
171 | 217 | ||
172 | public UUID SetAttachmentInventoryStatus( | 218 | public UUID SetAttachmentInventoryStatus( |
173 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 219 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) |
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 21c1056..1fa77e4 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -56,7 +56,16 @@ namespace OpenSim.Region.Framework.Interfaces | |||
56 | /// <param name="silent"></param> | 56 | /// <param name="silent"></param> |
57 | /// <returns>true if the object was successfully attached, false otherwise</returns> | 57 | /// <returns>true if the object was successfully attached, false otherwise</returns> |
58 | bool AttachObject( | 58 | bool AttachObject( |
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 | |||
61 | /// <summary> | ||
62 | /// Rez an attachment from user inventory | ||
63 | /// </summary> | ||
64 | /// <param name="remoteClient"></param> | ||
65 | /// <param name="itemID"></param> | ||
66 | /// <param name="AttachmentPt"></param> | ||
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); | ||
60 | 69 | ||
61 | /// <summary> | 70 | /// <summary> |
62 | /// Update the user inventory to the attachment of an item | 71 | /// 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 7277527..dcd92d6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1854,7 +1854,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1854 | { | 1854 | { |
1855 | m_log.DebugFormat("[USER INVENTORY]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name); | 1855 | m_log.DebugFormat("[USER INVENTORY]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name); |
1856 | 1856 | ||
1857 | SceneObjectGroup att = m_sceneGraph.RezSingleAttachment(remoteClient, itemID, AttachmentPt); | 1857 | SceneObjectGroup att = AttachmentsModule.RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt); |
1858 | 1858 | ||
1859 | if (att == null) | 1859 | if (att == null) |
1860 | { | 1860 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d4d134f..50553dd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2338,10 +2338,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2338 | //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID); | 2338 | //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID); |
2339 | 2339 | ||
2340 | ScenePresence sp = GetScenePresence(userID); | 2340 | ScenePresence sp = GetScenePresence(userID); |
2341 | if (sp != null) | 2341 | if (sp != null && AttachmentsModule != null) |
2342 | { | 2342 | { |
2343 | uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); | 2343 | uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); |
2344 | m_sceneGraph.RezSingleAttachment(sp.ControllingClient, itemID, attPt); | 2344 | AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt); |
2345 | } | 2345 | } |
2346 | 2346 | ||
2347 | return false; | 2347 | return false; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index a88d456..d944834 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -486,59 +486,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
486 | } | 486 | } |
487 | } | 487 | } |
488 | 488 | ||
489 | /// <summary> | ||
490 | /// Rez an attachment | ||
491 | /// </summary> | ||
492 | /// <param name="remoteClient"></param> | ||
493 | /// <param name="itemID"></param> | ||
494 | /// <param name="AttachmentPt"></param> | ||
495 | /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> | ||
496 | public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
497 | { | ||
498 | IInventoryAccessModule invAccess = m_parentScene.RequestModuleInterface<IInventoryAccessModule>(); | ||
499 | if (invAccess != null) | ||
500 | { | ||
501 | SceneObjectGroup objatt = invAccess.RezObject(remoteClient, | ||
502 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
503 | false, false, remoteClient.AgentId, true); | ||
504 | |||
505 | // m_log.DebugFormat( | ||
506 | // "[SCENE GRAPH]: Retrieved single object {0} for attachment to {1} on point {2}", | ||
507 | // objatt.Name, remoteClient.Name, AttachmentPt); | ||
508 | |||
509 | if (objatt != null) | ||
510 | { | ||
511 | bool tainted = false; | ||
512 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) | ||
513 | tainted = true; | ||
514 | |||
515 | m_parentScene.AttachmentsModule.AttachObject( | ||
516 | remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); | ||
517 | //objatt.ScheduleGroupForFullUpdate(); | ||
518 | |||
519 | if (tainted) | ||
520 | objatt.HasGroupChanged = true; | ||
521 | |||
522 | // Fire after attach, so we don't get messy perms dialogs | ||
523 | // 3 == AttachedRez | ||
524 | objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3); | ||
525 | |||
526 | // Do this last so that event listeners have access to all the effects of the attachment | ||
527 | m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | ||
528 | } | ||
529 | else | ||
530 | { | ||
531 | m_log.WarnFormat( | ||
532 | "[SCENE GRAPH]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | ||
533 | itemID, remoteClient.Name, AttachmentPt); | ||
534 | } | ||
535 | |||
536 | return objatt; | ||
537 | } | ||
538 | |||
539 | return null; | ||
540 | } | ||
541 | |||
542 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) | 489 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) |
543 | { | 490 | { |
544 | ScenePresence newAvatar = null; | 491 | ScenePresence newAvatar = null; |