aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs58
1 files changed, 50 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index e33ad4a..dd7e057 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -318,6 +318,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
318 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); 318 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound);
319 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); 319 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume);
320 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); 320 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl);
321 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation);
322 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
321 #endregion 323 #endregion
322 324
323 #region TaskInventoryXmlProcessors initialization 325 #region TaskInventoryXmlProcessors initialization
@@ -663,6 +665,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
663 { 665 {
664 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); 666 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty);
665 } 667 }
668
669 private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader)
670 {
671 obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty));
672 }
673
674 private static void ProcessParticleSystem(SceneObjectPart obj, XmlTextReader reader)
675 {
676 obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty));
677 }
666 #endregion 678 #endregion
667 679
668 #region TaskInventoryXmlProcessors 680 #region TaskInventoryXmlProcessors
@@ -1128,6 +1140,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1128 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); 1140 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
1129 if (sop.MediaUrl != null) 1141 if (sop.MediaUrl != null)
1130 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); 1142 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
1143 WriteBytes(writer, "TextureAnimation", sop.TextureAnimation);
1144 WriteBytes(writer, "ParticleSystem", sop.ParticleSystem);
1131 1145
1132 writer.WriteEndElement(); 1146 writer.WriteEndElement();
1133 } 1147 }
@@ -1161,6 +1175,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1161 writer.WriteEndElement(); 1175 writer.WriteEndElement();
1162 } 1176 }
1163 1177
1178 static void WriteBytes(XmlTextWriter writer, string name, byte[] data)
1179 {
1180 writer.WriteStartElement(name);
1181 byte[] d;
1182 if (data != null)
1183 d = data;
1184 else
1185 d = Utils.EmptyBytes;
1186 writer.WriteBase64(d, 0, d.Length);
1187 writer.WriteEndElement(); // name
1188
1189 }
1190
1164 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options) 1191 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options)
1165 { 1192 {
1166 if (tinv.Count > 0) // otherwise skip this 1193 if (tinv.Count > 0) // otherwise skip this
@@ -1398,9 +1425,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1398 Vector3 vec; 1425 Vector3 vec;
1399 1426
1400 reader.ReadStartElement(name); 1427 reader.ReadStartElement(name);
1401 vec.X = reader.ReadElementContentAsFloat("X", String.Empty); 1428 vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x
1402 vec.Y = reader.ReadElementContentAsFloat("Y", String.Empty); 1429 vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or Y
1403 vec.Z = reader.ReadElementContentAsFloat("Z", String.Empty); 1430 vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z
1404 reader.ReadEndElement(); 1431 reader.ReadEndElement();
1405 1432
1406 return vec; 1433 return vec;
@@ -1408,13 +1435,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1408 1435
1409 static Quaternion ReadQuaternion(XmlTextReader reader, string name) 1436 static Quaternion ReadQuaternion(XmlTextReader reader, string name)
1410 { 1437 {
1411 Quaternion quat; 1438 Quaternion quat = new Quaternion();
1412 1439
1413 reader.ReadStartElement(name); 1440 reader.ReadStartElement(name);
1414 quat.X = reader.ReadElementContentAsFloat("X", String.Empty); 1441 while (reader.NodeType != XmlNodeType.EndElement)
1415 quat.Y = reader.ReadElementContentAsFloat("Y", String.Empty); 1442 {
1416 quat.Z = reader.ReadElementContentAsFloat("Z", String.Empty); 1443 switch (reader.Name.ToLower())
1417 quat.W = reader.ReadElementContentAsFloat("W", String.Empty); 1444 {
1445 case "x":
1446 quat.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
1447 break;
1448 case "y":
1449 quat.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
1450 break;
1451 case "z":
1452 quat.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
1453 break;
1454 case "w":
1455 quat.W = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
1456 break;
1457 }
1458 }
1459
1418 reader.ReadEndElement(); 1460 reader.ReadEndElement();
1419 1461
1420 return quat; 1462 return quat;