From 658524311307561a133451753daceff493d3cdad Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 8 Nov 2010 02:35:47 +0000 Subject: Detach attachments displaced by other attachments --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index e89368a..9c1154b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -178,12 +178,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments UUID itemID = UUID.Zero; if (sp != null) { - foreach (SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) + foreach(SceneObjectGroup grp in sp.Attachments) { - itemID = grp.GetFromItemID(); - if (itemID != UUID.Zero) - DetachSingleAttachmentToInv(itemID, remoteClient); + if (grp.GetAttachmentPoint() == (byte)AttachmentPt) + { + itemID = grp.GetFromItemID(); + break; + } } + if (itemID != UUID.Zero) + DetachSingleAttachmentToInv(itemID, remoteClient); } if (group.GetFromItemID() == UUID.Zero) -- cgit v1.1 From 2317b6767beb1c171a8a9b087510ad4111ec0a01 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 24 Aug 2010 18:20:24 +0200 Subject: Add a method to delete left over / dropped attachments --- OpenSim/Region/Framework/Scenes/Scene.cs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3343d08..be01d44 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4984,5 +4984,37 @@ namespace OpenSim.Region.Framework.Scenes throw new Exception(error); } } + + public void CleanDroppedAttachments() + { + List objectsToDelete = + new List(); + + ForEachSOG(delegate (SceneObjectGroup grp) + { + if (grp.RootPart.Shape.State != 0) + { + UUID agentID = grp.OwnerID; + if (agentID == UUID.Zero) + { + objectsToDelete.Add(grp); + return; + } + + ScenePresence sp = GetScenePresence(agentID); + if (sp == null) + { + objectsToDelete.Add(grp); + return; + } + } + }); + + foreach (SceneObjectGroup grp in objectsToDelete) + { + m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); + DeleteSceneObject(grp, true); + } + } } } -- cgit v1.1 From d8fffd0fb573d7ca27c1eac311c11b969190ce23 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 24 Aug 2010 18:38:54 +0200 Subject: Call attachment cleanup when an agent crosses out --- .../Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 485e05a..b5cab84 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -459,6 +459,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Now let's make it officially a child agent sp.MakeChildAgent(); + sp.Scene.CleanDroppedAttachments(); + // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) -- cgit v1.1 From 2f58d561371ed93202c276dfe0c359fcf6f70358 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 8 Nov 2010 02:37:28 +0000 Subject: Call the Cleanup when an agent logs out, when an agent leaves and just before an agent logs in directly. Intentionally not calling this from MakeRoot as that would mess up attachment transfer in teleport --- OpenSim/Region/Framework/Scenes/Scene.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index be01d44..dd817ce 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3154,6 +3154,7 @@ namespace OpenSim.Region.Framework.Scenes } m_eventManager.TriggerClientClosed(agentID, this); + CleanDroppedAttachments(); } catch (NullReferenceException) { @@ -3408,6 +3409,8 @@ namespace OpenSim.Region.Framework.Scenes if (vialogin) { + CleanDroppedAttachments(); + if (TestBorderCross(agent.startpos, Cardinals.E)) { Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); -- cgit v1.1 From 4f6dd8bda38a2b336506e24f8c41c8d8ebe2d69b Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 8 Nov 2010 02:38:15 +0000 Subject: Call the cleanup after saving attachment states, so that the attachments don't get killed before they can be saved --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index dd817ce..77d7472 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3154,7 +3154,6 @@ namespace OpenSim.Region.Framework.Scenes } m_eventManager.TriggerClientClosed(agentID, this); - CleanDroppedAttachments(); } catch (NullReferenceException) { @@ -3163,6 +3162,9 @@ namespace OpenSim.Region.Framework.Scenes } m_eventManager.TriggerOnRemovePresence(agentID); + + CleanDroppedAttachments(); + ForEachClient( delegate(IClientAPI client) { -- cgit v1.1 From 18b27408d6af27a3880298c6f3acdaef3fb7d030 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 8 Nov 2010 02:39:06 +0000 Subject: Prevent plants from being treated like dropped attachments and removed from the sim. --- OpenSim/Region/Framework/Scenes/Scene.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 77d7472..3576a88 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4999,8 +4999,7 @@ namespace OpenSim.Region.Framework.Scenes { if (grp.RootPart.Shape.State != 0) { - UUID agentID = grp.OwnerID; - if (agentID == UUID.Zero) + if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) { objectsToDelete.Add(grp); return; -- cgit v1.1 From 6056ae8d88ad683ff20cbef918df99c3ad3728f4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 8 Nov 2010 02:58:33 +0000 Subject: Fix merge artefacts --- OpenSim/Region/Framework/Scenes/Scene.cs | 33 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3576a88..3fc195a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -174,6 +174,7 @@ namespace OpenSim.Region.Framework.Scenes private bool m_firstHeartbeat = true; private object m_deleting_scene_object = new object(); + private object m_cleaningAttachments = new object(); private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; private bool m_reprioritizationEnabled = true; @@ -4995,25 +4996,29 @@ namespace OpenSim.Region.Framework.Scenes List objectsToDelete = new List(); - ForEachSOG(delegate (SceneObjectGroup grp) - { - if (grp.RootPart.Shape.State != 0) + lock (m_cleaningAttachments) + { + ForEachSOG(delegate (SceneObjectGroup grp) { if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) { - objectsToDelete.Add(grp); - return; + UUID agentID = grp.OwnerID; + if (agentID == UUID.Zero) + { + objectsToDelete.Add(grp); + return; + } + + ScenePresence sp = GetScenePresence(agentID); + if (sp == null) + { + objectsToDelete.Add(grp); + return; + } } + }); + } - ScenePresence sp = GetScenePresence(agentID); - if (sp == null) - { - objectsToDelete.Add(grp); - return; - } - } - }); - foreach (SceneObjectGroup grp in objectsToDelete) { m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); -- cgit v1.1