aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-24 20:49:23 +0100
committerJustin Clark-Casey (justincc)2011-08-24 20:49:23 +0100
commitcf3ffe5bb4c6a8bea9599b6143c2f7793500c984 (patch)
tree80ff937e194c85ec7f599bb6e254c239c69f0b56 /OpenSim/Region/Framework/Scenes/Serialization
parentrename AttachmentsModule.ShowDetachInUserInventory() to DetachSingleAttachmen... (diff)
downloadopensim-SC_OLD-cf3ffe5bb4c6a8bea9599b6143c2f7793500c984.zip
opensim-SC_OLD-cf3ffe5bb4c6a8bea9599b6143c2f7793500c984.tar.gz
opensim-SC_OLD-cf3ffe5bb4c6a8bea9599b6143c2f7793500c984.tar.bz2
opensim-SC_OLD-cf3ffe5bb4c6a8bea9599b6143c2f7793500c984.tar.xz
Fix llAttachToAvatar()
Apart from one obvious bug, this was failing because attempting to serialize the script from inside the script (as part of saving the attachment as an inventory asset) was triggering an extremely long delay. So we now don't do this. The state will be serialized anyway when the avatar normally logs out. The worst that can happen is that if the client/server crashes, the attachment scripts start without previous state.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs31
1 files changed, 22 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 8fb9fad..a60ee9b 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -127,26 +127,36 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
127 /// <returns></returns> 127 /// <returns></returns>
128 public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject) 128 public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject)
129 { 129 {
130 return ToOriginalXmlFormat(sceneObject, true);
131 }
132
133 /// <summary>
134 /// Serialize a scene object to the original xml format
135 /// </summary>
136 /// <param name="sceneObject"></param>
137 /// <param name="doScriptStates">Control whether script states are also serialized.</para>
138 /// <returns></returns>
139 public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, bool doScriptStates)
140 {
130 using (StringWriter sw = new StringWriter()) 141 using (StringWriter sw = new StringWriter())
131 { 142 {
132 using (XmlTextWriter writer = new XmlTextWriter(sw)) 143 using (XmlTextWriter writer = new XmlTextWriter(sw))
133 { 144 {
134 ToOriginalXmlFormat(sceneObject, writer); 145 ToOriginalXmlFormat(sceneObject, writer, doScriptStates);
135 } 146 }
136 147
137 return sw.ToString(); 148 return sw.ToString();
138 } 149 }
139 } 150 }
140
141 151
142 /// <summary> 152 /// <summary>
143 /// Serialize a scene object to the original xml format 153 /// Serialize a scene object to the original xml format
144 /// </summary> 154 /// </summary>
145 /// <param name="sceneObject"></param> 155 /// <param name="sceneObject"></param>
146 /// <returns></returns> 156 /// <returns></returns>
147 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer) 157 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates)
148 { 158 {
149 ToOriginalXmlFormat(sceneObject, writer, false); 159 ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false);
150 } 160 }
151 161
152 /// <summary> 162 /// <summary>
@@ -156,10 +166,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
156 /// <param name="writer"></param> 166 /// <param name="writer"></param>
157 /// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param> 167 /// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param>
158 /// <returns></returns> 168 /// <returns></returns>
159 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool noRootElement) 169 public static void ToOriginalXmlFormat(
170 SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates, bool noRootElement)
160 { 171 {
161 //m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name); 172// m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", sceneObject.Name);
162 //int time = System.Environment.TickCount; 173// int time = System.Environment.TickCount;
163 174
164 if (!noRootElement) 175 if (!noRootElement)
165 writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); 176 writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
@@ -182,12 +193,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
182 } 193 }
183 194
184 writer.WriteEndElement(); // OtherParts 195 writer.WriteEndElement(); // OtherParts
185 sceneObject.SaveScriptedState(writer); 196
197 if (doScriptStates)
198 sceneObject.SaveScriptedState(writer);
186 199
187 if (!noRootElement) 200 if (!noRootElement)
188 writer.WriteEndElement(); // SceneObjectGroup 201 writer.WriteEndElement(); // SceneObjectGroup
189 202
190 //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); 203// m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", sceneObject.Name, System.Environment.TickCount - time);
191 } 204 }
192 205
193 protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) 206 protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer)