diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 135 |
1 files changed, 128 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 4a2a47e..5c37c07 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); |
@@ -367,6 +373,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
367 | m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); | 373 | m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); |
368 | m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); | 374 | m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); |
369 | m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); | 375 | m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); |
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 | |||
385 | m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); | ||
386 | m_SOPXmlProcessors.Add("Density", ProcessDensity); | ||
387 | m_SOPXmlProcessors.Add("Friction", ProcessFriction); | ||
388 | m_SOPXmlProcessors.Add("Bounce", ProcessBounce); | ||
389 | m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); | ||
390 | m_SOPXmlProcessors.Add("CameraEyeOffset", ProcessCameraEyeOffset); | ||
391 | m_SOPXmlProcessors.Add("CameraAtOffset", ProcessCameraAtOffset); | ||
392 | |||
370 | #endregion | 393 | #endregion |
371 | 394 | ||
372 | #region TaskInventoryXmlProcessors initialization | 395 | #region TaskInventoryXmlProcessors initialization |
@@ -394,7 +417,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
394 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); | 417 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); |
395 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); | 418 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); |
396 | m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); | 419 | m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); |
397 | 420 | ||
398 | #endregion | 421 | #endregion |
399 | 422 | ||
400 | #region ShapeXmlProcessors initialization | 423 | #region ShapeXmlProcessors initialization |
@@ -594,6 +617,58 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
594 | obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); | 617 | obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); |
595 | } | 618 | } |
596 | 619 | ||
620 | private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlTextReader reader) | ||
621 | { | ||
622 | obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty); | ||
623 | } | ||
624 | |||
625 | private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader) | ||
626 | { | ||
627 | obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty); | ||
628 | } | ||
629 | |||
630 | private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader) | ||
631 | { | ||
632 | obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty); | ||
633 | } | ||
634 | |||
635 | private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader) | ||
636 | { | ||
637 | obj.Bounciness = reader.ReadElementContentAsFloat("Bounce", String.Empty); | ||
638 | } | ||
639 | |||
640 | private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader) | ||
641 | { | ||
642 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); | ||
643 | } | ||
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 | |||
597 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) | 672 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) |
598 | { | 673 | { |
599 | List<string> errorNodeNames; | 674 | List<string> errorNodeNames; |
@@ -763,6 +838,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
763 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); | 838 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); |
764 | } | 839 | } |
765 | 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 | |||
766 | #endregion | 860 | #endregion |
767 | 861 | ||
768 | #region TaskInventoryXmlProcessors | 862 | #region TaskInventoryXmlProcessors |
@@ -1150,6 +1244,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1150 | }); | 1244 | }); |
1151 | 1245 | ||
1152 | 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 | |||
1153 | writer.WriteEndElement(); | 1257 | writer.WriteEndElement(); |
1154 | } | 1258 | } |
1155 | 1259 | ||
@@ -1257,6 +1361,29 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1257 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); | 1361 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); |
1258 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); | 1362 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); |
1259 | 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 | |||
1374 | if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) | ||
1375 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); | ||
1376 | if (sop.Density != 1000.0f) | ||
1377 | writer.WriteElementString("Density", sop.Density.ToString().ToLower()); | ||
1378 | if (sop.Friction != 0.6f) | ||
1379 | writer.WriteElementString("Friction", sop.Friction.ToString().ToLower()); | ||
1380 | if (sop.Bounciness != 0.5f) | ||
1381 | writer.WriteElementString("Bounce", sop.Bounciness.ToString().ToLower()); | ||
1382 | if (sop.GravityModifier != 1.0f) | ||
1383 | writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); | ||
1384 | WriteVector(writer, "CameraEyeOffset", sop.GetCameraEyeOffset()); | ||
1385 | WriteVector(writer, "CameraAtOffset", sop.GetCameraAtOffset()); | ||
1386 | |||
1260 | writer.WriteEndElement(); | 1387 | writer.WriteEndElement(); |
1261 | } | 1388 | } |
1262 | 1389 | ||
@@ -1481,12 +1608,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1481 | { | 1608 | { |
1482 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); | 1609 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); |
1483 | 1610 | ||
1484 | if (reader.IsEmptyElement) | ||
1485 | { | ||
1486 | reader.Read(); | ||
1487 | return tinv; | ||
1488 | } | ||
1489 | |||
1490 | reader.ReadStartElement(name, String.Empty); | 1611 | reader.ReadStartElement(name, String.Empty); |
1491 | 1612 | ||
1492 | while (reader.Name == "TaskInventoryItem") | 1613 | while (reader.Name == "TaskInventoryItem") |