diff options
author | Diva Canto | 2010-10-19 15:07:15 -0700 |
---|---|---|
committer | Diva Canto | 2010-10-19 15:07:15 -0700 |
commit | 8acac3d07f63769051d5aad9a54953d033210f48 (patch) | |
tree | be17b78bb0d1195ab53cfde7b822473ced836ef0 | |
parent | Added code to quaternion deserialization to try to cope with an exception see... (diff) | |
download | opensim-SC-8acac3d07f63769051d5aad9a54953d033210f48.zip opensim-SC-8acac3d07f63769051d5aad9a54953d033210f48.tar.gz opensim-SC-8acac3d07f63769051d5aad9a54953d033210f48.tar.bz2 opensim-SC-8acac3d07f63769051d5aad9a54953d033210f48.tar.xz |
Another take related to the previous commit.
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 30 |
1 files changed, 17 insertions, 13 deletions
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 | |||
1435 | 1435 | ||
1436 | static Quaternion ReadQuaternion(XmlTextReader reader, string name) | 1436 | static Quaternion ReadQuaternion(XmlTextReader reader, string name) |
1437 | { | 1437 | { |
1438 | Quaternion quat; | 1438 | Quaternion quat = new Quaternion(); |
1439 | 1439 | ||
1440 | reader.ReadStartElement(name); | 1440 | reader.ReadStartElement(name); |
1441 | if (reader.Name == "X") // assume X, Y, Z, W order | 1441 | while (reader.NodeType != XmlNodeType.EndElement) |
1442 | { | ||
1443 | quat.X = reader.ReadElementContentAsFloat("X", String.Empty); | ||
1444 | quat.Y = reader.ReadElementContentAsFloat("Y", String.Empty); | ||
1445 | quat.Z = reader.ReadElementContentAsFloat("Z", String.Empty); | ||
1446 | quat.W = reader.ReadElementContentAsFloat("W", String.Empty); | ||
1447 | } | ||
1448 | else // assume w, x, y, z | ||
1449 | { | 1442 | { |
1450 | quat.W = reader.ReadElementContentAsFloat("w", String.Empty); | 1443 | switch (reader.Name.ToLower()) |
1451 | quat.X = reader.ReadElementContentAsFloat("x", String.Empty); | 1444 | { |
1452 | quat.Y = reader.ReadElementContentAsFloat("y", String.Empty); | 1445 | case "x": |
1453 | quat.Z = reader.ReadElementContentAsFloat("z", String.Empty); | 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 | } | ||
1454 | } | 1458 | } |
1455 | 1459 | ||
1456 | reader.ReadEndElement(); | 1460 | reader.ReadEndElement(); |