From ddc733cd3d940a4357eb0d235562050eb6f206bf Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 30 Aug 2011 23:32:30 +0100
Subject: refactor: move SP.SaveChangedAttachments() fully into
AttachmentsModule
---
.../Framework/Interfaces/IAttachmentsModule.cs | 6 ++++++
.../Region/Framework/Interfaces/IScenePresence.cs | 11 ++++++++++
OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++--
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 25 +---------------------
4 files changed, 20 insertions(+), 26 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 1833dce..ce795f1 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -42,6 +42,12 @@ namespace OpenSim.Region.Framework.Interfaces
void RezAttachments(IScenePresence sp);
///
+ /// Save the attachments that have change on this presence.
+ ///
+ ///
+ void SaveChangedAttachments(IScenePresence sp);
+
+ ///
/// 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 d700d79..b07c821 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -26,7 +26,9 @@
*/
using System;
+using System.Collections.Generic;
using OpenSim.Framework;
+using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces
{
@@ -52,5 +54,14 @@ namespace OpenSim.Region.Framework.Interfaces
// get a synchronization issue.
///
AvatarAppearance Appearance { get; set; }
+
+ ///
+ /// The scene objects attached to this avatar.
+ ///
+ ///
+ /// Do not change this list directly - use methods such as
+ /// AddAttachment() and RemoveAttachment(). Lock this list when performing any read operations upon it.
+ ///
+ List Attachments { get; }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e7fe8df..e0e3884 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3162,8 +3162,8 @@ namespace OpenSim.Region.Framework.Scenes
m_eventManager.TriggerOnRemovePresence(agentID);
- if (avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc)
- avatar.SaveChangedAttachments();
+ if (AttachmentsModule != null && avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc)
+ AttachmentsModule.SaveChangedAttachments(avatar);
ForEachClient(
delegate(IClientAPI client)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 040e801..91e11eb 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3831,28 +3831,5 @@ namespace OpenSim.Region.Framework.Scenes
m_reprioritization_called = false;
}
}
-
- public void SaveChangedAttachments()
- {
- // Need to copy this list because DetachToInventoryPrep mods it
- List attachments = new List(Attachments.ToArray());
-
- IAttachmentsModule attachmentsModule = m_scene.AttachmentsModule;
- if (attachmentsModule != null)
- {
- foreach (SceneObjectGroup grp in attachments)
- {
- if (grp.HasGroupChanged) // Resizer scripts?
- {
- grp.IsAttachment = false;
- grp.AbsolutePosition = grp.RootPart.AttachedPos;
-// grp.DetachToInventoryPrep();
- attachmentsModule.UpdateKnownItem(ControllingClient,
- grp, grp.GetFromItemID(), grp.OwnerID);
- grp.IsAttachment = true;
- }
- }
- }
- }
}
-}
+}
\ No newline at end of file
--
cgit v1.1