aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-30 22:25:38 +0100
committerJustin Clark-Casey (justincc)2011-08-30 22:25:38 +0100
commit1de68b34d959570c6dc5de42e8dac5e36f960273 (patch)
tree8c3aaf917e8e1433b10bf92c74e7d44d8a30a7b3
parentminor: comment out friends number logging from login for now (diff)
downloadopensim-SC_OLD-1de68b34d959570c6dc5de42e8dac5e36f960273.zip
opensim-SC_OLD-1de68b34d959570c6dc5de42e8dac5e36f960273.tar.gz
opensim-SC_OLD-1de68b34d959570c6dc5de42e8dac5e36f960273.tar.bz2
opensim-SC_OLD-1de68b34d959570c6dc5de42e8dac5e36f960273.tar.xz
refactor: migrate DropObject handling fully into AttachmentsModule from Scene
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs21
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs7
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs7
6 files changed, 17 insertions, 30 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index a0d10ed..150ff1b 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Framework
51 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 51 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
52 bool RezSelected, bool RemoveItem, UUID fromTaskID); 52 bool RezSelected, bool RemoveItem, UUID fromTaskID);
53 53
54 public delegate UUID RezSingleAttachmentFromInv(IClientAPI remoteClient, UUID itemID, uint AttachmentPt); 54 public delegate ISceneEntity RezSingleAttachmentFromInv(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
55 55
56 public delegate void RezMultipleAttachmentsFromInv(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, 56 public delegate void RezMultipleAttachmentsFromInv(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
57 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects); 57 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects);
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index b7a7f77..02fd387 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private Scene m_scene = null; 49 private Scene m_scene;
50 private IDialogModule m_dialogModule; 50 private IDialogModule m_dialogModule;
51 51
52 public string Name { get { return "Attachments Module"; } } 52 public string Name { get { return "Attachments Module"; } }
@@ -83,6 +83,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
83 client.OnObjectAttach += AttachObject; 83 client.OnObjectAttach += AttachObject;
84 client.OnObjectDetach += DetachObject; 84 client.OnObjectDetach += DetachObject;
85 client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv; 85 client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv;
86 client.OnObjectDrop += DetachSingleAttachmentToGround;
86 } 87 }
87 88
88 public void UnsubscribeFromClientEvents(IClientAPI client) 89 public void UnsubscribeFromClientEvents(IClientAPI client)
@@ -92,6 +93,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
92 client.OnObjectAttach -= AttachObject; 93 client.OnObjectAttach -= AttachObject;
93 client.OnObjectDetach -= DetachObject; 94 client.OnObjectDetach -= DetachObject;
94 client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv; 95 client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv;
96 client.OnObjectDrop -= DetachSingleAttachmentToGround;
95 } 97 }
96 98
97 /// <summary> 99 /// <summary>
@@ -250,12 +252,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
250 } 252 }
251 } 253 }
252 254
253 public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 255 public ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
254 { 256 {
255 return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true); 257 return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true);
256 } 258 }
257 259
258 public UUID RezSingleAttachmentFromInventory( 260 public ISceneEntity RezSingleAttachmentFromInventory(
259 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) 261 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus)
260 { 262 {
261// m_log.DebugFormat( 263// m_log.DebugFormat(
@@ -269,7 +271,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
269 m_log.ErrorFormat( 271 m_log.ErrorFormat(
270 "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()", 272 "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()",
271 remoteClient.Name, remoteClient.AgentId); 273 remoteClient.Name, remoteClient.AgentId);
272 return UUID.Zero; 274 return null;
273 } 275 }
274 276
275 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should 277 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
@@ -286,10 +288,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
286 ShowAttachInUserInventory(att, sp, itemID, AttachmentPt); 288 ShowAttachInUserInventory(att, sp, itemID, AttachmentPt);
287 } 289 }
288 290
289 if (null == att) 291 return att;
290 return UUID.Zero;
291 else
292 return att.UUID;
293 } 292 }
294 293
295 private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( 294 private SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
@@ -449,13 +448,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
449 } 448 }
450 } 449 }
451 450
452 public void DetachSingleAttachmentToGround(UUID sceneObjectID, IClientAPI remoteClient) 451 public void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient)
453 { 452 {
454// m_log.DebugFormat( 453// m_log.DebugFormat(
455// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", 454// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}",
456// remoteClient.Name, sceneObjectID); 455// remoteClient.Name, sceneObjectID);
457 456
458 SceneObjectGroup so = m_scene.GetSceneObjectGroup(sceneObjectID); 457 SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId);
459 458
460 if (so == null) 459 if (so == null)
461 return; 460 return;
@@ -489,7 +488,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
489 remoteClient.SendRemoveInventoryItem(inventoryID); 488 remoteClient.SendRemoveInventoryItem(inventoryID);
490 } 489 }
491 490
492 m_scene.EventManager.TriggerOnAttach(so.LocalId, sceneObjectID, UUID.Zero); 491 m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero);
493 } 492 }
494 493
495 /// <summary> 494 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index b1f9197..b0146a1 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -168,12 +168,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
168 UserInventoryHelpers.CreateInventoryItem( 168 UserInventoryHelpers.CreateInventoryItem(
169 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); 169 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
170 170
171// Check item status 171 ISceneEntity so = m_attMod.RezSingleAttachmentFromInventory(
172 Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItemId)), Is.Not.Null);
173
174 UUID attSoId = m_attMod.RezSingleAttachmentFromInventory(
175 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); 172 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
176 m_attMod.DetachSingleAttachmentToGround(attSoId, m_presence.ControllingClient); 173 m_attMod.DetachSingleAttachmentToGround(so.LocalId, m_presence.ControllingClient);
177 174
178 // Check scene presence status 175 // Check scene presence status
179 Assert.That(m_presence.HasAttachments(), Is.False); 176 Assert.That(m_presence.HasAttachments(), Is.False);
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 86f5a0f..c910289 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Interfaces
64 /// <param name="itemID"></param> 64 /// <param name="itemID"></param>
65 /// <param name="AttachmentPt"></param> 65 /// <param name="AttachmentPt"></param>
66 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> 66 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
67 UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt); 67 ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
68 68
69 /// <summary> 69 /// <summary>
70 /// Rez an attachment from user inventory 70 /// Rez an attachment from user inventory
@@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Interfaces
77 /// False is required so that we don't attempt to update information when a user enters a scene with the 77 /// False is required so that we don't attempt to update information when a user enters a scene with the
78 /// attachment already correctly set up in inventory. 78 /// attachment already correctly set up in inventory.
79 /// <returns>The uuid of the scene object that was attached. Null if the scene object could not be found</returns> 79 /// <returns>The uuid of the scene object that was attached. Null if the scene object could not be found</returns>
80 UUID RezSingleAttachmentFromInventory( 80 ISceneEntity RezSingleAttachmentFromInventory(
81 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus); 81 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus);
82 82
83 /// <summary> 83 /// <summary>
@@ -105,9 +105,9 @@ namespace OpenSim.Region.Framework.Interfaces
105 /// <summary> 105 /// <summary>
106 /// Detach the given item to the ground. 106 /// Detach the given item to the ground.
107 /// </summary> 107 /// </summary>
108 /// <param name="sceneObjectID"></param> 108 /// <param name="objectLocalID"></param>
109 /// <param name="remoteClient"></param> 109 /// <param name="remoteClient"></param>
110 void DetachSingleAttachmentToGround(UUID sceneObjectID, IClientAPI remoteClient); 110 void DetachSingleAttachmentToGround(uint objectLocalID, IClientAPI remoteClient);
111 111
112 /// <summary> 112 /// <summary>
113 /// Detach the given item so that it remains in the user's inventory. 113 /// Detach the given item so that it remains in the user's inventory.
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 45d1a0e..e0250de 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2772,7 +2772,6 @@ namespace OpenSim.Region.Framework.Scenes
2772 client.OnUndo += m_sceneGraph.HandleUndo; 2772 client.OnUndo += m_sceneGraph.HandleUndo;
2773 client.OnRedo += m_sceneGraph.HandleRedo; 2773 client.OnRedo += m_sceneGraph.HandleRedo;
2774 client.OnObjectDescription += m_sceneGraph.PrimDescription; 2774 client.OnObjectDescription += m_sceneGraph.PrimDescription;
2775 client.OnObjectDrop += m_sceneGraph.DropObject;
2776 client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; 2775 client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable;
2777 client.OnObjectOwner += ObjectOwner; 2776 client.OnObjectOwner += ObjectOwner;
2778 } 2777 }
@@ -2899,7 +2898,6 @@ namespace OpenSim.Region.Framework.Scenes
2899 client.OnUndo -= m_sceneGraph.HandleUndo; 2898 client.OnUndo -= m_sceneGraph.HandleUndo;
2900 client.OnRedo -= m_sceneGraph.HandleRedo; 2899 client.OnRedo -= m_sceneGraph.HandleRedo;
2901 client.OnObjectDescription -= m_sceneGraph.PrimDescription; 2900 client.OnObjectDescription -= m_sceneGraph.PrimDescription;
2902 client.OnObjectDrop -= m_sceneGraph.DropObject;
2903 client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable; 2901 client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable;
2904 client.OnObjectOwner -= ObjectOwner; 2902 client.OnObjectOwner -= ObjectOwner;
2905 } 2903 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 0582586..76ed55c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -548,13 +548,6 @@ namespace OpenSim.Region.Framework.Scenes
548 m_activeScripts += number; 548 m_activeScripts += number;
549 } 549 }
550 550
551 public void DropObject(uint objectLocalID, IClientAPI remoteClient)
552 {
553 SceneObjectGroup group = GetGroupByPrim(objectLocalID);
554 if (group != null)
555 m_parentScene.AttachmentsModule.DetachSingleAttachmentToGround(group.UUID, remoteClient);
556 }
557
558 protected internal void HandleUndo(IClientAPI remoteClient, UUID primId) 551 protected internal void HandleUndo(IClientAPI remoteClient, UUID primId)
559 { 552 {
560 if (primId != UUID.Zero) 553 if (primId != UUID.Zero)