From 43a4b7b735f1663fbbb0b74addf82e576b9e5042 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 19 Oct 2010 01:22:31 +0100 Subject: COmmented the wrong line instead, now I commented them all to be on the safe side --- .../Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index ef012d5..7b94a81 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1363,7 +1363,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } else { - m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName); +// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName); reader.ReadOuterXml(); // ignore } @@ -1467,7 +1467,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization p(shape, reader); else { - m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name); +// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name); reader.ReadOuterXml(); } } -- cgit v1.1 From 684449f7832fbb6b1811c303f25d08cdfc3dd6d2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 19 Oct 2010 00:04:02 -0700 Subject: Added TextureAnimation and ParticleSystem to serialization. --- .../Scenes/Serialization/SceneObjectSerializer.cs | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 7b94a81..b6aa31b 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 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); + m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); + m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); #endregion #region TaskInventoryXmlProcessors initialization @@ -663,6 +665,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); } + + private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader) + { + obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty)); + } + + private static void ProcessParticleSystem(SceneObjectPart obj, XmlTextReader reader) + { + obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty)); + } #endregion #region TaskInventoryXmlProcessors @@ -1128,6 +1140,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); if (sop.MediaUrl != null) writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); + WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); + WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); writer.WriteEndElement(); } @@ -1161,6 +1175,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteEndElement(); } + static void WriteBytes(XmlTextWriter writer, string name, byte[] data) + { + writer.WriteStartElement(name); + byte[] d; + if (data != null) + d = data; + else + d = Utils.EmptyBytes; + writer.WriteBase64(d, 0, d.Length); + writer.WriteEndElement(); // name + + } + static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options) { if (tinv.Count > 0) // otherwise skip this -- cgit v1.1 From 3b2d9a99390e44d99bf00a6be685c08e307b9e42 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 19 Oct 2010 14:37:03 -0700 Subject: Added code to quaternion deserialization to try to cope with an exception seen in Wright Plaza related to SitTargetOrientation. 17:23:05 - [SceneObjectSerializer]: exception while parsing SitTargetOrientation: System.Xml.XmlException: Expecting X tag from namespace , got w and instead Line 1, position 30064. --- .../Scenes/Serialization/SceneObjectSerializer.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index b6aa31b..3a48299 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1438,10 +1438,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization Quaternion quat; reader.ReadStartElement(name); - quat.X = reader.ReadElementContentAsFloat("X", String.Empty); - quat.Y = reader.ReadElementContentAsFloat("Y", String.Empty); - quat.Z = reader.ReadElementContentAsFloat("Z", String.Empty); - quat.W = reader.ReadElementContentAsFloat("W", String.Empty); + if (reader.Name == "X") // assume X, Y, Z, W order + { + quat.X = reader.ReadElementContentAsFloat("X", String.Empty); + quat.Y = reader.ReadElementContentAsFloat("Y", String.Empty); + quat.Z = reader.ReadElementContentAsFloat("Z", String.Empty); + quat.W = reader.ReadElementContentAsFloat("W", String.Empty); + } + else // assume w, x, y, z + { + quat.W = reader.ReadElementContentAsFloat("w", String.Empty); + quat.X = reader.ReadElementContentAsFloat("x", String.Empty); + quat.Y = reader.ReadElementContentAsFloat("y", String.Empty); + quat.Z = reader.ReadElementContentAsFloat("z", String.Empty); + } + reader.ReadEndElement(); return quat; -- cgit v1.1 From 8acac3d07f63769051d5aad9a54953d033210f48 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 19 Oct 2010 15:07:15 -0700 Subject: Another take related to the previous commit. --- .../Scenes/Serialization/SceneObjectSerializer.cs | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 3a48299..58ec8a6 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1435,22 +1435,26 @@ namespace OpenSim.Region.Framework.Scenes.Serialization static Quaternion ReadQuaternion(XmlTextReader reader, string name) { - Quaternion quat; + Quaternion quat = new Quaternion(); reader.ReadStartElement(name); - if (reader.Name == "X") // assume X, Y, Z, W order - { - quat.X = reader.ReadElementContentAsFloat("X", String.Empty); - quat.Y = reader.ReadElementContentAsFloat("Y", String.Empty); - quat.Z = reader.ReadElementContentAsFloat("Z", String.Empty); - quat.W = reader.ReadElementContentAsFloat("W", String.Empty); - } - else // assume w, x, y, z + while (reader.NodeType != XmlNodeType.EndElement) { - quat.W = reader.ReadElementContentAsFloat("w", String.Empty); - quat.X = reader.ReadElementContentAsFloat("x", String.Empty); - quat.Y = reader.ReadElementContentAsFloat("y", String.Empty); - quat.Z = reader.ReadElementContentAsFloat("z", String.Empty); + switch (reader.Name.ToLower()) + { + case "x": + quat.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); + break; + case "y": + quat.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); + break; + case "z": + quat.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); + break; + case "w": + quat.W = reader.ReadElementContentAsFloat(reader.Name, String.Empty); + break; + } } reader.ReadEndElement(); -- cgit v1.1 From 8731c2be11085469c051dfea067b930520059a6a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 19 Oct 2010 15:16:29 -0700 Subject: It looks like Vector3s also got written down in lower case at some point in time. Added code to account for that. 17:45:59 - [SceneObjectSerializer]: exception while parsing SitTargetPosition: System.Xml.XmlException: Expecting X tag from namespace , got x and instead Line 1, position 2838. --- .../Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 58ec8a6..044b599 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1425,9 +1425,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization Vector3 vec; reader.ReadStartElement(name); - vec.X = reader.ReadElementContentAsFloat("X", String.Empty); - vec.Y = reader.ReadElementContentAsFloat("Y", String.Empty); - vec.Z = reader.ReadElementContentAsFloat("Z", String.Empty); + vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x + vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or Y + vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z reader.ReadEndElement(); return vec; -- cgit v1.1