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.
parent
f263d6a910
commit
571fd966cb
|
@ -666,34 +666,27 @@ 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)
|
if (group.FromItemID == itemID)
|
||||||
{
|
{
|
||||||
group = (SceneObjectGroup)entity;
|
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
|
||||||
if (group.FromItemID == itemID)
|
sp.RemoveAttachment(group);
|
||||||
{
|
m_scene.DeleteSceneObject(group, false);
|
||||||
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
|
|
||||||
sp.RemoveAttachment(group);
|
|
||||||
m_scene.DeleteSceneObject(group, false);
|
|
||||||
|
|
||||||
// Prepare sog for storage
|
// Prepare sog for storage
|
||||||
group.AttachedAvatar = UUID.Zero;
|
group.AttachedAvatar = UUID.Zero;
|
||||||
group.RootPart.SetParentLocalId(0);
|
group.RootPart.SetParentLocalId(0);
|
||||||
group.IsAttachment = false;
|
group.IsAttachment = false;
|
||||||
group.AbsolutePosition = group.RootPart.AttachedPos;
|
group.AbsolutePosition = group.RootPart.AttachedPos;
|
||||||
|
|
||||||
UpdateKnownItem(sp, group, true);
|
UpdateKnownItem(sp, group, true);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue