aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs121
1 files changed, 114 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 2d4c60a..0d292e7 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);
@@ -366,6 +372,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
366 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); 372 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2);
367 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); 373 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
368 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); 374 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
375
376 m_SOPXmlProcessors.Add("Buoyancy", ProcessBuoyancy);
377 m_SOPXmlProcessors.Add("Force", ProcessForce);
378 m_SOPXmlProcessors.Add("Torque", ProcessTorque);
379 m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive);
380
381
382 m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle);
383
384 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
385 m_SOPXmlProcessors.Add("Density", ProcessDensity);
386 m_SOPXmlProcessors.Add("Friction", ProcessFriction);
387 m_SOPXmlProcessors.Add("Bounce", ProcessBounce);
388 m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier);
389
369 #endregion 390 #endregion
370 391
371 #region TaskInventoryXmlProcessors initialization 392 #region TaskInventoryXmlProcessors initialization
@@ -393,7 +414,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
393 m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); 414 m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask);
394 m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); 415 m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType);
395 m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); 416 m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged);
396 417
397 #endregion 418 #endregion
398 419
399 #region ShapeXmlProcessors initialization 420 #region ShapeXmlProcessors initialization
@@ -593,6 +614,48 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
593 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); 614 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
594 } 615 }
595 616
617 private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlTextReader reader)
618 {
619 obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty);
620 }
621
622 private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader)
623 {
624 obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty);
625 }
626
627 private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader)
628 {
629 obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty);
630 }
631
632 private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader)
633 {
634 obj.Bounciness = reader.ReadElementContentAsFloat("Bounce", String.Empty);
635 }
636
637 private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader)
638 {
639 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
640 }
641
642 private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader)
643 {
644 SOPVehicle vehicle = SOPVehicle.FromXml2(reader);
645
646 if (vehicle == null)
647 {
648 obj.VehicleParams = null;
649 m_log.DebugFormat(
650 "[SceneObjectSerializer]: Parsing Vehicle for object part {0} {1} encountered errors. Please see earlier log entries.",
651 obj.Name, obj.UUID);
652 }
653 else
654 {
655 obj.VehicleParams = vehicle;
656 }
657 }
658
596 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) 659 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
597 { 660 {
598 List<string> errorNodeNames; 661 List<string> errorNodeNames;
@@ -757,6 +820,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
757 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); 820 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty);
758 } 821 }
759 822
823 private static void ProcessBuoyancy(SceneObjectPart obj, XmlTextReader reader)
824 {
825 obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty);
826 }
827
828 private static void ProcessForce(SceneObjectPart obj, XmlTextReader reader)
829 {
830 obj.Force = Util.ReadVector(reader, "Force");
831 }
832 private static void ProcessTorque(SceneObjectPart obj, XmlTextReader reader)
833 {
834 obj.Torque = Util.ReadVector(reader, "Torque");
835 }
836
837 private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlTextReader reader)
838 {
839 obj.VolumeDetectActive = Util.ReadBoolean(reader);
840 }
841
760 #endregion 842 #endregion
761 843
762 #region TaskInventoryXmlProcessors 844 #region TaskInventoryXmlProcessors
@@ -1144,6 +1226,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1144 }); 1226 });
1145 1227
1146 writer.WriteEndElement(); 1228 writer.WriteEndElement();
1229
1230 if (sog.RootPart.KeyframeMotion != null)
1231 {
1232 Byte[] data = sog.RootPart.KeyframeMotion.Serialize();
1233
1234 writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
1235 writer.WriteBase64(data, 0, data.Length);
1236 writer.WriteEndElement();
1237 }
1238
1147 writer.WriteEndElement(); 1239 writer.WriteEndElement();
1148 } 1240 }
1149 1241
@@ -1243,6 +1335,27 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1243 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); 1335 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
1244 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); 1336 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
1245 1337
1338 writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString());
1339
1340 WriteVector(writer, "Force", sop.Force);
1341 WriteVector(writer, "Torque", sop.Torque);
1342
1343 writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower());
1344
1345 if (sop.VehicleParams != null)
1346 sop.VehicleParams.ToXml2(writer);
1347
1348 if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType())
1349 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
1350 if (sop.Density != 1000.0f)
1351 writer.WriteElementString("Density", sop.Density.ToString().ToLower());
1352 if (sop.Friction != 0.6f)
1353 writer.WriteElementString("Friction", sop.Friction.ToString().ToLower());
1354 if (sop.Bounciness != 0.5f)
1355 writer.WriteElementString("Bounce", sop.Bounciness.ToString().ToLower());
1356 if (sop.GravityModifier != 1.0f)
1357 writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower());
1358
1246 writer.WriteEndElement(); 1359 writer.WriteEndElement();
1247 } 1360 }
1248 1361
@@ -1467,12 +1580,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1467 { 1580 {
1468 TaskInventoryDictionary tinv = new TaskInventoryDictionary(); 1581 TaskInventoryDictionary tinv = new TaskInventoryDictionary();
1469 1582
1470 if (reader.IsEmptyElement)
1471 {
1472 reader.Read();
1473 return tinv;
1474 }
1475
1476 reader.ReadStartElement(name, String.Empty); 1583 reader.ReadStartElement(name, String.Empty);
1477 1584
1478 while (reader.Name == "TaskInventoryItem") 1585 while (reader.Name == "TaskInventoryItem")