diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 78 |
1 files changed, 70 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 945745e..68918d3 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -374,11 +374,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
374 | m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); | 374 | m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); |
375 | m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); | 375 | m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); |
376 | 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 | |||
377 | m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); | 385 | m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); |
378 | m_SOPXmlProcessors.Add("Density", ProcessDensity); | 386 | m_SOPXmlProcessors.Add("Density", ProcessDensity); |
379 | m_SOPXmlProcessors.Add("Friction", ProcessFriction); | 387 | m_SOPXmlProcessors.Add("Friction", ProcessFriction); |
380 | m_SOPXmlProcessors.Add("Bounce", ProcessBounce); | 388 | m_SOPXmlProcessors.Add("Bounce", ProcessBounce); |
381 | m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); | 389 | m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); |
390 | m_SOPXmlProcessors.Add("CameraEyeOffset", ProcessCameraEyeOffset); | ||
391 | m_SOPXmlProcessors.Add("CameraAtOffset", ProcessCameraAtOffset); | ||
382 | 392 | ||
383 | #endregion | 393 | #endregion |
384 | 394 | ||
@@ -407,7 +417,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
407 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); | 417 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); |
408 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); | 418 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); |
409 | m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); | 419 | m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); |
410 | 420 | ||
411 | #endregion | 421 | #endregion |
412 | 422 | ||
413 | #region ShapeXmlProcessors initialization | 423 | #region ShapeXmlProcessors initialization |
@@ -632,6 +642,33 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
632 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); | 642 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); |
633 | } | 643 | } |
634 | 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 | |||
635 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) | 672 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) |
636 | { | 673 | { |
637 | List<string> errorNodeNames; | 674 | List<string> errorNodeNames; |
@@ -801,6 +838,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
801 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); | 838 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); |
802 | } | 839 | } |
803 | 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 | |||
804 | #endregion | 860 | #endregion |
805 | 861 | ||
806 | #region TaskInventoryXmlProcessors | 862 | #region TaskInventoryXmlProcessors |
@@ -1191,7 +1247,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1191 | 1247 | ||
1192 | if (sog.RootPart.KeyframeMotion != null) | 1248 | if (sog.RootPart.KeyframeMotion != null) |
1193 | { | 1249 | { |
1194 | Byte[] data = sog.RootPart.KeyframeMotion.Serialize(); | 1250 | Byte[] data = sog.RootPart.KeyframeMotion.Serialize(); |
1195 | 1251 | ||
1196 | writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); | 1252 | writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); |
1197 | writer.WriteBase64(data, 0, data.Length); | 1253 | writer.WriteBase64(data, 0, data.Length); |
@@ -1305,6 +1361,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1305 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); | 1361 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); |
1306 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); | 1362 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); |
1307 | 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 | |||
1308 | if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) | 1374 | if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) |
1309 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); | 1375 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); |
1310 | if (sop.Density != 1000.0f) | 1376 | if (sop.Density != 1000.0f) |
@@ -1315,6 +1381,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1315 | writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower()); | 1381 | writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower()); |
1316 | if (sop.GravityModifier != 1.0f) | 1382 | if (sop.GravityModifier != 1.0f) |
1317 | 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()); | ||
1318 | 1386 | ||
1319 | writer.WriteEndElement(); | 1387 | writer.WriteEndElement(); |
1320 | } | 1388 | } |
@@ -1540,12 +1608,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1540 | { | 1608 | { |
1541 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); | 1609 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); |
1542 | 1610 | ||
1543 | if (reader.IsEmptyElement) | ||
1544 | { | ||
1545 | reader.Read(); | ||
1546 | return tinv; | ||
1547 | } | ||
1548 | |||
1549 | reader.ReadStartElement(name, String.Empty); | 1611 | reader.ReadStartElement(name, String.Empty); |
1550 | 1612 | ||
1551 | while (reader.Name == "TaskInventoryItem") | 1613 | while (reader.Name == "TaskInventoryItem") |