aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs80
1 files changed, 74 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index e6b88a3..51a3320 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -244,6 +244,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
244 sr.Close(); 244 sr.Close();
245 } 245 }
246 246
247 XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion");
248 if (keymotion.Count > 0)
249 sceneObject.RootPart.KeyframeMotion = KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(keymotion[0].InnerText));
250 else
251 sceneObject.RootPart.KeyframeMotion = null;
252
247 // Script state may, or may not, exist. Not having any, is NOT 253 // Script state may, or may not, exist. Not having any, is NOT
248 // ever a problem. 254 // ever a problem.
249 sceneObject.LoadScriptState(doc); 255 sceneObject.LoadScriptState(doc);
@@ -347,6 +353,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
347 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); 353 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2);
348 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); 354 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
349 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); 355 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
356
357 m_SOPXmlProcessors.Add("Buoyancy", ProcessBuoyancy);
358 m_SOPXmlProcessors.Add("Force", ProcessForce);
359 m_SOPXmlProcessors.Add("Torque", ProcessTorque);
360 m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive);
361
362 //Ubit comented until proper testing
363 m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle);
364
365
350 #endregion 366 #endregion
351 367
352 #region TaskInventoryXmlProcessors initialization 368 #region TaskInventoryXmlProcessors initialization
@@ -569,6 +585,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
569 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); 585 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
570 } 586 }
571 587
588 private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader)
589 {
590 bool errors = false;
591 SOPVehicle _vehicle = new SOPVehicle();
592
593 _vehicle.FromXml2(reader, out errors);
594
595 if (errors)
596 {
597 obj.sopVehicle = null;
598 m_log.DebugFormat(
599 "[SceneObjectSerializer]: Parsing Vehicle for object part {0} {1} encountered errors. Please see earlier log entries.",
600 obj.Name, obj.UUID);
601 }
602 else
603 obj.sopVehicle = _vehicle;
604 }
605
572 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) 606 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
573 { 607 {
574 List<string> errorNodeNames; 608 List<string> errorNodeNames;
@@ -733,6 +767,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
733 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); 767 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty);
734 } 768 }
735 769
770 private static void ProcessBuoyancy(SceneObjectPart obj, XmlTextReader reader)
771 {
772 obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty);
773 }
774
775 private static void ProcessForce(SceneObjectPart obj, XmlTextReader reader)
776 {
777 obj.Force = Util.ReadVector(reader, "Force");
778 }
779 private static void ProcessTorque(SceneObjectPart obj, XmlTextReader reader)
780 {
781 obj.Torque = Util.ReadVector(reader, "Torque");
782 }
783
784 private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlTextReader reader)
785 {
786 obj.VolumeDetectActive = Util.ReadBoolean(reader);
787 }
788
736 #endregion 789 #endregion
737 790
738 #region TaskInventoryXmlProcessors 791 #region TaskInventoryXmlProcessors
@@ -1120,6 +1173,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1120 }); 1173 });
1121 1174
1122 writer.WriteEndElement(); 1175 writer.WriteEndElement();
1176
1177 if (sog.RootPart.KeyframeMotion != null)
1178 {
1179 Byte[] data = sog.RootPart.KeyframeMotion.Serialize();
1180
1181 writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
1182 writer.WriteBase64(data, 0, data.Length);
1183 writer.WriteEndElement();
1184 }
1185
1123 writer.WriteEndElement(); 1186 writer.WriteEndElement();
1124 } 1187 }
1125 1188
@@ -1218,6 +1281,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1218 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); 1281 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
1219 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); 1282 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
1220 1283
1284 writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString());
1285
1286 WriteVector(writer, "Force", sop.Force);
1287 WriteVector(writer, "Torque", sop.Torque);
1288
1289 writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower());
1290
1291 //Ubit comented until proper testing
1292 if (sop.sopVehicle != null)
1293 sop.sopVehicle.ToXml2(writer);
1294
1221 writer.WriteEndElement(); 1295 writer.WriteEndElement();
1222 } 1296 }
1223 1297
@@ -1487,12 +1561,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1487 { 1561 {
1488 TaskInventoryDictionary tinv = new TaskInventoryDictionary(); 1562 TaskInventoryDictionary tinv = new TaskInventoryDictionary();
1489 1563
1490 if (reader.IsEmptyElement)
1491 {
1492 reader.Read();
1493 return tinv;
1494 }
1495
1496 reader.ReadStartElement(name, String.Empty); 1564 reader.ReadStartElement(name, String.Empty);
1497 1565
1498 while (reader.Name == "TaskInventoryItem") 1566 while (reader.Name == "TaskInventoryItem")