aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-30 23:32:30 +0100
committerJustin Clark-Casey (justincc)2011-08-30 23:32:30 +0100
commitddc733cd3d940a4357eb0d235562050eb6f206bf (patch)
treef77e542f00edcdbb0f645665a869765a10532f1c /OpenSim
parentalso get "nant clean" to remove old .mdb from .exe and .dll (diff)
downloadopensim-SC-ddc733cd3d940a4357eb0d235562050eb6f206bf.zip
opensim-SC-ddc733cd3d940a4357eb0d235562050eb6f206bf.tar.gz
opensim-SC-ddc733cd3d940a4357eb0d235562050eb6f206bf.tar.bz2
opensim-SC-ddc733cd3d940a4357eb0d235562050eb6f206bf.tar.xz
refactor: move SP.SaveChangedAttachments() fully into AttachmentsModule
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs18
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs6
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScenePresence.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs25
5 files changed, 38 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index f6aea89..201ce7f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -133,6 +133,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
133 } 133 }
134 } 134 }
135 } 135 }
136
137 public void SaveChangedAttachments(IScenePresence sp)
138 {
139 // Need to copy this list because DetachToInventoryPrep mods it
140 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(sp.Attachments.ToArray());
141
142 foreach (SceneObjectGroup grp in attachments)
143 {
144 if (grp.HasGroupChanged) // Resizer scripts?
145 {
146 grp.IsAttachment = false;
147 grp.AbsolutePosition = grp.RootPart.AttachedPos;
148// grp.DetachToInventoryPrep();
149 UpdateKnownItem(sp.ControllingClient, grp, grp.GetFromItemID(), grp.OwnerID);
150 grp.IsAttachment = true;
151 }
152 }
153 }
136 154
137 /// <summary> 155 /// <summary>
138 /// Called by client 156 /// Called by client
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
42 void RezAttachments(IScenePresence sp); 42 void RezAttachments(IScenePresence sp);
43 43
44 /// <summary> 44 /// <summary>
45 /// Save the attachments that have change on this presence.
46 /// </summary>
47 /// <param name="sp"></param>
48 void SaveChangedAttachments(IScenePresence sp);
49
50 /// <summary>
45 /// Attach an object to an avatar from the world. 51 /// Attach an object to an avatar from the world.
46 /// </summary> 52 /// </summary>
47 /// <param name="controllingClient"></param> 53 /// <param name="controllingClient"></param>
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 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes;
30 32
31namespace OpenSim.Region.Framework.Interfaces 33namespace OpenSim.Region.Framework.Interfaces
32{ 34{
@@ -52,5 +54,14 @@ namespace OpenSim.Region.Framework.Interfaces
52 // get a synchronization issue. 54 // get a synchronization issue.
53 /// </remarks> 55 /// </remarks>
54 AvatarAppearance Appearance { get; set; } 56 AvatarAppearance Appearance { get; set; }
57
58 /// <summary>
59 /// The scene objects attached to this avatar.
60 /// </summary>
61 /// <remarks>
62 /// Do not change this list directly - use methods such as
63 /// AddAttachment() and RemoveAttachment(). Lock this list when performing any read operations upon it.
64 /// </remarks>
65 List<SceneObjectGroup> Attachments { get; }
55 } 66 }
56} \ No newline at end of file 67} \ 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
3162 3162
3163 m_eventManager.TriggerOnRemovePresence(agentID); 3163 m_eventManager.TriggerOnRemovePresence(agentID);
3164 3164
3165 if (avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc) 3165 if (AttachmentsModule != null && avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc)
3166 avatar.SaveChangedAttachments(); 3166 AttachmentsModule.SaveChangedAttachments(avatar);
3167 3167
3168 ForEachClient( 3168 ForEachClient(
3169 delegate(IClientAPI client) 3169 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
3831 m_reprioritization_called = false; 3831 m_reprioritization_called = false;
3832 } 3832 }
3833 } 3833 }
3834
3835 public void SaveChangedAttachments()
3836 {
3837 // Need to copy this list because DetachToInventoryPrep mods it
3838 List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(Attachments.ToArray());
3839
3840 IAttachmentsModule attachmentsModule = m_scene.AttachmentsModule;
3841 if (attachmentsModule != null)
3842 {
3843 foreach (SceneObjectGroup grp in attachments)
3844 {
3845 if (grp.HasGroupChanged) // Resizer scripts?
3846 {
3847 grp.IsAttachment = false;
3848 grp.AbsolutePosition = grp.RootPart.AttachedPos;
3849// grp.DetachToInventoryPrep();
3850 attachmentsModule.UpdateKnownItem(ControllingClient,
3851 grp, grp.GetFromItemID(), grp.OwnerID);
3852 grp.IsAttachment = true;
3853 }
3854 }
3855 }
3856 }
3857 } 3834 }
3858} 3835} \ No newline at end of file