diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 122 |
1 files changed, 115 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 0b34156..e223f47 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,49 @@ 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 | bool errors = false; | ||
627 | SOPVehicle _vehicle = new SOPVehicle(); | ||
628 | |||
629 | _vehicle.FromXml2(reader, out errors); | ||
630 | |||
631 | if (errors) | ||
632 | { | ||
633 | obj.sopVehicle = null; | ||
634 | m_log.DebugFormat( | ||
635 | "[SceneObjectSerializer]: Parsing Vehicle for object part {0} {1} encountered errors. Please see earlier log entries.", | ||
636 | obj.Name, obj.UUID); | ||
637 | } | ||
638 | else | ||
639 | obj.sopVehicle = _vehicle; | ||
640 | } | ||
641 | |||
578 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) | 642 | private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) |
579 | { | 643 | { |
580 | List<string> errorNodeNames; | 644 | List<string> errorNodeNames; |
@@ -739,6 +803,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
739 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); | 803 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); |
740 | } | 804 | } |
741 | 805 | ||
806 | private static void ProcessBuoyancy(SceneObjectPart obj, XmlTextReader reader) | ||
807 | { | ||
808 | obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty); | ||
809 | } | ||
810 | |||
811 | private static void ProcessForce(SceneObjectPart obj, XmlTextReader reader) | ||
812 | { | ||
813 | obj.Force = Util.ReadVector(reader, "Force"); | ||
814 | } | ||
815 | private static void ProcessTorque(SceneObjectPart obj, XmlTextReader reader) | ||
816 | { | ||
817 | obj.Torque = Util.ReadVector(reader, "Torque"); | ||
818 | } | ||
819 | |||
820 | private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlTextReader reader) | ||
821 | { | ||
822 | obj.VolumeDetectActive = Util.ReadBoolean(reader); | ||
823 | } | ||
824 | |||
742 | #endregion | 825 | #endregion |
743 | 826 | ||
744 | #region TaskInventoryXmlProcessors | 827 | #region TaskInventoryXmlProcessors |
@@ -1126,6 +1209,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1126 | }); | 1209 | }); |
1127 | 1210 | ||
1128 | writer.WriteEndElement(); | 1211 | writer.WriteEndElement(); |
1212 | |||
1213 | if (sog.RootPart.KeyframeMotion != null) | ||
1214 | { | ||
1215 | Byte[] data = sog.RootPart.KeyframeMotion.Serialize(); | ||
1216 | |||
1217 | writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); | ||
1218 | writer.WriteBase64(data, 0, data.Length); | ||
1219 | writer.WriteEndElement(); | ||
1220 | } | ||
1221 | |||
1129 | writer.WriteEndElement(); | 1222 | writer.WriteEndElement(); |
1130 | } | 1223 | } |
1131 | 1224 | ||
@@ -1225,6 +1318,27 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1225 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); | 1318 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); |
1226 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); | 1319 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); |
1227 | 1320 | ||
1321 | writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString()); | ||
1322 | |||
1323 | WriteVector(writer, "Force", sop.Force); | ||
1324 | WriteVector(writer, "Torque", sop.Torque); | ||
1325 | |||
1326 | writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower()); | ||
1327 | |||
1328 | if (sop.sopVehicle != null) | ||
1329 | sop.sopVehicle.ToXml2(writer); | ||
1330 | |||
1331 | if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) | ||
1332 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); | ||
1333 | if (sop.Density != 1000.0f) | ||
1334 | writer.WriteElementString("Density", sop.Density.ToString().ToLower()); | ||
1335 | if (sop.Friction != 0.6f) | ||
1336 | writer.WriteElementString("Friction", sop.Friction.ToString().ToLower()); | ||
1337 | if (sop.Bounciness != 0.5f) | ||
1338 | writer.WriteElementString("Bounce", sop.Bounciness.ToString().ToLower()); | ||
1339 | if (sop.GravityModifier != 1.0f) | ||
1340 | writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); | ||
1341 | |||
1228 | writer.WriteEndElement(); | 1342 | writer.WriteEndElement(); |
1229 | } | 1343 | } |
1230 | 1344 | ||
@@ -1449,12 +1563,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1449 | { | 1563 | { |
1450 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); | 1564 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); |
1451 | 1565 | ||
1452 | if (reader.IsEmptyElement) | ||
1453 | { | ||
1454 | reader.Read(); | ||
1455 | return tinv; | ||
1456 | } | ||
1457 | |||
1458 | reader.ReadStartElement(name, String.Empty); | 1566 | reader.ReadStartElement(name, String.Empty); |
1459 | 1567 | ||
1460 | while (reader.Name == "TaskInventoryItem") | 1568 | while (reader.Name == "TaskInventoryItem") |