diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 92 |
1 files changed, 85 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 39420a6..ce4fb40 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -262,6 +262,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
262 | sr.Close(); | 262 | sr.Close(); |
263 | } | 263 | } |
264 | 264 | ||
265 | XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion"); | ||
266 | if (keymotion.Count > 0) | ||
267 | sceneObject.RootPart.KeyframeMotion = KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(keymotion[0].InnerText)); | ||
268 | else | ||
269 | sceneObject.RootPart.KeyframeMotion = null; | ||
270 | |||
265 | // Script state may, or may not, exist. Not having any, is NOT | 271 | // Script state may, or may not, exist. Not having any, is NOT |
266 | // ever a problem. | 272 | // ever a problem. |
267 | sceneObject.LoadScriptState(doc); | 273 | sceneObject.LoadScriptState(doc); |
@@ -368,11 +374,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
368 | m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); | 374 | m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); |
369 | m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); | 375 | m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); |
370 | 376 | ||
377 | m_SOPXmlProcessors.Add("Buoyancy", ProcessBuoyancy); | ||
378 | m_SOPXmlProcessors.Add("Force", ProcessForce); | ||
379 | m_SOPXmlProcessors.Add("Torque", ProcessTorque); | ||
380 | m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive); | ||
381 | |||
382 | |||
383 | m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle); | ||
384 | |||
371 | m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); | 385 | m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); |
372 | m_SOPXmlProcessors.Add("Density", ProcessDensity); | 386 | m_SOPXmlProcessors.Add("Density", ProcessDensity); |
373 | m_SOPXmlProcessors.Add("Friction", ProcessFriction); | 387 | m_SOPXmlProcessors.Add("Friction", ProcessFriction); |
374 | m_SOPXmlProcessors.Add("Bounce", ProcessBounce); | 388 | m_SOPXmlProcessors.Add("Bounce", ProcessBounce); |
375 | m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); | 389 | m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); |
390 | m_SOPXmlProcessors.Add("CameraEyeOffset", ProcessCameraEyeOffset); | ||
391 | m_SOPXmlProcessors.Add("CameraAtOffset", ProcessCameraAtOffset); | ||
376 | 392 | ||
377 | #endregion | 393 | #endregion |
378 | 394 | ||
@@ -401,7 +417,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
401 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); | 417 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); |
402 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); | 418 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); |
403 | m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); | 419 | m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); |
404 | 420 | ||
405 | #endregion | 421 | #endregion |
406 | 422 | ||
407 | #region ShapeXmlProcessors initialization | 423 | #region ShapeXmlProcessors initialization |
@@ -626,6 +642,33 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
626 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); | 642 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); |
627 | } | 643 | } |
628 | 644 | ||
645 | private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlTextReader reader) | ||
646 | { | ||
647 | obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset")); | ||
648 | } | ||
649 | |||
650 | private static void ProcessCameraAtOffset(SceneObjectPart obj, XmlTextReader reader) | ||
651 | { | ||
652 | obj.SetCameraAtOffset(Util.ReadVector(reader, "CameraAtOffset")); | ||
653 | } | ||
654 | |||
655 | private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader) | ||
656 | { | ||
657 | SOPVehicle vehicle = SOPVehicle.FromXml2(reader); | ||
658 | |||
659 | if (vehicle == null) | ||
660 | { | ||
661 | obj.VehicleParams = null; | ||
662 | m_log.DebugFormat( | ||
663 | "[SceneObjectSerializer]: Parsing Vehicle for object part {0} {1} encountered errors. Please see earlier log entries.", | ||
664 | obj.Name, obj.UUID); | ||
665 | } | ||
666 | else | ||
667 | { | ||
668 | obj.VehicleParams = vehicle; | ||
669 | } | ||
670 | } | ||
671 | |||
629 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) | 672 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) |
630 | { | 673 | { |
631 | List<string> errorNodeNames; | 674 | List<string> errorNodeNames; |
@@ -795,6 +838,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
795 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); | 838 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); |
796 | } | 839 | } |
797 | 840 | ||
841 | private static void ProcessBuoyancy(SceneObjectPart obj, XmlTextReader reader) | ||
842 | { | ||
843 | obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty); | ||
844 | } | ||
845 | |||
846 | private static void ProcessForce(SceneObjectPart obj, XmlTextReader reader) | ||
847 | { | ||
848 | obj.Force = Util.ReadVector(reader, "Force"); | ||
849 | } | ||
850 | private static void ProcessTorque(SceneObjectPart obj, XmlTextReader reader) | ||
851 | { | ||
852 | obj.Torque = Util.ReadVector(reader, "Torque"); | ||
853 | } | ||
854 | |||
855 | private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlTextReader reader) | ||
856 | { | ||
857 | obj.VolumeDetectActive = Util.ReadBoolean(reader); | ||
858 | } | ||
859 | |||
798 | #endregion | 860 | #endregion |
799 | 861 | ||
800 | #region TaskInventoryXmlProcessors | 862 | #region TaskInventoryXmlProcessors |
@@ -1182,6 +1244,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1182 | }); | 1244 | }); |
1183 | 1245 | ||
1184 | writer.WriteEndElement(); | 1246 | writer.WriteEndElement(); |
1247 | |||
1248 | if (sog.RootPart.KeyframeMotion != null) | ||
1249 | { | ||
1250 | Byte[] data = sog.RootPart.KeyframeMotion.Serialize(); | ||
1251 | |||
1252 | writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); | ||
1253 | writer.WriteBase64(data, 0, data.Length); | ||
1254 | writer.WriteEndElement(); | ||
1255 | } | ||
1256 | |||
1185 | writer.WriteEndElement(); | 1257 | writer.WriteEndElement(); |
1186 | } | 1258 | } |
1187 | 1259 | ||
@@ -1289,6 +1361,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1289 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); | 1361 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); |
1290 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); | 1362 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); |
1291 | 1363 | ||
1364 | writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString()); | ||
1365 | |||
1366 | WriteVector(writer, "Force", sop.Force); | ||
1367 | WriteVector(writer, "Torque", sop.Torque); | ||
1368 | |||
1369 | writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower()); | ||
1370 | |||
1371 | if (sop.VehicleParams != null) | ||
1372 | sop.VehicleParams.ToXml2(writer); | ||
1373 | |||
1292 | if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) | 1374 | if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) |
1293 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); | 1375 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); |
1294 | if (sop.Density != 1000.0f) | 1376 | if (sop.Density != 1000.0f) |
@@ -1299,6 +1381,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1299 | writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower()); | 1381 | writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower()); |
1300 | if (sop.GravityModifier != 1.0f) | 1382 | if (sop.GravityModifier != 1.0f) |
1301 | writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); | 1383 | writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); |
1384 | WriteVector(writer, "CameraEyeOffset", sop.GetCameraEyeOffset()); | ||
1385 | WriteVector(writer, "CameraAtOffset", sop.GetCameraAtOffset()); | ||
1302 | 1386 | ||
1303 | writer.WriteEndElement(); | 1387 | writer.WriteEndElement(); |
1304 | } | 1388 | } |
@@ -1524,12 +1608,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1524 | { | 1608 | { |
1525 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); | 1609 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); |
1526 | 1610 | ||
1527 | if (reader.IsEmptyElement) | ||
1528 | { | ||
1529 | reader.Read(); | ||
1530 | return tinv; | ||
1531 | } | ||
1532 | |||
1533 | reader.ReadStartElement(name, String.Empty); | 1611 | reader.ReadStartElement(name, String.Empty); |
1534 | 1612 | ||
1535 | while (reader.Name == "TaskInventoryItem") | 1613 | while (reader.Name == "TaskInventoryItem") |