From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- .../CoalescedSceneObjectsSerializer.cs | 30 +- .../Scenes/Serialization/SceneObjectSerializer.cs | 317 ++++++++++++++++----- .../Scenes/Serialization/SceneXmlLoader.cs | 14 +- 3 files changed, 278 insertions(+), 83 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Serialization') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index f45158b..abcb573 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs @@ -78,7 +78,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization List coaObjects = coa.Objects; // m_log.DebugFormat( -// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object", +// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object", // coaObjects.Count); // This is weak - we're relying on the set of coalesced objects still being identical @@ -86,9 +86,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteStartElement("CoalescedObject"); - writer.WriteAttributeString("x", size.X.ToString()); - writer.WriteAttributeString("y", size.Y.ToString()); - writer.WriteAttributeString("z", size.Z.ToString()); + writer.WriteAttributeString("x", size.X.ToString(Culture.FormatProvider)); + writer.WriteAttributeString("y", size.Y.ToString(Culture.FormatProvider)); + writer.WriteAttributeString("z", size.Z.ToString(Culture.FormatProvider)); // Embed the offsets into the group XML for (int i = 0; i < coaObjects.Count; i++) @@ -96,13 +96,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization SceneObjectGroup obj = coaObjects[i]; // m_log.DebugFormat( -// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}", +// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}", // i, obj.Name); writer.WriteStartElement("SceneObjectGroup"); - writer.WriteAttributeString("offsetx", offsets[i].X.ToString()); - writer.WriteAttributeString("offsety", offsets[i].Y.ToString()); - writer.WriteAttributeString("offsetz", offsets[i].Z.ToString()); + writer.WriteAttributeString("offsetx", offsets[i].X.ToString(Culture.FormatProvider)); + writer.WriteAttributeString("offsety", offsets[i].Y.ToString(Culture.FormatProvider)); + writer.WriteAttributeString("offsetz", offsets[i].Z.ToString(Culture.FormatProvider)); SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates); @@ -133,12 +133,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { using (XmlTextReader reader = new XmlTextReader(sr)) { + reader.ProhibitDtd = true; + reader.MoveToContent(); // skip possible xml declaration if (reader.Name != "CoalescedObject") { // m_log.DebugFormat( - // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", + // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", // reader.Name); return false; @@ -147,6 +149,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } XmlDocument doc = new XmlDocument(); + doc.XmlResolver=null; doc.LoadXml(xml); XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); if (e == null) @@ -166,10 +169,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } else { - // XXX: Possibly we should fail outright here rather than continuing if a particular component of the + // XXX: Possibly we should fail outright here rather than continuing if a particular component of the // coalesced object fails to load. m_log.WarnFormat( - "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.", + "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.", i); } @@ -178,9 +181,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } catch (Exception e) { - m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed "); -//// m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e); -//// Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml); + m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e); + Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml); return false; } diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 1ff788e..c5a3a22 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -63,16 +63,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData); using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null)) { - using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) + using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, ProhibitDtd = true })) { - try { + try + { return FromOriginalXmlFormat(reader); } catch (Exception e) { - m_log.Error("[SERIALIZER]: Deserialization of xml failed "); -//// m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e); -//// Util.LogFailedXML("[SERIALIZER]:", fixedData); + m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e); + Util.LogFailedXML("[SERIALIZER]:", fixedData); return null; } } @@ -110,12 +110,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } while (reader.ReadToNextSibling("Part")); + reader.ReadEndElement(); } + if (reader.Name == "KeyframeMotion" && reader.NodeType == XmlNodeType.Element) + { + + string innerkeytxt = reader.ReadElementContentAsString(); + sceneObject.RootPart.KeyframeMotion = + KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(innerkeytxt)); + } + else + sceneObject.RootPart.KeyframeMotion = null; + // Script state may, or may not, exist. Not having any, is NOT // ever a problem. sceneObject.LoadScriptState(reader); + sceneObject.InvalidateDeepEffectivePerms(); return sceneObject; } @@ -211,9 +223,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteEndElement(); // OtherParts + if (sceneObject.RootPart.KeyframeMotion != null) + { + Byte[] data = sceneObject.RootPart.KeyframeMotion.Serialize(); + + writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); + writer.WriteBase64(data, 0, data.Length); + writer.WriteEndElement(); + } + if (doScriptStates) sceneObject.SaveScriptedState(writer); + if (!noRootElement) writer.WriteEndElement(); // SceneObjectGroup @@ -233,6 +255,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization try { XmlDocument doc = new XmlDocument(); + doc.XmlResolver=null; doc.LoadXml(xmlData); XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); @@ -244,18 +267,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization return null; } - StringReader sr = new StringReader(parts[0].OuterXml); - XmlTextReader reader = new XmlTextReader(sr); - SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); - reader.Close(); - sr.Close(); + SceneObjectGroup sceneObject; + using(StringReader sr = new StringReader(parts[0].OuterXml)) + { + using(XmlTextReader reader = new XmlTextReader(sr)) + { + reader.ProhibitDtd = true; + + sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); + } + } // Then deal with the rest + SceneObjectPart part; for (int i = 1; i < parts.Count; i++) { - sr = new StringReader(parts[i].OuterXml); - reader = new XmlTextReader(sr); - SceneObjectPart part = SceneObjectPart.FromXml(reader); + using(StringReader sr = new StringReader(parts[i].OuterXml)) + { + using(XmlTextReader reader = new XmlTextReader(sr)) + { + part = SceneObjectPart.FromXml(reader); + } + } int originalLinkNum = part.LinkNum; @@ -266,8 +299,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization if (originalLinkNum != 0) part.LinkNum = originalLinkNum; - reader.Close(); - sr.Close(); } XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion"); @@ -279,14 +310,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization // Script state may, or may not, exist. Not having any, is NOT // ever a problem. sceneObject.LoadScriptState(doc); - +// sceneObject.AggregatePerms(); return sceneObject; } catch (Exception e) { - m_log.Error("[SERIALIZER]: Deserialization of xml failed "); -//// m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e); -//// Util.LogFailedXML("[SERIALIZER]:", xmlData); + m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e); + Util.LogFailedXML("[SERIALIZER]:", xmlData); return null; } } @@ -309,7 +339,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - /// /// Modifies a SceneObjectGroup. /// @@ -330,7 +359,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization CoalescedSceneObjects coa = null; string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); - if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) { // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); @@ -376,7 +404,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization return data; } - #region manual serialization private static Dictionary> m_SOPXmlProcessors @@ -433,6 +460,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_SOPXmlProcessors.Add("GroupID", ProcessGroupID); m_SOPXmlProcessors.Add("OwnerID", ProcessOwnerID); m_SOPXmlProcessors.Add("LastOwnerID", ProcessLastOwnerID); + m_SOPXmlProcessors.Add("RezzerID", ProcessRezzerID); m_SOPXmlProcessors.Add("BaseMask", ProcessBaseMask); m_SOPXmlProcessors.Add("OwnerMask", ProcessOwnerMask); m_SOPXmlProcessors.Add("GroupMask", ProcessGroupMask); @@ -452,11 +480,29 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); + m_SOPXmlProcessors.Add("Buoyancy", ProcessBuoyancy); + m_SOPXmlProcessors.Add("Force", ProcessForce); + m_SOPXmlProcessors.Add("Torque", ProcessTorque); + m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive); + + m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle); + + m_SOPXmlProcessors.Add("PhysicsInertia", ProcessPhysicsInertia); + + m_SOPXmlProcessors.Add("RotationAxisLocks", ProcessRotationAxisLocks); m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); m_SOPXmlProcessors.Add("Density", ProcessDensity); m_SOPXmlProcessors.Add("Friction", ProcessFriction); m_SOPXmlProcessors.Add("Bounce", ProcessBounce); m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); + m_SOPXmlProcessors.Add("CameraEyeOffset", ProcessCameraEyeOffset); + m_SOPXmlProcessors.Add("CameraAtOffset", ProcessCameraAtOffset); + + m_SOPXmlProcessors.Add("SoundID", ProcessSoundID); + m_SOPXmlProcessors.Add("SoundGain", ProcessSoundGain); + m_SOPXmlProcessors.Add("SoundFlags", ProcessSoundFlags); + m_SOPXmlProcessors.Add("SoundRadius", ProcessSoundRadius); + m_SOPXmlProcessors.Add("SoundQueueing", ProcessSoundQueueing); #endregion @@ -686,6 +732,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); } + private static void ProcessRotationAxisLocks(SceneObjectPart obj, XmlReader reader) + { + obj.RotationAxisLocks = (byte)reader.ReadElementContentAsInt("RotationAxisLocks", String.Empty); + } + private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlReader reader) { obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty); @@ -711,6 +762,75 @@ namespace OpenSim.Region.Framework.Scenes.Serialization obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); } + private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlReader reader) + { + obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset")); + } + + private static void ProcessCameraAtOffset(SceneObjectPart obj, XmlReader reader) + { + obj.SetCameraAtOffset(Util.ReadVector(reader, "CameraAtOffset")); + } + + private static void ProcessSoundID(SceneObjectPart obj, XmlReader reader) + { + obj.Sound = Util.ReadUUID(reader, "SoundID"); + } + + private static void ProcessSoundGain(SceneObjectPart obj, XmlReader reader) + { + obj.SoundGain = reader.ReadElementContentAsDouble("SoundGain", String.Empty); + } + + private static void ProcessSoundFlags(SceneObjectPart obj, XmlReader reader) + { + obj.SoundFlags = (byte)reader.ReadElementContentAsInt("SoundFlags", String.Empty); + } + + private static void ProcessSoundRadius(SceneObjectPart obj, XmlReader reader) + { + obj.SoundRadius = reader.ReadElementContentAsDouble("SoundRadius", String.Empty); + } + + private static void ProcessSoundQueueing(SceneObjectPart obj, XmlReader reader) + { + obj.SoundQueueing = Util.ReadBoolean(reader); + } + + private static void ProcessVehicle(SceneObjectPart obj, XmlReader reader) + { + SOPVehicle vehicle = SOPVehicle.FromXml2(reader); + + if (vehicle == null) + { + obj.VehicleParams = null; + m_log.DebugFormat( + "[SceneObjectSerializer]: Parsing Vehicle for object part {0} {1} encountered errors. Please see earlier log entries.", + obj.Name, obj.UUID); + } + else + { + obj.VehicleParams = vehicle; + } + } + + private static void ProcessPhysicsInertia(SceneObjectPart obj, XmlReader reader) + { + PhysicsInertiaData pdata = PhysicsInertiaData.FromXml2(reader); + + if (pdata == null) + { + obj.PhysicsInertia = null; + m_log.DebugFormat( + "[SceneObjectSerializer]: Parsing PhysicsInertiaData for object part {0} {1} encountered errors. Please see earlier log entries.", + obj.Name, obj.UUID); + } + else + { + obj.PhysicsInertia = pdata; + } + } + private static void ProcessShape(SceneObjectPart obj, XmlReader reader) { List errorNodeNames; @@ -795,6 +915,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); } + private static void ProcessRezzerID(SceneObjectPart obj, XmlReader reader) + { + obj.RezzerID = Util.ReadUUID(reader, "RezzerID"); + } + private static void ProcessBaseMask(SceneObjectPart obj, XmlReader reader) { obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty); @@ -885,6 +1010,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); } + private static void ProcessBuoyancy(SceneObjectPart obj, XmlReader reader) + { + obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty); + } + + private static void ProcessForce(SceneObjectPart obj, XmlReader reader) + { + obj.Force = Util.ReadVector(reader, "Force"); + } + private static void ProcessTorque(SceneObjectPart obj, XmlReader reader) + { + obj.Torque = Util.ReadVector(reader, "Torque"); + } + + private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlReader reader) + { + obj.VolumeDetectActive = Util.ReadBoolean(reader); + } + #endregion #region TaskInventoryXmlProcessors @@ -1249,8 +1393,27 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader) { - string value = reader.ReadElementContentAsString("Media", String.Empty); - shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); + string value = String.Empty; + try + { + // The STANDARD content of Media elemet is escaped XML string (with > etc). + value = reader.ReadElementContentAsString("Media", String.Empty); + shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); + } + catch (XmlException e) + { + // There are versions of OAR files that contain unquoted XML. + // ie ONE comercial fork that never wanted their oars to be read by our code + try + { + value = reader.ReadInnerXml(); + shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); + } + catch + { + m_log.ErrorFormat("[SERIALIZER] Failed parsing halcyon MOAP information"); + } + } } #endregion @@ -1280,6 +1443,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteEndElement(); } + writer.WriteEndElement(); } @@ -1327,10 +1491,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("Description", sop.Description); writer.WriteStartElement("Color"); - writer.WriteElementString("R", sop.Color.R.ToString(Utils.EnUsCulture)); - writer.WriteElementString("G", sop.Color.G.ToString(Utils.EnUsCulture)); - writer.WriteElementString("B", sop.Color.B.ToString(Utils.EnUsCulture)); - writer.WriteElementString("A", sop.Color.A.ToString(Utils.EnUsCulture)); + writer.WriteElementString("R", sop.Color.R.ToString(Culture.FormatProvider)); + writer.WriteElementString("G", sop.Color.G.ToString(Culture.FormatProvider)); + writer.WriteElementString("B", sop.Color.B.ToString(Culture.FormatProvider)); + writer.WriteElementString("A", sop.Color.A.ToString(Culture.FormatProvider)); writer.WriteEndElement(); writer.WriteElementString("Text", sop.Text); @@ -1343,7 +1507,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization WriteShape(writer, sop.Shape, options); WriteVector(writer, "Scale", sop.Scale); - WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation); + WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation); WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition); WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL); WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL); @@ -1363,6 +1527,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.LastOwnerID; WriteUUID(writer, "LastOwnerID", lastOwnerID, options); + UUID rezzerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.RezzerID; + WriteUUID(writer, "RezzerID", rezzerID, options); + writer.WriteElementString("BaseMask", sop.BaseMask.ToString()); writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString()); writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); @@ -1370,7 +1537,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); WriteFlags(writer, "Flags", sop.Flags.ToString(), options); WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); - writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); + writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString(Culture.FormatProvider)); if (sop.MediaUrl != null) writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); WriteVector(writer, "AttachedPos", sop.AttachedPos); @@ -1390,16 +1557,41 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); - if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) - writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); + writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString(Culture.FormatProvider)); + + WriteVector(writer, "Force", sop.Force); + WriteVector(writer, "Torque", sop.Torque); + + writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower()); + + if (sop.VehicleParams != null) + sop.VehicleParams.ToXml2(writer); + + if (sop.PhysicsInertia != null) + sop.PhysicsInertia.ToXml2(writer); + + if(sop.RotationAxisLocks != 0) + writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower()); + writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); if (sop.Density != 1000.0f) - writer.WriteElementString("Density", sop.Density.ToString().ToLower()); + writer.WriteElementString("Density", sop.Density.ToString(Culture.FormatProvider)); if (sop.Friction != 0.6f) - writer.WriteElementString("Friction", sop.Friction.ToString().ToLower()); + writer.WriteElementString("Friction", sop.Friction.ToString(Culture.FormatProvider)); if (sop.Restitution != 0.5f) - writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower()); + writer.WriteElementString("Bounce", sop.Restitution.ToString(Culture.FormatProvider)); if (sop.GravityModifier != 1.0f) - writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); + writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString(Culture.FormatProvider)); + WriteVector(writer, "CameraEyeOffset", sop.GetCameraEyeOffset()); + WriteVector(writer, "CameraAtOffset", sop.GetCameraAtOffset()); + + // if (sop.Sound != UUID.Zero) force it till sop crossing does clear it on child prim + { + WriteUUID(writer, "SoundID", sop.Sound, options); + writer.WriteElementString("SoundGain", sop.SoundGain.ToString(Culture.FormatProvider)); + writer.WriteElementString("SoundFlags", sop.SoundFlags.ToString().ToLower()); + writer.WriteElementString("SoundRadius", sop.SoundRadius.ToString(Culture.FormatProvider)); + } + writer.WriteElementString("SoundQueueing", sop.SoundQueueing.ToString().ToLower()); writer.WriteEndElement(); } @@ -1417,19 +1609,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization static void WriteVector(XmlTextWriter writer, string name, Vector3 vec) { writer.WriteStartElement(name); - writer.WriteElementString("X", vec.X.ToString(Utils.EnUsCulture)); - writer.WriteElementString("Y", vec.Y.ToString(Utils.EnUsCulture)); - writer.WriteElementString("Z", vec.Z.ToString(Utils.EnUsCulture)); + writer.WriteElementString("X", vec.X.ToString(Culture.FormatProvider)); + writer.WriteElementString("Y", vec.Y.ToString(Culture.FormatProvider)); + writer.WriteElementString("Z", vec.Z.ToString(Culture.FormatProvider)); writer.WriteEndElement(); } static void WriteQuaternion(XmlTextWriter writer, string name, Quaternion quat) { writer.WriteStartElement(name); - writer.WriteElementString("X", quat.X.ToString(Utils.EnUsCulture)); - writer.WriteElementString("Y", quat.Y.ToString(Utils.EnUsCulture)); - writer.WriteElementString("Z", quat.Z.ToString(Utils.EnUsCulture)); - writer.WriteElementString("W", quat.W.ToString(Utils.EnUsCulture)); + writer.WriteElementString("X", quat.X.ToString(Culture.FormatProvider)); + writer.WriteElementString("Y", quat.Y.ToString(Culture.FormatProvider)); + writer.WriteElementString("Z", quat.Z.ToString(Culture.FormatProvider)); + writer.WriteElementString("W", quat.W.ToString(Culture.FormatProvider)); writer.WriteEndElement(); } @@ -1571,22 +1763,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization // Don't serialize SculptData. It's just a copy of the asset, which can be loaded separately using 'SculptTexture'. writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString()); - writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString()); - writer.WriteElementString("FlexiDrag", shp.FlexiDrag.ToString()); - writer.WriteElementString("FlexiGravity", shp.FlexiGravity.ToString()); - writer.WriteElementString("FlexiWind", shp.FlexiWind.ToString()); - writer.WriteElementString("FlexiForceX", shp.FlexiForceX.ToString()); - writer.WriteElementString("FlexiForceY", shp.FlexiForceY.ToString()); - writer.WriteElementString("FlexiForceZ", shp.FlexiForceZ.ToString()); - - writer.WriteElementString("LightColorR", shp.LightColorR.ToString()); - writer.WriteElementString("LightColorG", shp.LightColorG.ToString()); - writer.WriteElementString("LightColorB", shp.LightColorB.ToString()); - writer.WriteElementString("LightColorA", shp.LightColorA.ToString()); - writer.WriteElementString("LightRadius", shp.LightRadius.ToString()); - writer.WriteElementString("LightCutoff", shp.LightCutoff.ToString()); - writer.WriteElementString("LightFalloff", shp.LightFalloff.ToString()); - writer.WriteElementString("LightIntensity", shp.LightIntensity.ToString()); + writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString(Culture.FormatProvider)); + writer.WriteElementString("FlexiDrag", shp.FlexiDrag.ToString(Culture.FormatProvider)); + writer.WriteElementString("FlexiGravity", shp.FlexiGravity.ToString(Culture.FormatProvider)); + writer.WriteElementString("FlexiWind", shp.FlexiWind.ToString(Culture.FormatProvider)); + writer.WriteElementString("FlexiForceX", shp.FlexiForceX.ToString(Culture.FormatProvider)); + writer.WriteElementString("FlexiForceY", shp.FlexiForceY.ToString(Culture.FormatProvider)); + writer.WriteElementString("FlexiForceZ", shp.FlexiForceZ.ToString(Culture.FormatProvider)); + + writer.WriteElementString("LightColorR", shp.LightColorR.ToString(Culture.FormatProvider)); + writer.WriteElementString("LightColorG", shp.LightColorG.ToString(Culture.FormatProvider)); + writer.WriteElementString("LightColorB", shp.LightColorB.ToString(Culture.FormatProvider)); + writer.WriteElementString("LightColorA", shp.LightColorA.ToString(Culture.FormatProvider)); + writer.WriteElementString("LightRadius", shp.LightRadius.ToString(Culture.FormatProvider)); + writer.WriteElementString("LightCutoff", shp.LightCutoff.ToString(Culture.FormatProvider)); + writer.WriteElementString("LightFalloff", shp.LightFalloff.ToString(Culture.FormatProvider)); + writer.WriteElementString("LightIntensity", shp.LightIntensity.ToString(Culture.FormatProvider)); writer.WriteElementString("FlexiEntry", shp.FlexiEntry.ToString().ToLower()); writer.WriteElementString("LightEntry", shp.LightEntry.ToString().ToLower()); @@ -1619,6 +1811,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization reader.ReadEndElement(); // SceneObjectPart + obj.AggregateInnerPerms(); // m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID); return obj; } @@ -1627,12 +1820,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { TaskInventoryDictionary tinv = new TaskInventoryDictionary(); - if (reader.IsEmptyElement) - { - reader.Read(); - return tinv; - } - reader.ReadStartElement(name, String.Empty); while (reader.Name == "TaskInventoryItem") diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index 3c03130..0ebc645 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs @@ -49,14 +49,18 @@ namespace OpenSim.Region.Framework.Scenes.Serialization public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) { XmlDocument doc = new XmlDocument(); + doc.XmlResolver=null; XmlNode rootNode; if (fileName.StartsWith("http:") || File.Exists(fileName)) { - XmlTextReader reader = new XmlTextReader(fileName); - reader.WhitespaceHandling = WhitespaceHandling.None; - doc.Load(reader); - reader.Close(); + using(XmlTextReader reader = new XmlTextReader(fileName)) + { + reader.WhitespaceHandling = WhitespaceHandling.None; + reader.ProhibitDtd = true; + + doc.Load(reader); + } rootNode = doc.FirstChild; foreach (XmlNode aPrimNode in rootNode.ChildNodes) { @@ -70,6 +74,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization //obj.RegenerateFullIDs(); scene.AddNewSceneObject(obj, true); + obj.InvalidateDeepEffectivePerms(); } } else @@ -265,6 +270,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization foreach (XmlNode aPrimNode in rootNode.ChildNodes) { SceneObjectGroup obj = DeserializeGroupFromXml2(aPrimNode.OuterXml); + scene.AddNewSceneObject(obj, true); if (startScripts) sceneObjects.Add(obj); } -- cgit v1.1