aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2012-07-23 21:08:02 +0200
committerMelanie2012-07-23 21:39:26 +0100
commite126915bc168f16f2c4462492814a1b733aefe87 (patch)
tree86b70efdcf21bf0e44f527bb011cb55f9213a1b3 /OpenSim/Region/Framework
parentCommitting Avination's memleak fix-a-thon, installment #3 (diff)
downloadopensim-SC_OLD-e126915bc168f16f2c4462492814a1b733aefe87.zip
opensim-SC_OLD-e126915bc168f16f2c4462492814a1b733aefe87.tar.gz
opensim-SC_OLD-e126915bc168f16f2c4462492814a1b733aefe87.tar.bz2
opensim-SC_OLD-e126915bc168f16f2c4462492814a1b733aefe87.tar.xz
Change attachment handling to remove object from the scene first as per
justincc's original work. Sample scripts before doing so. Also refactor some crucial common code and eliminate parameters that were only ever used with the same constant value.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScenePresence.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs18
4 files changed, 23 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 351e603..d5200b7 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
65 /// <param name="sp">The presence closing</param> 65 /// <param name="sp">The presence closing</param>
66 /// <param name="saveChanged">Save changed attachments.</param> 66 /// <param name="saveChanged">Save changed attachments.</param>
67 /// <param name="saveAllScripted">Save attachments with scripts even if they haven't changed.</para> 67 /// <param name="saveAllScripted">Save attachments with scripts even if they haven't changed.</para>
68 void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted); 68 void DeRezAttachments(IScenePresence sp);
69 69
70 /// <summary> 70 /// <summary>
71 /// Delete all the presence's attachments from the scene 71 /// Delete all the presence's attachments from the scene
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index e6b926c..3f68ee0 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -40,6 +40,8 @@ namespace OpenSim.Region.Framework.Interfaces
40 /// </remarks> 40 /// </remarks>
41 public interface IScenePresence : ISceneAgent 41 public interface IScenePresence : ISceneAgent
42 { 42 {
43 PresenceType PresenceType { get; }
44
43 /// <summary> 45 /// <summary>
44 /// Copy of the script states while the agent is in transit. This state may 46 /// Copy of the script states while the agent is in transit. This state may
45 /// need to be placed back in case of transfer fail. 47 /// need to be placed back in case of transfer fail.
@@ -83,4 +85,4 @@ namespace OpenSim.Region.Framework.Interfaces
83 void RemoveAttachment(SceneObjectGroup gobj); 85 void RemoveAttachment(SceneObjectGroup gobj);
84 void ClearAttachments(); 86 void ClearAttachments();
85 } 87 }
86} \ No newline at end of file 88}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 51a6820..ee34338 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3297,17 +3297,7 @@ namespace OpenSim.Region.Framework.Scenes
3297 { 3297 {
3298 if (AttachmentsModule != null) 3298 if (AttachmentsModule != null)
3299 { 3299 {
3300 // Don't save attachments for HG visitors, it 3300 AttachmentsModule.DeRezAttachments(avatar);
3301 // messes up their inventory. When a HG visitor logs
3302 // out on a foreign grid, their attachments will be
3303 // reloaded in the state they were in when they left
3304 // the home grid. This is best anyway as the visited
3305 // grid may use an incompatible script engine.
3306 bool saveChanged
3307 = avatar.PresenceType != PresenceType.Npc
3308 && (UserManagementModule == null || UserManagementModule.IsLocalGridUser(avatar.UUID));
3309
3310 AttachmentsModule.DeRezAttachments(avatar, saveChanged, false);
3311 } 3301 }
3312 3302
3313 ForEachClient( 3303 ForEachClient(
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 0b34156..2d4c60a 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -151,6 +151,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
151 ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false); 151 ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false);
152 } 152 }
153 153
154 public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, string scriptedState)
155 {
156 using (StringWriter sw = new StringWriter())
157 {
158 using (XmlTextWriter writer = new XmlTextWriter(sw))
159 {
160 writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
161
162 ToOriginalXmlFormat(sceneObject, writer, false, true);
163
164 writer.WriteRaw(scriptedState);
165
166 writer.WriteEndElement();
167 }
168 return sw.ToString();
169 }
170 }
171
154 /// <summary> 172 /// <summary>
155 /// Serialize a scene object to the original xml format 173 /// Serialize a scene object to the original xml format
156 /// </summary> 174 /// </summary>