diff options
author | onefang | 2019-09-11 16:36:50 +1000 |
---|---|---|
committer | onefang | 2019-09-11 16:36:50 +1000 |
commit | 50cd1ffd32f69228e566f2b0b89f86ea0d9fe489 (patch) | |
tree | 52f2ab0c04f1a5d7d6ac5dc872981b4b156447e7 /OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |
parent | Renamed branch to SledjChisl. (diff) | |
parent | Bump to release flavour, build 0. (diff) | |
download | opensim-SC-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.zip opensim-SC-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.gz opensim-SC-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.bz2 opensim-SC-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.xz |
Merge branch 'SledjChisl'
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 311 |
1 files changed, 250 insertions, 61 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 1ff788e..ab70010 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -63,12 +63,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
63 | String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData); | 63 | String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData); |
64 | using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null)) | 64 | using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null)) |
65 | { | 65 | { |
66 | using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) | 66 | using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, ProhibitDtd = true })) |
67 | { | 67 | { |
68 | try { | 68 | try |
69 | { | ||
69 | return FromOriginalXmlFormat(reader); | 70 | return FromOriginalXmlFormat(reader); |
70 | } | 71 | } |
71 | catch (Exception e) | 72 | catch /*(Exception e)*/ |
72 | { | 73 | { |
73 | m_log.Error("[SERIALIZER]: Deserialization of xml failed "); | 74 | m_log.Error("[SERIALIZER]: Deserialization of xml failed "); |
74 | //// m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e); | 75 | //// m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e); |
@@ -110,12 +111,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
110 | } | 111 | } |
111 | } | 112 | } |
112 | while (reader.ReadToNextSibling("Part")); | 113 | while (reader.ReadToNextSibling("Part")); |
114 | reader.ReadEndElement(); | ||
113 | } | 115 | } |
114 | 116 | ||
117 | if (reader.Name == "KeyframeMotion" && reader.NodeType == XmlNodeType.Element) | ||
118 | { | ||
119 | |||
120 | string innerkeytxt = reader.ReadElementContentAsString(); | ||
121 | sceneObject.RootPart.KeyframeMotion = | ||
122 | KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(innerkeytxt)); | ||
123 | } | ||
124 | else | ||
125 | sceneObject.RootPart.KeyframeMotion = null; | ||
126 | |||
115 | // Script state may, or may not, exist. Not having any, is NOT | 127 | // Script state may, or may not, exist. Not having any, is NOT |
116 | // ever a problem. | 128 | // ever a problem. |
117 | sceneObject.LoadScriptState(reader); | 129 | sceneObject.LoadScriptState(reader); |
118 | 130 | ||
131 | sceneObject.InvalidateDeepEffectivePerms(); | ||
119 | return sceneObject; | 132 | return sceneObject; |
120 | } | 133 | } |
121 | 134 | ||
@@ -211,9 +224,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
211 | 224 | ||
212 | writer.WriteEndElement(); // OtherParts | 225 | writer.WriteEndElement(); // OtherParts |
213 | 226 | ||
227 | if (sceneObject.RootPart.KeyframeMotion != null) | ||
228 | { | ||
229 | Byte[] data = sceneObject.RootPart.KeyframeMotion.Serialize(); | ||
230 | |||
231 | writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); | ||
232 | writer.WriteBase64(data, 0, data.Length); | ||
233 | writer.WriteEndElement(); | ||
234 | } | ||
235 | |||
214 | if (doScriptStates) | 236 | if (doScriptStates) |
215 | sceneObject.SaveScriptedState(writer); | 237 | sceneObject.SaveScriptedState(writer); |
216 | 238 | ||
239 | |||
217 | if (!noRootElement) | 240 | if (!noRootElement) |
218 | writer.WriteEndElement(); // SceneObjectGroup | 241 | writer.WriteEndElement(); // SceneObjectGroup |
219 | 242 | ||
@@ -233,6 +256,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
233 | try | 256 | try |
234 | { | 257 | { |
235 | XmlDocument doc = new XmlDocument(); | 258 | XmlDocument doc = new XmlDocument(); |
259 | doc.XmlResolver=null; | ||
236 | doc.LoadXml(xmlData); | 260 | doc.LoadXml(xmlData); |
237 | 261 | ||
238 | XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); | 262 | XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); |
@@ -244,18 +268,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
244 | return null; | 268 | return null; |
245 | } | 269 | } |
246 | 270 | ||
247 | StringReader sr = new StringReader(parts[0].OuterXml); | 271 | SceneObjectGroup sceneObject; |
248 | XmlTextReader reader = new XmlTextReader(sr); | 272 | using(StringReader sr = new StringReader(parts[0].OuterXml)) |
249 | SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); | 273 | { |
250 | reader.Close(); | 274 | using(XmlTextReader reader = new XmlTextReader(sr)) |
251 | sr.Close(); | 275 | { |
276 | reader.ProhibitDtd = true; | ||
277 | |||
278 | sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); | ||
279 | } | ||
280 | } | ||
252 | 281 | ||
253 | // Then deal with the rest | 282 | // Then deal with the rest |
283 | SceneObjectPart part; | ||
254 | for (int i = 1; i < parts.Count; i++) | 284 | for (int i = 1; i < parts.Count; i++) |
255 | { | 285 | { |
256 | sr = new StringReader(parts[i].OuterXml); | 286 | using(StringReader sr = new StringReader(parts[i].OuterXml)) |
257 | reader = new XmlTextReader(sr); | 287 | { |
258 | SceneObjectPart part = SceneObjectPart.FromXml(reader); | 288 | using(XmlTextReader reader = new XmlTextReader(sr)) |
289 | { | ||
290 | part = SceneObjectPart.FromXml(reader); | ||
291 | } | ||
292 | } | ||
259 | 293 | ||
260 | int originalLinkNum = part.LinkNum; | 294 | int originalLinkNum = part.LinkNum; |
261 | 295 | ||
@@ -266,8 +300,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
266 | if (originalLinkNum != 0) | 300 | if (originalLinkNum != 0) |
267 | part.LinkNum = originalLinkNum; | 301 | part.LinkNum = originalLinkNum; |
268 | 302 | ||
269 | reader.Close(); | ||
270 | sr.Close(); | ||
271 | } | 303 | } |
272 | 304 | ||
273 | XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion"); | 305 | XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion"); |
@@ -279,10 +311,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
279 | // Script state may, or may not, exist. Not having any, is NOT | 311 | // Script state may, or may not, exist. Not having any, is NOT |
280 | // ever a problem. | 312 | // ever a problem. |
281 | sceneObject.LoadScriptState(doc); | 313 | sceneObject.LoadScriptState(doc); |
282 | 314 | // sceneObject.AggregatePerms(); | |
283 | return sceneObject; | 315 | return sceneObject; |
284 | } | 316 | } |
285 | catch (Exception e) | 317 | catch /*(Exception e)*/ |
286 | { | 318 | { |
287 | m_log.Error("[SERIALIZER]: Deserialization of xml failed "); | 319 | m_log.Error("[SERIALIZER]: Deserialization of xml failed "); |
288 | //// m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e); | 320 | //// m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e); |
@@ -309,7 +341,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
309 | } | 341 | } |
310 | } | 342 | } |
311 | 343 | ||
312 | |||
313 | /// <summary> | 344 | /// <summary> |
314 | /// Modifies a SceneObjectGroup. | 345 | /// Modifies a SceneObjectGroup. |
315 | /// </summary> | 346 | /// </summary> |
@@ -330,7 +361,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
330 | CoalescedSceneObjects coa = null; | 361 | CoalescedSceneObjects coa = null; |
331 | 362 | ||
332 | string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); | 363 | string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); |
333 | |||
334 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) | 364 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) |
335 | { | 365 | { |
336 | // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); | 366 | // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); |
@@ -376,7 +406,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
376 | return data; | 406 | return data; |
377 | } | 407 | } |
378 | 408 | ||
379 | |||
380 | #region manual serialization | 409 | #region manual serialization |
381 | 410 | ||
382 | private static Dictionary<string, Action<SceneObjectPart, XmlReader>> m_SOPXmlProcessors | 411 | private static Dictionary<string, Action<SceneObjectPart, XmlReader>> m_SOPXmlProcessors |
@@ -433,6 +462,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
433 | m_SOPXmlProcessors.Add("GroupID", ProcessGroupID); | 462 | m_SOPXmlProcessors.Add("GroupID", ProcessGroupID); |
434 | m_SOPXmlProcessors.Add("OwnerID", ProcessOwnerID); | 463 | m_SOPXmlProcessors.Add("OwnerID", ProcessOwnerID); |
435 | m_SOPXmlProcessors.Add("LastOwnerID", ProcessLastOwnerID); | 464 | m_SOPXmlProcessors.Add("LastOwnerID", ProcessLastOwnerID); |
465 | m_SOPXmlProcessors.Add("RezzerID", ProcessRezzerID); | ||
436 | m_SOPXmlProcessors.Add("BaseMask", ProcessBaseMask); | 466 | m_SOPXmlProcessors.Add("BaseMask", ProcessBaseMask); |
437 | m_SOPXmlProcessors.Add("OwnerMask", ProcessOwnerMask); | 467 | m_SOPXmlProcessors.Add("OwnerMask", ProcessOwnerMask); |
438 | m_SOPXmlProcessors.Add("GroupMask", ProcessGroupMask); | 468 | m_SOPXmlProcessors.Add("GroupMask", ProcessGroupMask); |
@@ -452,11 +482,29 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
452 | m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); | 482 | m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); |
453 | m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); | 483 | m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); |
454 | 484 | ||
485 | m_SOPXmlProcessors.Add("Buoyancy", ProcessBuoyancy); | ||
486 | m_SOPXmlProcessors.Add("Force", ProcessForce); | ||
487 | m_SOPXmlProcessors.Add("Torque", ProcessTorque); | ||
488 | m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive); | ||
489 | |||
490 | m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle); | ||
491 | |||
492 | m_SOPXmlProcessors.Add("PhysicsInertia", ProcessPhysicsInertia); | ||
493 | |||
494 | m_SOPXmlProcessors.Add("RotationAxisLocks", ProcessRotationAxisLocks); | ||
455 | m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); | 495 | m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); |
456 | m_SOPXmlProcessors.Add("Density", ProcessDensity); | 496 | m_SOPXmlProcessors.Add("Density", ProcessDensity); |
457 | m_SOPXmlProcessors.Add("Friction", ProcessFriction); | 497 | m_SOPXmlProcessors.Add("Friction", ProcessFriction); |
458 | m_SOPXmlProcessors.Add("Bounce", ProcessBounce); | 498 | m_SOPXmlProcessors.Add("Bounce", ProcessBounce); |
459 | m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); | 499 | m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); |
500 | m_SOPXmlProcessors.Add("CameraEyeOffset", ProcessCameraEyeOffset); | ||
501 | m_SOPXmlProcessors.Add("CameraAtOffset", ProcessCameraAtOffset); | ||
502 | |||
503 | m_SOPXmlProcessors.Add("SoundID", ProcessSoundID); | ||
504 | m_SOPXmlProcessors.Add("SoundGain", ProcessSoundGain); | ||
505 | m_SOPXmlProcessors.Add("SoundFlags", ProcessSoundFlags); | ||
506 | m_SOPXmlProcessors.Add("SoundRadius", ProcessSoundRadius); | ||
507 | m_SOPXmlProcessors.Add("SoundQueueing", ProcessSoundQueueing); | ||
460 | 508 | ||
461 | #endregion | 509 | #endregion |
462 | 510 | ||
@@ -686,6 +734,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
686 | obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); | 734 | obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); |
687 | } | 735 | } |
688 | 736 | ||
737 | private static void ProcessRotationAxisLocks(SceneObjectPart obj, XmlReader reader) | ||
738 | { | ||
739 | obj.RotationAxisLocks = (byte)reader.ReadElementContentAsInt("RotationAxisLocks", String.Empty); | ||
740 | } | ||
741 | |||
689 | private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlReader reader) | 742 | private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlReader reader) |
690 | { | 743 | { |
691 | obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty); | 744 | obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty); |
@@ -711,6 +764,75 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
711 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); | 764 | obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); |
712 | } | 765 | } |
713 | 766 | ||
767 | private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlReader reader) | ||
768 | { | ||
769 | obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset")); | ||
770 | } | ||
771 | |||
772 | private static void ProcessCameraAtOffset(SceneObjectPart obj, XmlReader reader) | ||
773 | { | ||
774 | obj.SetCameraAtOffset(Util.ReadVector(reader, "CameraAtOffset")); | ||
775 | } | ||
776 | |||
777 | private static void ProcessSoundID(SceneObjectPart obj, XmlReader reader) | ||
778 | { | ||
779 | obj.Sound = Util.ReadUUID(reader, "SoundID"); | ||
780 | } | ||
781 | |||
782 | private static void ProcessSoundGain(SceneObjectPart obj, XmlReader reader) | ||
783 | { | ||
784 | obj.SoundGain = reader.ReadElementContentAsDouble("SoundGain", String.Empty); | ||
785 | } | ||
786 | |||
787 | private static void ProcessSoundFlags(SceneObjectPart obj, XmlReader reader) | ||
788 | { | ||
789 | obj.SoundFlags = (byte)reader.ReadElementContentAsInt("SoundFlags", String.Empty); | ||
790 | } | ||
791 | |||
792 | private static void ProcessSoundRadius(SceneObjectPart obj, XmlReader reader) | ||
793 | { | ||
794 | obj.SoundRadius = reader.ReadElementContentAsDouble("SoundRadius", String.Empty); | ||
795 | } | ||
796 | |||
797 | private static void ProcessSoundQueueing(SceneObjectPart obj, XmlReader reader) | ||
798 | { | ||
799 | obj.SoundQueueing = Util.ReadBoolean(reader); | ||
800 | } | ||
801 | |||
802 | private static void ProcessVehicle(SceneObjectPart obj, XmlReader reader) | ||
803 | { | ||
804 | SOPVehicle vehicle = SOPVehicle.FromXml2(reader); | ||
805 | |||
806 | if (vehicle == null) | ||
807 | { | ||
808 | obj.VehicleParams = null; | ||
809 | m_log.DebugFormat( | ||
810 | "[SceneObjectSerializer]: Parsing Vehicle for object part {0} {1} encountered errors. Please see earlier log entries.", | ||
811 | obj.Name, obj.UUID); | ||
812 | } | ||
813 | else | ||
814 | { | ||
815 | obj.VehicleParams = vehicle; | ||
816 | } | ||
817 | } | ||
818 | |||
819 | private static void ProcessPhysicsInertia(SceneObjectPart obj, XmlReader reader) | ||
820 | { | ||
821 | PhysicsInertiaData pdata = PhysicsInertiaData.FromXml2(reader); | ||
822 | |||
823 | if (pdata == null) | ||
824 | { | ||
825 | obj.PhysicsInertia = null; | ||
826 | m_log.DebugFormat( | ||
827 | "[SceneObjectSerializer]: Parsing PhysicsInertiaData for object part {0} {1} encountered errors. Please see earlier log entries.", | ||
828 | obj.Name, obj.UUID); | ||
829 | } | ||
830 | else | ||
831 | { | ||
832 | obj.PhysicsInertia = pdata; | ||
833 | } | ||
834 | } | ||
835 | |||
714 | private static void ProcessShape(SceneObjectPart obj, XmlReader reader) | 836 | private static void ProcessShape(SceneObjectPart obj, XmlReader reader) |
715 | { | 837 | { |
716 | List<string> errorNodeNames; | 838 | List<string> errorNodeNames; |
@@ -795,6 +917,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
795 | obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); | 917 | obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); |
796 | } | 918 | } |
797 | 919 | ||
920 | private static void ProcessRezzerID(SceneObjectPart obj, XmlReader reader) | ||
921 | { | ||
922 | obj.RezzerID = Util.ReadUUID(reader, "RezzerID"); | ||
923 | } | ||
924 | |||
798 | private static void ProcessBaseMask(SceneObjectPart obj, XmlReader reader) | 925 | private static void ProcessBaseMask(SceneObjectPart obj, XmlReader reader) |
799 | { | 926 | { |
800 | obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty); | 927 | obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty); |
@@ -885,6 +1012,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
885 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); | 1012 | obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); |
886 | } | 1013 | } |
887 | 1014 | ||
1015 | private static void ProcessBuoyancy(SceneObjectPart obj, XmlReader reader) | ||
1016 | { | ||
1017 | obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty); | ||
1018 | } | ||
1019 | |||
1020 | private static void ProcessForce(SceneObjectPart obj, XmlReader reader) | ||
1021 | { | ||
1022 | obj.Force = Util.ReadVector(reader, "Force"); | ||
1023 | } | ||
1024 | private static void ProcessTorque(SceneObjectPart obj, XmlReader reader) | ||
1025 | { | ||
1026 | obj.Torque = Util.ReadVector(reader, "Torque"); | ||
1027 | } | ||
1028 | |||
1029 | private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlReader reader) | ||
1030 | { | ||
1031 | obj.VolumeDetectActive = Util.ReadBoolean(reader); | ||
1032 | } | ||
1033 | |||
888 | #endregion | 1034 | #endregion |
889 | 1035 | ||
890 | #region TaskInventoryXmlProcessors | 1036 | #region TaskInventoryXmlProcessors |
@@ -1249,8 +1395,27 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1249 | 1395 | ||
1250 | private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader) | 1396 | private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader) |
1251 | { | 1397 | { |
1252 | string value = reader.ReadElementContentAsString("Media", String.Empty); | 1398 | string value = String.Empty; |
1253 | shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); | 1399 | try |
1400 | { | ||
1401 | // The STANDARD content of Media elemet is escaped XML string (with > etc). | ||
1402 | value = reader.ReadElementContentAsString("Media", String.Empty); | ||
1403 | shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); | ||
1404 | } | ||
1405 | catch (XmlException) | ||
1406 | { | ||
1407 | // There are versions of OAR files that contain unquoted XML. | ||
1408 | // ie ONE comercial fork that never wanted their oars to be read by our code | ||
1409 | try | ||
1410 | { | ||
1411 | value = reader.ReadInnerXml(); | ||
1412 | shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); | ||
1413 | } | ||
1414 | catch | ||
1415 | { | ||
1416 | m_log.ErrorFormat("[SERIALIZER] Failed parsing halcyon MOAP information"); | ||
1417 | } | ||
1418 | } | ||
1254 | } | 1419 | } |
1255 | 1420 | ||
1256 | #endregion | 1421 | #endregion |
@@ -1280,6 +1445,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1280 | writer.WriteEndElement(); | 1445 | writer.WriteEndElement(); |
1281 | } | 1446 | } |
1282 | 1447 | ||
1448 | |||
1283 | writer.WriteEndElement(); | 1449 | writer.WriteEndElement(); |
1284 | } | 1450 | } |
1285 | 1451 | ||
@@ -1327,10 +1493,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1327 | writer.WriteElementString("Description", sop.Description); | 1493 | writer.WriteElementString("Description", sop.Description); |
1328 | 1494 | ||
1329 | writer.WriteStartElement("Color"); | 1495 | writer.WriteStartElement("Color"); |
1330 | writer.WriteElementString("R", sop.Color.R.ToString(Utils.EnUsCulture)); | 1496 | writer.WriteElementString("R", sop.Color.R.ToString(Culture.FormatProvider)); |
1331 | writer.WriteElementString("G", sop.Color.G.ToString(Utils.EnUsCulture)); | 1497 | writer.WriteElementString("G", sop.Color.G.ToString(Culture.FormatProvider)); |
1332 | writer.WriteElementString("B", sop.Color.B.ToString(Utils.EnUsCulture)); | 1498 | writer.WriteElementString("B", sop.Color.B.ToString(Culture.FormatProvider)); |
1333 | writer.WriteElementString("A", sop.Color.A.ToString(Utils.EnUsCulture)); | 1499 | writer.WriteElementString("A", sop.Color.A.ToString(Culture.FormatProvider)); |
1334 | writer.WriteEndElement(); | 1500 | writer.WriteEndElement(); |
1335 | 1501 | ||
1336 | writer.WriteElementString("Text", sop.Text); | 1502 | writer.WriteElementString("Text", sop.Text); |
@@ -1343,7 +1509,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1343 | WriteShape(writer, sop.Shape, options); | 1509 | WriteShape(writer, sop.Shape, options); |
1344 | 1510 | ||
1345 | WriteVector(writer, "Scale", sop.Scale); | 1511 | WriteVector(writer, "Scale", sop.Scale); |
1346 | WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation); | 1512 | WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation); |
1347 | WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition); | 1513 | WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition); |
1348 | WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL); | 1514 | WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL); |
1349 | WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL); | 1515 | WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL); |
@@ -1363,6 +1529,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1363 | UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.LastOwnerID; | 1529 | UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.LastOwnerID; |
1364 | WriteUUID(writer, "LastOwnerID", lastOwnerID, options); | 1530 | WriteUUID(writer, "LastOwnerID", lastOwnerID, options); |
1365 | 1531 | ||
1532 | UUID rezzerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.RezzerID; | ||
1533 | WriteUUID(writer, "RezzerID", rezzerID, options); | ||
1534 | |||
1366 | writer.WriteElementString("BaseMask", sop.BaseMask.ToString()); | 1535 | writer.WriteElementString("BaseMask", sop.BaseMask.ToString()); |
1367 | writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString()); | 1536 | writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString()); |
1368 | writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); | 1537 | writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); |
@@ -1370,7 +1539,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1370 | writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); | 1539 | writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); |
1371 | WriteFlags(writer, "Flags", sop.Flags.ToString(), options); | 1540 | WriteFlags(writer, "Flags", sop.Flags.ToString(), options); |
1372 | WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); | 1541 | WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); |
1373 | writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); | 1542 | writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString(Culture.FormatProvider)); |
1374 | if (sop.MediaUrl != null) | 1543 | if (sop.MediaUrl != null) |
1375 | writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); | 1544 | writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); |
1376 | WriteVector(writer, "AttachedPos", sop.AttachedPos); | 1545 | WriteVector(writer, "AttachedPos", sop.AttachedPos); |
@@ -1390,16 +1559,41 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1390 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); | 1559 | writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); |
1391 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); | 1560 | writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); |
1392 | 1561 | ||
1393 | if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) | 1562 | writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString(Culture.FormatProvider)); |
1394 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); | 1563 | |
1564 | WriteVector(writer, "Force", sop.Force); | ||
1565 | WriteVector(writer, "Torque", sop.Torque); | ||
1566 | |||
1567 | writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower()); | ||
1568 | |||
1569 | if (sop.VehicleParams != null) | ||
1570 | sop.VehicleParams.ToXml2(writer); | ||
1571 | |||
1572 | if (sop.PhysicsInertia != null) | ||
1573 | sop.PhysicsInertia.ToXml2(writer); | ||
1574 | |||
1575 | if(sop.RotationAxisLocks != 0) | ||
1576 | writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower()); | ||
1577 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); | ||
1395 | if (sop.Density != 1000.0f) | 1578 | if (sop.Density != 1000.0f) |
1396 | writer.WriteElementString("Density", sop.Density.ToString().ToLower()); | 1579 | writer.WriteElementString("Density", sop.Density.ToString(Culture.FormatProvider)); |
1397 | if (sop.Friction != 0.6f) | 1580 | if (sop.Friction != 0.6f) |
1398 | writer.WriteElementString("Friction", sop.Friction.ToString().ToLower()); | 1581 | writer.WriteElementString("Friction", sop.Friction.ToString(Culture.FormatProvider)); |
1399 | if (sop.Restitution != 0.5f) | 1582 | if (sop.Restitution != 0.5f) |
1400 | writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower()); | 1583 | writer.WriteElementString("Bounce", sop.Restitution.ToString(Culture.FormatProvider)); |
1401 | if (sop.GravityModifier != 1.0f) | 1584 | if (sop.GravityModifier != 1.0f) |
1402 | writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); | 1585 | writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString(Culture.FormatProvider)); |
1586 | WriteVector(writer, "CameraEyeOffset", sop.GetCameraEyeOffset()); | ||
1587 | WriteVector(writer, "CameraAtOffset", sop.GetCameraAtOffset()); | ||
1588 | |||
1589 | // if (sop.Sound != UUID.Zero) force it till sop crossing does clear it on child prim | ||
1590 | { | ||
1591 | WriteUUID(writer, "SoundID", sop.Sound, options); | ||
1592 | writer.WriteElementString("SoundGain", sop.SoundGain.ToString(Culture.FormatProvider)); | ||
1593 | writer.WriteElementString("SoundFlags", sop.SoundFlags.ToString().ToLower()); | ||
1594 | writer.WriteElementString("SoundRadius", sop.SoundRadius.ToString(Culture.FormatProvider)); | ||
1595 | } | ||
1596 | writer.WriteElementString("SoundQueueing", sop.SoundQueueing.ToString().ToLower()); | ||
1403 | 1597 | ||
1404 | writer.WriteEndElement(); | 1598 | writer.WriteEndElement(); |
1405 | } | 1599 | } |
@@ -1417,19 +1611,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1417 | static void WriteVector(XmlTextWriter writer, string name, Vector3 vec) | 1611 | static void WriteVector(XmlTextWriter writer, string name, Vector3 vec) |
1418 | { | 1612 | { |
1419 | writer.WriteStartElement(name); | 1613 | writer.WriteStartElement(name); |
1420 | writer.WriteElementString("X", vec.X.ToString(Utils.EnUsCulture)); | 1614 | writer.WriteElementString("X", vec.X.ToString(Culture.FormatProvider)); |
1421 | writer.WriteElementString("Y", vec.Y.ToString(Utils.EnUsCulture)); | 1615 | writer.WriteElementString("Y", vec.Y.ToString(Culture.FormatProvider)); |
1422 | writer.WriteElementString("Z", vec.Z.ToString(Utils.EnUsCulture)); | 1616 | writer.WriteElementString("Z", vec.Z.ToString(Culture.FormatProvider)); |
1423 | writer.WriteEndElement(); | 1617 | writer.WriteEndElement(); |
1424 | } | 1618 | } |
1425 | 1619 | ||
1426 | static void WriteQuaternion(XmlTextWriter writer, string name, Quaternion quat) | 1620 | static void WriteQuaternion(XmlTextWriter writer, string name, Quaternion quat) |
1427 | { | 1621 | { |
1428 | writer.WriteStartElement(name); | 1622 | writer.WriteStartElement(name); |
1429 | writer.WriteElementString("X", quat.X.ToString(Utils.EnUsCulture)); | 1623 | writer.WriteElementString("X", quat.X.ToString(Culture.FormatProvider)); |
1430 | writer.WriteElementString("Y", quat.Y.ToString(Utils.EnUsCulture)); | 1624 | writer.WriteElementString("Y", quat.Y.ToString(Culture.FormatProvider)); |
1431 | writer.WriteElementString("Z", quat.Z.ToString(Utils.EnUsCulture)); | 1625 | writer.WriteElementString("Z", quat.Z.ToString(Culture.FormatProvider)); |
1432 | writer.WriteElementString("W", quat.W.ToString(Utils.EnUsCulture)); | 1626 | writer.WriteElementString("W", quat.W.ToString(Culture.FormatProvider)); |
1433 | writer.WriteEndElement(); | 1627 | writer.WriteEndElement(); |
1434 | } | 1628 | } |
1435 | 1629 | ||
@@ -1571,22 +1765,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1571 | // Don't serialize SculptData. It's just a copy of the asset, which can be loaded separately using 'SculptTexture'. | 1765 | // Don't serialize SculptData. It's just a copy of the asset, which can be loaded separately using 'SculptTexture'. |
1572 | 1766 | ||
1573 | writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString()); | 1767 | writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString()); |
1574 | writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString()); | 1768 | writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString(Culture.FormatProvider)); |
1575 | writer.WriteElementString("FlexiDrag", shp.FlexiDrag.ToString()); | 1769 | writer.WriteElementString("FlexiDrag", shp.FlexiDrag.ToString(Culture.FormatProvider)); |
1576 | writer.WriteElementString("FlexiGravity", shp.FlexiGravity.ToString()); | 1770 | writer.WriteElementString("FlexiGravity", shp.FlexiGravity.ToString(Culture.FormatProvider)); |
1577 | writer.WriteElementString("FlexiWind", shp.FlexiWind.ToString()); | 1771 | writer.WriteElementString("FlexiWind", shp.FlexiWind.ToString(Culture.FormatProvider)); |
1578 | writer.WriteElementString("FlexiForceX", shp.FlexiForceX.ToString()); | 1772 | writer.WriteElementString("FlexiForceX", shp.FlexiForceX.ToString(Culture.FormatProvider)); |
1579 | writer.WriteElementString("FlexiForceY", shp.FlexiForceY.ToString()); | 1773 | writer.WriteElementString("FlexiForceY", shp.FlexiForceY.ToString(Culture.FormatProvider)); |
1580 | writer.WriteElementString("FlexiForceZ", shp.FlexiForceZ.ToString()); | 1774 | writer.WriteElementString("FlexiForceZ", shp.FlexiForceZ.ToString(Culture.FormatProvider)); |
1581 | 1775 | ||
1582 | writer.WriteElementString("LightColorR", shp.LightColorR.ToString()); | 1776 | writer.WriteElementString("LightColorR", shp.LightColorR.ToString(Culture.FormatProvider)); |
1583 | writer.WriteElementString("LightColorG", shp.LightColorG.ToString()); | 1777 | writer.WriteElementString("LightColorG", shp.LightColorG.ToString(Culture.FormatProvider)); |
1584 | writer.WriteElementString("LightColorB", shp.LightColorB.ToString()); | 1778 | writer.WriteElementString("LightColorB", shp.LightColorB.ToString(Culture.FormatProvider)); |
1585 | writer.WriteElementString("LightColorA", shp.LightColorA.ToString()); | 1779 | writer.WriteElementString("LightColorA", shp.LightColorA.ToString(Culture.FormatProvider)); |
1586 | writer.WriteElementString("LightRadius", shp.LightRadius.ToString()); | 1780 | writer.WriteElementString("LightRadius", shp.LightRadius.ToString(Culture.FormatProvider)); |
1587 | writer.WriteElementString("LightCutoff", shp.LightCutoff.ToString()); | 1781 | writer.WriteElementString("LightCutoff", shp.LightCutoff.ToString(Culture.FormatProvider)); |
1588 | writer.WriteElementString("LightFalloff", shp.LightFalloff.ToString()); | 1782 | writer.WriteElementString("LightFalloff", shp.LightFalloff.ToString(Culture.FormatProvider)); |
1589 | writer.WriteElementString("LightIntensity", shp.LightIntensity.ToString()); | 1783 | writer.WriteElementString("LightIntensity", shp.LightIntensity.ToString(Culture.FormatProvider)); |
1590 | 1784 | ||
1591 | writer.WriteElementString("FlexiEntry", shp.FlexiEntry.ToString().ToLower()); | 1785 | writer.WriteElementString("FlexiEntry", shp.FlexiEntry.ToString().ToLower()); |
1592 | writer.WriteElementString("LightEntry", shp.LightEntry.ToString().ToLower()); | 1786 | writer.WriteElementString("LightEntry", shp.LightEntry.ToString().ToLower()); |
@@ -1619,6 +1813,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1619 | 1813 | ||
1620 | reader.ReadEndElement(); // SceneObjectPart | 1814 | reader.ReadEndElement(); // SceneObjectPart |
1621 | 1815 | ||
1816 | obj.AggregateInnerPerms(); | ||
1622 | // m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID); | 1817 | // m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID); |
1623 | return obj; | 1818 | return obj; |
1624 | } | 1819 | } |
@@ -1627,12 +1822,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1627 | { | 1822 | { |
1628 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); | 1823 | TaskInventoryDictionary tinv = new TaskInventoryDictionary(); |
1629 | 1824 | ||
1630 | if (reader.IsEmptyElement) | ||
1631 | { | ||
1632 | reader.Read(); | ||
1633 | return tinv; | ||
1634 | } | ||
1635 | |||
1636 | reader.ReadStartElement(name, String.Empty); | 1825 | reader.ReadStartElement(name, String.Empty); |
1637 | 1826 | ||
1638 | while (reader.Name == "TaskInventoryItem") | 1827 | while (reader.Name == "TaskInventoryItem") |