diff options
Diffstat (limited to 'OpenSim')
3 files changed, 25 insertions, 8 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index ab4ed66..7c6295d 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -383,9 +383,11 @@ namespace OpenSim.Framework | |||
383 | // DEBUG OFF | 383 | // DEBUG OFF |
384 | 384 | ||
385 | /// <summary> | 385 | /// <summary> |
386 | /// Get a list of the attachments, note that there may be | 386 | /// Get a list of the attachments. |
387 | /// duplicate attachpoints | ||
388 | /// </summary> | 387 | /// </summary> |
388 | /// <remarks> | ||
389 | /// There may be duplicate attachpoints | ||
390 | /// </remarks> | ||
389 | public List<AvatarAttachment> GetAttachments() | 391 | public List<AvatarAttachment> GetAttachments() |
390 | { | 392 | { |
391 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); | 393 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); |
@@ -487,6 +489,7 @@ namespace OpenSim.Framework | |||
487 | // And remove the list if there are no more attachments here | 489 | // And remove the list if there are no more attachments here |
488 | if (m_attachments[kvp.Key].Count == 0) | 490 | if (m_attachments[kvp.Key].Count == 0) |
489 | m_attachments.Remove(kvp.Key); | 491 | m_attachments.Remove(kvp.Key); |
492 | |||
490 | return true; | 493 | return true; |
491 | } | 494 | } |
492 | } | 495 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2d5eb18..b7a7f77 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -451,6 +451,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
451 | 451 | ||
452 | public void DetachSingleAttachmentToGround(UUID sceneObjectID, IClientAPI remoteClient) | 452 | public void DetachSingleAttachmentToGround(UUID sceneObjectID, IClientAPI remoteClient) |
453 | { | 453 | { |
454 | // m_log.DebugFormat( | ||
455 | // "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", | ||
456 | // remoteClient.Name, sceneObjectID); | ||
457 | |||
454 | SceneObjectGroup so = m_scene.GetSceneObjectGroup(sceneObjectID); | 458 | SceneObjectGroup so = m_scene.GetSceneObjectGroup(sceneObjectID); |
455 | 459 | ||
456 | if (so == null) | 460 | if (so == null) |
@@ -461,6 +465,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
461 | 465 | ||
462 | UUID inventoryID = so.GetFromItemID(); | 466 | UUID inventoryID = so.GetFromItemID(); |
463 | 467 | ||
468 | // m_log.DebugFormat( | ||
469 | // "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}", | ||
470 | // so.Name, so.LocalId, inventoryID); | ||
471 | |||
464 | ScenePresence presence; | 472 | ScenePresence presence; |
465 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 473 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
466 | { | 474 | { |
@@ -468,7 +476,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
468 | so.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) | 476 | so.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) |
469 | return; | 477 | return; |
470 | 478 | ||
471 | bool changed = presence.Appearance.DetachAttachment(sceneObjectID); | 479 | bool changed = presence.Appearance.DetachAttachment(inventoryID); |
472 | if (changed && m_scene.AvatarFactory != null) | 480 | if (changed && m_scene.AvatarFactory != null) |
473 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); | 481 | m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); |
474 | 482 | ||
@@ -485,7 +493,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
485 | } | 493 | } |
486 | 494 | ||
487 | /// <summary> | 495 | /// <summary> |
488 | /// Detach the given scene objet to the ground. | 496 | /// Detach the given scene object to the ground. |
489 | /// </summary> | 497 | /// </summary> |
490 | /// <remarks> | 498 | /// <remarks> |
491 | /// The caller has to take care of all the other work in updating avatar appearance, inventory, etc. | 499 | /// The caller has to take care of all the other work in updating avatar appearance, inventory, etc. |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index bb53601..b1f9197 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
138 | m_attMod.RezSingleAttachmentFromInventory( | 138 | m_attMod.RezSingleAttachmentFromInventory( |
139 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); | 139 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); |
140 | 140 | ||
141 | // Check status on scene presence | 141 | // Check scene presence status |
142 | Assert.That(m_presence.HasAttachments(), Is.True); | 142 | Assert.That(m_presence.HasAttachments(), Is.True); |
143 | List<SceneObjectGroup> attachments = m_presence.Attachments; | 143 | List<SceneObjectGroup> attachments = m_presence.Attachments; |
144 | Assert.That(attachments.Count, Is.EqualTo(1)); | 144 | Assert.That(attachments.Count, Is.EqualTo(1)); |
@@ -149,12 +149,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
149 | Assert.That(attSo.UsesPhysics, Is.False); | 149 | Assert.That(attSo.UsesPhysics, Is.False); |
150 | Assert.That(attSo.IsTemporary, Is.False); | 150 | Assert.That(attSo.IsTemporary, Is.False); |
151 | 151 | ||
152 | // Check item status | 152 | // Check appearance status |
153 | Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest)); | 153 | Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest)); |
154 | } | 154 | } |
155 | 155 | ||
156 | [Test] | 156 | [Test] |
157 | public void TestDetachAttachmentToScene() | 157 | public void TestDetachAttachmentToGround() |
158 | { | 158 | { |
159 | TestHelpers.InMethod(); | 159 | TestHelpers.InMethod(); |
160 | // log4net.Config.XmlConfigurator.Configure(); | 160 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -168,15 +168,21 @@ 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 | ||
172 | Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItemId)), Is.Not.Null); | ||
173 | |||
171 | UUID attSoId = m_attMod.RezSingleAttachmentFromInventory( | 174 | UUID attSoId = m_attMod.RezSingleAttachmentFromInventory( |
172 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); | 175 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); |
173 | m_attMod.DetachSingleAttachmentToGround(attSoId, m_presence.ControllingClient); | 176 | m_attMod.DetachSingleAttachmentToGround(attSoId, m_presence.ControllingClient); |
174 | 177 | ||
175 | // Check status on scene presence | 178 | // Check scene presence status |
176 | Assert.That(m_presence.HasAttachments(), Is.False); | 179 | Assert.That(m_presence.HasAttachments(), Is.False); |
177 | List<SceneObjectGroup> attachments = m_presence.Attachments; | 180 | List<SceneObjectGroup> attachments = m_presence.Attachments; |
178 | Assert.That(attachments.Count, Is.EqualTo(0)); | 181 | Assert.That(attachments.Count, Is.EqualTo(0)); |
179 | 182 | ||
183 | // Check appearance status | ||
184 | Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(0)); | ||
185 | |||
180 | // Check item status | 186 | // Check item status |
181 | Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItemId)), Is.Null); | 187 | Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItemId)), Is.Null); |
182 | 188 | ||