aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs121
1 files changed, 114 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 0b34156..2372d6b 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);
@@ -348,6 +354,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
348 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); 354 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2);
349 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); 355 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
350 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); 356 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
357
358 m_SOPXmlProcessors.Add("Buoyancy", ProcessBuoyancy);
359 m_SOPXmlProcessors.Add("Force", ProcessForce);
360 m_SOPXmlProcessors.Add("Torque", ProcessTorque);
361 m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive);
362
363
364 m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle);
365
366 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
367 m_SOPXmlProcessors.Add("Density", ProcessDensity);
368 m_SOPXmlProcessors.Add("Friction", ProcessFriction);
369 m_SOPXmlProcessors.Add("Bounce", ProcessBounce);
370 m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier);
371
351 #endregion 372 #endregion
352 373
353 #region TaskInventoryXmlProcessors initialization 374 #region TaskInventoryXmlProcessors initialization
@@ -375,7 +396,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
375 m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); 396 m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask);
376 m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); 397 m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType);
377 m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); 398 m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged);
378 399
379 #endregion 400 #endregion
380 401
381 #region ShapeXmlProcessors initialization 402 #region ShapeXmlProcessors initialization
@@ -575,6 +596,48 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
575 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); 596 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
576 } 597 }
577 598
599 private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlTextReader reader)
600 {
601 obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty);
602 }
603
604 private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader)
605 {
606 obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty);
607 }
608
609 private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader)
610 {
611 obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty);
612 }
613
614 private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader)
615 {
616 obj.Bounciness = reader.ReadElementContentAsFloat("Bounce", String.Empty);
617 }
618
619 private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader)
620 {
621 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
622 }
623
624 private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader)
625 {
626 SOPVehicle vehicle = SOPVehicle.FromXml2(reader);
627
628 if (vehicle == null)
629 {
630 obj.VehicleParams = null;
631 m_log.DebugFormat(
632 "[SceneObjectSerializer]: Parsing Vehicle for object part {0} {1} encountered errors. Please see earlier log entries.",
633 obj.Name, obj.UUID);
634 }
635 else
636 {
637 obj.VehicleParams = vehicle;
638 }
639 }
640
578 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) 641 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
579 { 642 {
580 List<string> errorNodeNames; 643 List<string> errorNodeNames;
@@ -739,6 +802,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
739 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); 802 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty);
740 } 803 }
741 804
805 private static void ProcessBuoyancy(SceneObjectPart obj, XmlTextReader reader)
806 {
807 obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty);
808 }
809
810 private static void ProcessForce(SceneObjectPart obj, XmlTextReader reader)
811 {
812 obj.Force = Util.ReadVector(reader, "Force");
813 }
814 private static void ProcessTorque(SceneObjectPart obj, XmlTextReader reader)
815 {
816 obj.Torque = Util.ReadVector(reader, "Torque");
817 }
818
819 private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlTextReader reader)
820 {
821 obj.VolumeDetectActive = Util.ReadBoolean(reader);
822 }
823
742 #endregion 824 #endregion
743 825
744 #region TaskInventoryXmlProcessors 826 #region TaskInventoryXmlProcessors
@@ -1126,6 +1208,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1126 }); 1208 });
1127 1209
1128 writer.WriteEndElement(); 1210 writer.WriteEndElement();
1211
1212 if (sog.RootPart.KeyframeMotion != null)
1213 {
1214 Byte[] data = sog.RootPart.KeyframeMotion.Serialize();
1215
1216 writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
1217 writer.WriteBase64(data, 0, data.Length);
1218 writer.WriteEndElement();
1219 }
1220
1129 writer.WriteEndElement(); 1221 writer.WriteEndElement();
1130 } 1222 }
1131 1223
@@ -1225,6 +1317,27 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1225 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); 1317 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
1226 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); 1318 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
1227 1319
1320 writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString());
1321
1322 WriteVector(writer, "Force", sop.Force);
1323 WriteVector(writer, "Torque", sop.Torque);
1324
1325 writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower());
1326
1327 if (sop.VehicleParams != null)
1328 sop.VehicleParams.ToXml2(writer);
1329
1330 if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType())
1331 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
1332 if (sop.Density != 1000.0f)
1333 writer.WriteElementString("Density", sop.Density.ToString().ToLower());
1334 if (sop.Friction != 0.6f)
1335 writer.WriteElementString("Friction", sop.Friction.ToString().ToLower());
1336 if (sop.Bounciness != 0.5f)
1337 writer.WriteElementString("Bounce", sop.Bounciness.ToString().ToLower());
1338 if (sop.GravityModifier != 1.0f)
1339 writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower());
1340
1228 writer.WriteEndElement(); 1341 writer.WriteEndElement();
1229 } 1342 }
1230 1343
@@ -1449,12 +1562,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1449 { 1562 {
1450 TaskInventoryDictionary tinv = new TaskInventoryDictionary(); 1563 TaskInventoryDictionary tinv = new TaskInventoryDictionary();
1451 1564
1452 if (reader.IsEmptyElement)
1453 {
1454 reader.Read();
1455 return tinv;
1456 }
1457
1458 reader.ReadStartElement(name, String.Empty); 1565 reader.ReadStartElement(name, String.Empty);
1459 1566
1460 while (reader.Name == "TaskInventoryItem") 1567 while (reader.Name == "TaskInventoryItem")