diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs')
-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 f07dee9..5372360 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -375,11 +375,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
375 | m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); | 375 | m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); |
376 | m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); | 376 | m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); |
377 | 377 | ||
378 | m_SOPXmlProcessors.Add("Buoyancy", ProcessBuoyancy); | ||
379 | m_SOPXmlProcessors.Add("Force", ProcessForce); | ||
380 | m_SOPXmlProcessors.Add("Torque", ProcessTorque); | ||
381 | m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive); | ||
382 | |||
383 | |||
384 | m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle); | ||
385 | |||
378 | m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); | 386 | m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); |
379 | m_SOPXmlProcessors.Add("Density", ProcessDensity); | 387 | m_SOPXmlProcessors.Add("Density", ProcessDensity); |
380 | m_SOPXmlProcessors.Add("Friction", ProcessFriction); | 388 | m_SOPXmlProcessors.Add("Friction", ProcessFriction); |
381 | m_SOPXmlProcessors.Add("Bounce", ProcessBounce); | 389 | m_SOPXmlProcessors.Add("Bounce", ProcessBounce); |
382 | m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); | 390 | m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); |
391 | m_SOPXmlProcessors.Add("CameraEyeOffset", ProcessCameraEyeOffset); | ||
392 | m_SOPXmlProcessors.Add("CameraAtOffset", ProcessCameraAtOffset); | ||
383 | 393 | ||
384 | #endregion | 394 | #endregion |
385 | 395 | ||
@@ -408,7 +418,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
408 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); | 418 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); |
409 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); | 419 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); |
410 | m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); | 420 | m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); |
411 | 421 | ||
412 | #endregion | 422 | #endregion |
413 | 423 | ||
414 | #region ShapeXmlProcessors initialization | 424 | #region ShapeXmlProcessors initialization |
@@ -634,6 +644,33 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
634 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); | 644 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); |
635 | } | 645 | } |
636 | 646 | ||
647 | private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlTextReader reader) | ||
648 | { | ||
649 | obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset")); | ||
650 | } | ||
651 | |||
652 | private static void ProcessCameraAtOffset(SceneObjectPart obj, XmlTextReader reader) | ||
653 | { | ||
654 | obj.SetCameraAtOffset(Util.ReadVector(reader, "CameraAtOffset")); | ||
655 | } | ||
656 | |||
657 | private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader) | ||
658 | { | ||
659 | SOPVehicle vehicle = SOPVehicle.FromXml2(reader); | ||
660 | |||
661 | if (vehicle == null) | ||
662 | { | ||
663 | obj.VehicleParams = null; | ||
664 | m_log.DebugFormat( | ||
665 | "[SceneObjectSerializer]: Parsing Vehicle for object part {0} {1} encountered errors. Please see earlier log entries.", | ||
666 | obj.Name, obj.UUID); | ||
667 | } | ||
668 | else | ||
669 | { | ||
670 | obj.VehicleParams = vehicle; | ||
671 | } | ||
672 | } | ||
673 | |||
637 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) | 674 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) |
638 | { | 675 | { |
639 | List<string> errorNodeNames; | 676 | List<string> errorNodeNames; |
@@ -808,6 +845,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
808 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); | 845 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); |
809 | } | 846 | } |
810 | 847 | ||
848 | private static void ProcessBuoyancy(SceneObjectPart obj, XmlTextReader reader) | ||
849 | { | ||
850 | obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty); | ||
851 | } | ||
852 | |||
853 | private static void ProcessForce(SceneObjectPart obj, XmlTextReader reader) | ||
854 | { | ||
855 | obj.Force = Util.ReadVector(reader, "Force"); | ||
856 | } | ||
857 | private static void ProcessTorque(SceneObjectPart obj, XmlTextReader reader) | ||
858 | { | ||
859 | obj.Torque = Util.ReadVector(reader, "Torque"); | ||
860 | } | ||
861 | |||
862 | private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlTextReader reader) | ||
863 | { | ||
864 | obj.VolumeDetectActive = Util.ReadBoolean(reader); | ||
865 | } | ||
866 | |||
811 | #endregion | 867 | #endregion |
812 | 868 | ||
813 | #region TaskInventoryXmlProcessors | 869 | #region TaskInventoryXmlProcessors |
@@ -1203,7 +1259,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1203 | 1259 | ||
1204 | if (sog.RootPart.KeyframeMotion != null) | 1260 | if (sog.RootPart.KeyframeMotion != null) |
1205 | { | 1261 | { |
1206 | Byte[] data = sog.RootPart.KeyframeMotion.Serialize(); | 1262 | Byte[] data = sog.RootPart.KeyframeMotion.Serialize(); |
1207 | 1263 | ||
1208 | writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); | 1264 | writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); |
1209 | writer.WriteBase64(data, 0, data.Length); | 1265 | writer.WriteBase64(data, 0, data.Length); |
@@ -1318,6 +1374,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1318 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); | 1374 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); |
1319 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); | 1375 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); |
1320 | 1376 | ||
1377 | writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString()); | ||
1378 | |||
1379 | WriteVector(writer, "Force", sop.Force); | ||
1380 | WriteVector(writer, "Torque", sop.Torque); | ||
1381 | |||
1382 | writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower()); | ||
1383 | |||
1384 | if (sop.VehicleParams != null) | ||
1385 | sop.VehicleParams.ToXml2(writer); | ||
1386 | |||
1321 | if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) | 1387 | if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) |
1322 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); | 1388 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); |
1323 | if (sop.Density != 1000.0f) | 1389 | if (sop.Density != 1000.0f) |
@@ -1328,6 +1394,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1328 | writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower()); | 1394 | writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower()); |
1329 | if (sop.GravityModifier != 1.0f) | 1395 | if (sop.GravityModifier != 1.0f) |
1330 | writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); | 1396 | writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); |
1397 | WriteVector(writer, "CameraEyeOffset", sop.GetCameraEyeOffset()); | ||
1398 | WriteVector(writer, "CameraAtOffset", sop.GetCameraAtOffset()); | ||
1331 | 1399 | ||
1332 | writer.WriteEndElement(); | 1400 | writer.WriteEndElement(); |
1333 | } | 1401 | } |
@@ -1554,12 +1622,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1554 | { | 1622 | { |
1555 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); | 1623 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); |
1556 | 1624 | ||
1557 | if (reader.IsEmptyElement) | ||
1558 | { | ||
1559 | reader.Read(); | ||
1560 | return tinv; | ||
1561 | } | ||
1562 | |||
1563 | reader.ReadStartElement(name, String.Empty); | 1625 | reader.ReadStartElement(name, String.Empty); |
1564 | 1626 | ||
1565 | while (reader.Name == "TaskInventoryItem") | 1627 | while (reader.Name == "TaskInventoryItem") |