Rather than iterating through all SOGs in the scene looking for the one that matches out fromItemID on detach, go through the agent's attachment sog list instead.

0.7.4.1
Justin Clark-Casey (justincc) 2012-06-28 23:01:12 +01:00
parent f263d6a910
commit 571fd966cb
1 changed files with 14 additions and 21 deletions

View File

@ -666,18 +666,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (itemID == UUID.Zero) // If this happened, someone made a mistake.... if (itemID == UUID.Zero) // If this happened, someone made a mistake....
return; return;
// We can NOT use the dictionries here, as we are looking
// for an entity by the fromAssetID, which is NOT the prim UUID
EntityBase[] detachEntities = m_scene.GetEntities();
SceneObjectGroup group;
lock (sp.AttachmentsSyncLock) lock (sp.AttachmentsSyncLock)
{ {
foreach (EntityBase entity in detachEntities) List<SceneObjectGroup> attachments = sp.GetAttachments();
foreach (SceneObjectGroup group in attachments)
{ {
if (entity is SceneObjectGroup)
{
group = (SceneObjectGroup)entity;
if (group.FromItemID == itemID) if (group.FromItemID == itemID)
{ {
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
@ -697,7 +691,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
} }
} }
} }
}
private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( private SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt) IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt)