From 627d1a42fe11937a1c35659ca0fad6f89754f654 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 23 Oct 2010 20:39:41 -0700 Subject: [PATCH 1/2] Added inner exception handling in Shape deserialization processing, so that the whole Shape processing returns a valid Shape object. --- .../Serialization/SceneObjectSerializer.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 044b5991d2..95908fc274 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1426,7 +1426,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization reader.ReadStartElement(name); vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x - vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or Y + vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or y vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z reader.ReadEndElement(); @@ -1501,15 +1501,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization reader.ReadStartElement(name, String.Empty); // Shape + string nodeName = string.Empty; while (reader.NodeType != XmlNodeType.EndElement) { + nodeName = reader.Name; //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name); ShapeXmlProcessor p = null; if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p)) - p(shape, reader); + { + try + { + p(shape, reader); + } + catch (Exception e) + { + m_log.DebugFormat("[SceneObjectSerializer]: exception while parsing Shape {0}: {1}", nodeName, e); + if (reader.NodeType == XmlNodeType.EndElement) + reader.Read(); + } + } 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(); } } From 852c61aaa6e5a2e41e7c1724ee974382a55007ec Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 24 Oct 2010 18:19:48 +0200 Subject: [PATCH 2/2] Add PRIM_NAME, PRIM_DESC and PRIM_ROT_LOCAL --- .../Shared/Api/Implementation/LSL_Api.cs | 27 +++++++++++++++++++ .../Shared/Api/Runtime/LSL_Constants.cs | 3 +++ 2 files changed, 30 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 59a36187cf..1a13deae5a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7267,6 +7267,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Util.Clip((float)primTextColor.z, 0.0f, 1.0f)); part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); + break; + case (int)ScriptBaseClass.PRIM_NAME: + if (remain < 1) + return; + string primName = rules.GetLSLStringItem(idx++); + part.Name = primName; + break; + case (int)ScriptBaseClass.PRIM_DESC: + if (remain < 1) + return; + string primDesc = rules.GetLSLStringItem(idx++); + part.Description = primDesc; + break; + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: + if (remain < 1) + return; + LSL_Rotation lr = rules.GetQuaternionItem(idx++); + SetRot(part, Rot2Quaternion(lr)); break; } } @@ -7813,6 +7831,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api textColor.B)); res.Add(new LSL_Float(textColor.A)); break; + case (int)ScriptBaseClass.PRIM_NAME: + res.Add(part.Name); + break; + case (int)ScriptBaseClass.PRIM_DESC: + res.Add(part.Description); + break; + case (int)ScriptBaseClass.PRIM_ROT_LOCAL: + res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); + break; } } return res; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 5da6bb9a21..b96e977539 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -316,6 +316,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_POINT_LIGHT = 23; // Huh? public const int PRIM_GLOW = 25; public const int PRIM_TEXT = 26; + public const int PRIM_NAME = 27; + public const int PRIM_DESC = 28; + public const int PRIM_ROT_LOCAL = 29; public const int PRIM_TEXGEN_DEFAULT = 0; public const int PRIM_TEXGEN_PLANAR = 1;