From 7d58b5fa157b4c3e842573d9fb02a9822034f4b0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 31 Aug 2011 17:53:58 +0100
Subject: move common code into AttachmentsModule.DeleteAttachmentsFromScene()
---
.../Region/Framework/Interfaces/IAttachmentsModule.cs | 9 +++++++++
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 17 +++++++++++++++--
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 +-------------
3 files changed, 25 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index ce795f1..dd11ded 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -48,6 +48,15 @@ namespace OpenSim.Region.Framework.Interfaces
void SaveChangedAttachments(IScenePresence sp);
///
+ /// Delete all the presence's attachments from the scene
+ ///
+ ///
+ /// This is done when a root agent leaves/is demoted to child (for instance, on logout, teleport or region cross).
+ ///
+ ///
+ void DeleteAttachmentsFromScene(IScenePresence sp, bool silent);
+
+ ///
/// Attach an object to an avatar from the world.
///
///
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index 788b36f..91e4bf2 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -62,9 +62,22 @@ namespace OpenSim.Region.Framework.Interfaces
/// A copy of the list.
///
///
- /// Do not change this list directly - use methods such as
- /// AddAttachment() and RemoveAttachment().
+ /// Do not change this list directly - use the attachments module.
///
List GetAttachments();
+
+ ///
+ /// The scene objects attached to this avatar at a specific attachment point.
+ ///
+ ///
+ ///
+ List GetAttachments(uint attachmentPoint);
+
+ bool HasAttachments();
+
+ // Don't use these methods directly. Instead, use the AttachmentsModule
+ void AddAttachment(SceneObjectGroup gobj);
+ void RemoveAttachment(SceneObjectGroup gobj);
+ void ClearAttachments();
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5e96b0a..0d284a5 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3401,19 +3401,7 @@ namespace OpenSim.Region.Framework.Scenes
public void Close()
{
- lock (m_attachments)
- {
- // Delete attachments from scene
- // Don't try to save, as this thread won't live long
- // enough to complete the save. This would cause no copy
- // attachments to poof!
- //
- foreach (SceneObjectGroup grp in m_attachments)
- {
- m_scene.DeleteSceneObject(grp, false);
- }
- m_attachments.Clear();
- }
+ m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false);
lock (m_knownChildRegions)
{
--
cgit v1.1