aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/Framework/Scenes/Serialization
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs317
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs14
3 files changed, 278 insertions, 83 deletions
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
78 List<SceneObjectGroup> coaObjects = coa.Objects; 78 List<SceneObjectGroup> coaObjects = coa.Objects;
79 79
80// m_log.DebugFormat( 80// m_log.DebugFormat(
81// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object", 81// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object",
82// coaObjects.Count); 82// coaObjects.Count);
83 83
84 // This is weak - we're relying on the set of coalesced objects still being identical 84 // 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
86 86
87 writer.WriteStartElement("CoalescedObject"); 87 writer.WriteStartElement("CoalescedObject");
88 88
89 writer.WriteAttributeString("x", size.X.ToString()); 89 writer.WriteAttributeString("x", size.X.ToString(Culture.FormatProvider));
90 writer.WriteAttributeString("y", size.Y.ToString()); 90 writer.WriteAttributeString("y", size.Y.ToString(Culture.FormatProvider));
91 writer.WriteAttributeString("z", size.Z.ToString()); 91 writer.WriteAttributeString("z", size.Z.ToString(Culture.FormatProvider));
92 92
93 // Embed the offsets into the group XML 93 // Embed the offsets into the group XML
94 for (int i = 0; i < coaObjects.Count; i++) 94 for (int i = 0; i < coaObjects.Count; i++)
@@ -96,13 +96,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
96 SceneObjectGroup obj = coaObjects[i]; 96 SceneObjectGroup obj = coaObjects[i];
97 97
98// m_log.DebugFormat( 98// m_log.DebugFormat(
99// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}", 99// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}",
100// i, obj.Name); 100// i, obj.Name);
101 101
102 writer.WriteStartElement("SceneObjectGroup"); 102 writer.WriteStartElement("SceneObjectGroup");
103 writer.WriteAttributeString("offsetx", offsets[i].X.ToString()); 103 writer.WriteAttributeString("offsetx", offsets[i].X.ToString(Culture.FormatProvider));
104 writer.WriteAttributeString("offsety", offsets[i].Y.ToString()); 104 writer.WriteAttributeString("offsety", offsets[i].Y.ToString(Culture.FormatProvider));
105 writer.WriteAttributeString("offsetz", offsets[i].Z.ToString()); 105 writer.WriteAttributeString("offsetz", offsets[i].Z.ToString(Culture.FormatProvider));
106 106
107 SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates); 107 SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates);
108 108
@@ -133,12 +133,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
133 { 133 {
134 using (XmlTextReader reader = new XmlTextReader(sr)) 134 using (XmlTextReader reader = new XmlTextReader(sr))
135 { 135 {
136 reader.ProhibitDtd = true;
137
136 reader.MoveToContent(); // skip possible xml declaration 138 reader.MoveToContent(); // skip possible xml declaration
137 139
138 if (reader.Name != "CoalescedObject") 140 if (reader.Name != "CoalescedObject")
139 { 141 {
140 // m_log.DebugFormat( 142 // m_log.DebugFormat(
141 // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", 143 // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false",
142 // reader.Name); 144 // reader.Name);
143 145
144 return false; 146 return false;
@@ -147,6 +149,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
147 } 149 }
148 150
149 XmlDocument doc = new XmlDocument(); 151 XmlDocument doc = new XmlDocument();
152 doc.XmlResolver=null;
150 doc.LoadXml(xml); 153 doc.LoadXml(xml);
151 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); 154 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
152 if (e == null) 155 if (e == null)
@@ -166,10 +169,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
166 } 169 }
167 else 170 else
168 { 171 {
169 // XXX: Possibly we should fail outright here rather than continuing if a particular component of the 172 // XXX: Possibly we should fail outright here rather than continuing if a particular component of the
170 // coalesced object fails to load. 173 // coalesced object fails to load.
171 m_log.WarnFormat( 174 m_log.WarnFormat(
172 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.", 175 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.",
173 i); 176 i);
174 } 177 }
175 178
@@ -178,9 +181,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
178 } 181 }
179 catch (Exception e) 182 catch (Exception e)
180 { 183 {
181 m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed "); 184 m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e);
182//// m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e); 185 Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml);
183//// Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml);
184 return false; 186 return false;
185 } 187 }
186 188
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
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 ", e);
74//// m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e); 75 Util.LogFailedXML("[SERIALIZER]:", fixedData);
75//// Util.LogFailedXML("[SERIALIZER]:", fixedData);
76 return null; 76 return null;
77 } 77 }
78 } 78 }
@@ -110,12 +110,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
110 } 110 }
111 } 111 }
112 while (reader.ReadToNextSibling("Part")); 112 while (reader.ReadToNextSibling("Part"));
113 reader.ReadEndElement();
113 } 114 }
114 115
116 if (reader.Name == "KeyframeMotion" && reader.NodeType == XmlNodeType.Element)
117 {
118
119 string innerkeytxt = reader.ReadElementContentAsString();
120 sceneObject.RootPart.KeyframeMotion =
121 KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(innerkeytxt));
122 }
123 else
124 sceneObject.RootPart.KeyframeMotion = null;
125
115 // Script state may, or may not, exist. Not having any, is NOT 126 // Script state may, or may not, exist. Not having any, is NOT
116 // ever a problem. 127 // ever a problem.
117 sceneObject.LoadScriptState(reader); 128 sceneObject.LoadScriptState(reader);
118 129
130 sceneObject.InvalidateDeepEffectivePerms();
119 return sceneObject; 131 return sceneObject;
120 } 132 }
121 133
@@ -211,9 +223,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
211 223
212 writer.WriteEndElement(); // OtherParts 224 writer.WriteEndElement(); // OtherParts
213 225
226 if (sceneObject.RootPart.KeyframeMotion != null)
227 {
228 Byte[] data = sceneObject.RootPart.KeyframeMotion.Serialize();
229
230 writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
231 writer.WriteBase64(data, 0, data.Length);
232 writer.WriteEndElement();
233 }
234
214 if (doScriptStates) 235 if (doScriptStates)
215 sceneObject.SaveScriptedState(writer); 236 sceneObject.SaveScriptedState(writer);
216 237
238
217 if (!noRootElement) 239 if (!noRootElement)
218 writer.WriteEndElement(); // SceneObjectGroup 240 writer.WriteEndElement(); // SceneObjectGroup
219 241
@@ -233,6 +255,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
233 try 255 try
234 { 256 {
235 XmlDocument doc = new XmlDocument(); 257 XmlDocument doc = new XmlDocument();
258 doc.XmlResolver=null;
236 doc.LoadXml(xmlData); 259 doc.LoadXml(xmlData);
237 260
238 XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); 261 XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart");
@@ -244,18 +267,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
244 return null; 267 return null;
245 } 268 }
246 269
247 StringReader sr = new StringReader(parts[0].OuterXml); 270 SceneObjectGroup sceneObject;
248 XmlTextReader reader = new XmlTextReader(sr); 271 using(StringReader sr = new StringReader(parts[0].OuterXml))
249 SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); 272 {
250 reader.Close(); 273 using(XmlTextReader reader = new XmlTextReader(sr))
251 sr.Close(); 274 {
275 reader.ProhibitDtd = true;
276
277 sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader));
278 }
279 }
252 280
253 // Then deal with the rest 281 // Then deal with the rest
282 SceneObjectPart part;
254 for (int i = 1; i < parts.Count; i++) 283 for (int i = 1; i < parts.Count; i++)
255 { 284 {
256 sr = new StringReader(parts[i].OuterXml); 285 using(StringReader sr = new StringReader(parts[i].OuterXml))
257 reader = new XmlTextReader(sr); 286 {
258 SceneObjectPart part = SceneObjectPart.FromXml(reader); 287 using(XmlTextReader reader = new XmlTextReader(sr))
288 {
289 part = SceneObjectPart.FromXml(reader);
290 }
291 }
259 292
260 int originalLinkNum = part.LinkNum; 293 int originalLinkNum = part.LinkNum;
261 294
@@ -266,8 +299,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
266 if (originalLinkNum != 0) 299 if (originalLinkNum != 0)
267 part.LinkNum = originalLinkNum; 300 part.LinkNum = originalLinkNum;
268 301
269 reader.Close();
270 sr.Close();
271 } 302 }
272 303
273 XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion"); 304 XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion");
@@ -279,14 +310,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
279 // Script state may, or may not, exist. Not having any, is NOT 310 // Script state may, or may not, exist. Not having any, is NOT
280 // ever a problem. 311 // ever a problem.
281 sceneObject.LoadScriptState(doc); 312 sceneObject.LoadScriptState(doc);
282 313// sceneObject.AggregatePerms();
283 return sceneObject; 314 return sceneObject;
284 } 315 }
285 catch (Exception e) 316 catch (Exception e)
286 { 317 {
287 m_log.Error("[SERIALIZER]: Deserialization of xml failed "); 318 m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e);
288//// m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e); 319 Util.LogFailedXML("[SERIALIZER]:", xmlData);
289//// Util.LogFailedXML("[SERIALIZER]:", xmlData);
290 return null; 320 return null;
291 } 321 }
292 } 322 }
@@ -309,7 +339,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
309 } 339 }
310 } 340 }
311 341
312
313 /// <summary> 342 /// <summary>
314 /// Modifies a SceneObjectGroup. 343 /// Modifies a SceneObjectGroup.
315 /// </summary> 344 /// </summary>
@@ -330,7 +359,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
330 CoalescedSceneObjects coa = null; 359 CoalescedSceneObjects coa = null;
331 360
332 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); 361 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data));
333
334 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) 362 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa))
335 { 363 {
336 // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); 364 // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
@@ -376,7 +404,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
376 return data; 404 return data;
377 } 405 }
378 406
379
380 #region manual serialization 407 #region manual serialization
381 408
382 private static Dictionary<string, Action<SceneObjectPart, XmlReader>> m_SOPXmlProcessors 409 private static Dictionary<string, Action<SceneObjectPart, XmlReader>> m_SOPXmlProcessors
@@ -433,6 +460,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
433 m_SOPXmlProcessors.Add("GroupID", ProcessGroupID); 460 m_SOPXmlProcessors.Add("GroupID", ProcessGroupID);
434 m_SOPXmlProcessors.Add("OwnerID", ProcessOwnerID); 461 m_SOPXmlProcessors.Add("OwnerID", ProcessOwnerID);
435 m_SOPXmlProcessors.Add("LastOwnerID", ProcessLastOwnerID); 462 m_SOPXmlProcessors.Add("LastOwnerID", ProcessLastOwnerID);
463 m_SOPXmlProcessors.Add("RezzerID", ProcessRezzerID);
436 m_SOPXmlProcessors.Add("BaseMask", ProcessBaseMask); 464 m_SOPXmlProcessors.Add("BaseMask", ProcessBaseMask);
437 m_SOPXmlProcessors.Add("OwnerMask", ProcessOwnerMask); 465 m_SOPXmlProcessors.Add("OwnerMask", ProcessOwnerMask);
438 m_SOPXmlProcessors.Add("GroupMask", ProcessGroupMask); 466 m_SOPXmlProcessors.Add("GroupMask", ProcessGroupMask);
@@ -452,11 +480,29 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
452 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); 480 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
453 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); 481 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
454 482
483 m_SOPXmlProcessors.Add("Buoyancy", ProcessBuoyancy);
484 m_SOPXmlProcessors.Add("Force", ProcessForce);
485 m_SOPXmlProcessors.Add("Torque", ProcessTorque);
486 m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive);
487
488 m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle);
489
490 m_SOPXmlProcessors.Add("PhysicsInertia", ProcessPhysicsInertia);
491
492 m_SOPXmlProcessors.Add("RotationAxisLocks", ProcessRotationAxisLocks);
455 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); 493 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
456 m_SOPXmlProcessors.Add("Density", ProcessDensity); 494 m_SOPXmlProcessors.Add("Density", ProcessDensity);
457 m_SOPXmlProcessors.Add("Friction", ProcessFriction); 495 m_SOPXmlProcessors.Add("Friction", ProcessFriction);
458 m_SOPXmlProcessors.Add("Bounce", ProcessBounce); 496 m_SOPXmlProcessors.Add("Bounce", ProcessBounce);
459 m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); 497 m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier);
498 m_SOPXmlProcessors.Add("CameraEyeOffset", ProcessCameraEyeOffset);
499 m_SOPXmlProcessors.Add("CameraAtOffset", ProcessCameraAtOffset);
500
501 m_SOPXmlProcessors.Add("SoundID", ProcessSoundID);
502 m_SOPXmlProcessors.Add("SoundGain", ProcessSoundGain);
503 m_SOPXmlProcessors.Add("SoundFlags", ProcessSoundFlags);
504 m_SOPXmlProcessors.Add("SoundRadius", ProcessSoundRadius);
505 m_SOPXmlProcessors.Add("SoundQueueing", ProcessSoundQueueing);
460 506
461 #endregion 507 #endregion
462 508
@@ -686,6 +732,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
686 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); 732 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
687 } 733 }
688 734
735 private static void ProcessRotationAxisLocks(SceneObjectPart obj, XmlReader reader)
736 {
737 obj.RotationAxisLocks = (byte)reader.ReadElementContentAsInt("RotationAxisLocks", String.Empty);
738 }
739
689 private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlReader reader) 740 private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlReader reader)
690 { 741 {
691 obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty); 742 obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty);
@@ -711,6 +762,75 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
711 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); 762 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
712 } 763 }
713 764
765 private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlReader reader)
766 {
767 obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset"));
768 }
769
770 private static void ProcessCameraAtOffset(SceneObjectPart obj, XmlReader reader)
771 {
772 obj.SetCameraAtOffset(Util.ReadVector(reader, "CameraAtOffset"));
773 }
774
775 private static void ProcessSoundID(SceneObjectPart obj, XmlReader reader)
776 {
777 obj.Sound = Util.ReadUUID(reader, "SoundID");
778 }
779
780 private static void ProcessSoundGain(SceneObjectPart obj, XmlReader reader)
781 {
782 obj.SoundGain = reader.ReadElementContentAsDouble("SoundGain", String.Empty);
783 }
784
785 private static void ProcessSoundFlags(SceneObjectPart obj, XmlReader reader)
786 {
787 obj.SoundFlags = (byte)reader.ReadElementContentAsInt("SoundFlags", String.Empty);
788 }
789
790 private static void ProcessSoundRadius(SceneObjectPart obj, XmlReader reader)
791 {
792 obj.SoundRadius = reader.ReadElementContentAsDouble("SoundRadius", String.Empty);
793 }
794
795 private static void ProcessSoundQueueing(SceneObjectPart obj, XmlReader reader)
796 {
797 obj.SoundQueueing = Util.ReadBoolean(reader);
798 }
799
800 private static void ProcessVehicle(SceneObjectPart obj, XmlReader reader)
801 {
802 SOPVehicle vehicle = SOPVehicle.FromXml2(reader);
803
804 if (vehicle == null)
805 {
806 obj.VehicleParams = null;
807 m_log.DebugFormat(
808 "[SceneObjectSerializer]: Parsing Vehicle for object part {0} {1} encountered errors. Please see earlier log entries.",
809 obj.Name, obj.UUID);
810 }
811 else
812 {
813 obj.VehicleParams = vehicle;
814 }
815 }
816
817 private static void ProcessPhysicsInertia(SceneObjectPart obj, XmlReader reader)
818 {
819 PhysicsInertiaData pdata = PhysicsInertiaData.FromXml2(reader);
820
821 if (pdata == null)
822 {
823 obj.PhysicsInertia = null;
824 m_log.DebugFormat(
825 "[SceneObjectSerializer]: Parsing PhysicsInertiaData for object part {0} {1} encountered errors. Please see earlier log entries.",
826 obj.Name, obj.UUID);
827 }
828 else
829 {
830 obj.PhysicsInertia = pdata;
831 }
832 }
833
714 private static void ProcessShape(SceneObjectPart obj, XmlReader reader) 834 private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
715 { 835 {
716 List<string> errorNodeNames; 836 List<string> errorNodeNames;
@@ -795,6 +915,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
795 obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); 915 obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
796 } 916 }
797 917
918 private static void ProcessRezzerID(SceneObjectPart obj, XmlReader reader)
919 {
920 obj.RezzerID = Util.ReadUUID(reader, "RezzerID");
921 }
922
798 private static void ProcessBaseMask(SceneObjectPart obj, XmlReader reader) 923 private static void ProcessBaseMask(SceneObjectPart obj, XmlReader reader)
799 { 924 {
800 obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty); 925 obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty);
@@ -885,6 +1010,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
885 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); 1010 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty);
886 } 1011 }
887 1012
1013 private static void ProcessBuoyancy(SceneObjectPart obj, XmlReader reader)
1014 {
1015 obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty);
1016 }
1017
1018 private static void ProcessForce(SceneObjectPart obj, XmlReader reader)
1019 {
1020 obj.Force = Util.ReadVector(reader, "Force");
1021 }
1022 private static void ProcessTorque(SceneObjectPart obj, XmlReader reader)
1023 {
1024 obj.Torque = Util.ReadVector(reader, "Torque");
1025 }
1026
1027 private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlReader reader)
1028 {
1029 obj.VolumeDetectActive = Util.ReadBoolean(reader);
1030 }
1031
888 #endregion 1032 #endregion
889 1033
890 #region TaskInventoryXmlProcessors 1034 #region TaskInventoryXmlProcessors
@@ -1249,8 +1393,27 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1249 1393
1250 private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader) 1394 private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader)
1251 { 1395 {
1252 string value = reader.ReadElementContentAsString("Media", String.Empty); 1396 string value = String.Empty;
1253 shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); 1397 try
1398 {
1399 // The STANDARD content of Media elemet is escaped XML string (with &gt; etc).
1400 value = reader.ReadElementContentAsString("Media", String.Empty);
1401 shp.Media = PrimitiveBaseShape.MediaList.FromXml(value);
1402 }
1403 catch (XmlException e)
1404 {
1405 // There are versions of OAR files that contain unquoted XML.
1406 // ie ONE comercial fork that never wanted their oars to be read by our code
1407 try
1408 {
1409 value = reader.ReadInnerXml();
1410 shp.Media = PrimitiveBaseShape.MediaList.FromXml(value);
1411 }
1412 catch
1413 {
1414 m_log.ErrorFormat("[SERIALIZER] Failed parsing halcyon MOAP information");
1415 }
1416 }
1254 } 1417 }
1255 1418
1256 #endregion 1419 #endregion
@@ -1280,6 +1443,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1280 writer.WriteEndElement(); 1443 writer.WriteEndElement();
1281 } 1444 }
1282 1445
1446
1283 writer.WriteEndElement(); 1447 writer.WriteEndElement();
1284 } 1448 }
1285 1449
@@ -1327,10 +1491,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1327 writer.WriteElementString("Description", sop.Description); 1491 writer.WriteElementString("Description", sop.Description);
1328 1492
1329 writer.WriteStartElement("Color"); 1493 writer.WriteStartElement("Color");
1330 writer.WriteElementString("R", sop.Color.R.ToString(Utils.EnUsCulture)); 1494 writer.WriteElementString("R", sop.Color.R.ToString(Culture.FormatProvider));
1331 writer.WriteElementString("G", sop.Color.G.ToString(Utils.EnUsCulture)); 1495 writer.WriteElementString("G", sop.Color.G.ToString(Culture.FormatProvider));
1332 writer.WriteElementString("B", sop.Color.B.ToString(Utils.EnUsCulture)); 1496 writer.WriteElementString("B", sop.Color.B.ToString(Culture.FormatProvider));
1333 writer.WriteElementString("A", sop.Color.A.ToString(Utils.EnUsCulture)); 1497 writer.WriteElementString("A", sop.Color.A.ToString(Culture.FormatProvider));
1334 writer.WriteEndElement(); 1498 writer.WriteEndElement();
1335 1499
1336 writer.WriteElementString("Text", sop.Text); 1500 writer.WriteElementString("Text", sop.Text);
@@ -1343,7 +1507,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1343 WriteShape(writer, sop.Shape, options); 1507 WriteShape(writer, sop.Shape, options);
1344 1508
1345 WriteVector(writer, "Scale", sop.Scale); 1509 WriteVector(writer, "Scale", sop.Scale);
1346 WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation); 1510 WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation);
1347 WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition); 1511 WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition);
1348 WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL); 1512 WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL);
1349 WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL); 1513 WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL);
@@ -1363,6 +1527,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1363 UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.LastOwnerID; 1527 UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.LastOwnerID;
1364 WriteUUID(writer, "LastOwnerID", lastOwnerID, options); 1528 WriteUUID(writer, "LastOwnerID", lastOwnerID, options);
1365 1529
1530 UUID rezzerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.RezzerID;
1531 WriteUUID(writer, "RezzerID", rezzerID, options);
1532
1366 writer.WriteElementString("BaseMask", sop.BaseMask.ToString()); 1533 writer.WriteElementString("BaseMask", sop.BaseMask.ToString());
1367 writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString()); 1534 writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString());
1368 writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); 1535 writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
@@ -1370,7 +1537,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1370 writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); 1537 writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString());
1371 WriteFlags(writer, "Flags", sop.Flags.ToString(), options); 1538 WriteFlags(writer, "Flags", sop.Flags.ToString(), options);
1372 WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); 1539 WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
1373 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); 1540 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString(Culture.FormatProvider));
1374 if (sop.MediaUrl != null) 1541 if (sop.MediaUrl != null)
1375 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); 1542 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
1376 WriteVector(writer, "AttachedPos", sop.AttachedPos); 1543 WriteVector(writer, "AttachedPos", sop.AttachedPos);
@@ -1390,16 +1557,41 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1390 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); 1557 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
1391 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); 1558 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
1392 1559
1393 if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) 1560 writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString(Culture.FormatProvider));
1394 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); 1561
1562 WriteVector(writer, "Force", sop.Force);
1563 WriteVector(writer, "Torque", sop.Torque);
1564
1565 writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower());
1566
1567 if (sop.VehicleParams != null)
1568 sop.VehicleParams.ToXml2(writer);
1569
1570 if (sop.PhysicsInertia != null)
1571 sop.PhysicsInertia.ToXml2(writer);
1572
1573 if(sop.RotationAxisLocks != 0)
1574 writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower());
1575 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
1395 if (sop.Density != 1000.0f) 1576 if (sop.Density != 1000.0f)
1396 writer.WriteElementString("Density", sop.Density.ToString().ToLower()); 1577 writer.WriteElementString("Density", sop.Density.ToString(Culture.FormatProvider));
1397 if (sop.Friction != 0.6f) 1578 if (sop.Friction != 0.6f)
1398 writer.WriteElementString("Friction", sop.Friction.ToString().ToLower()); 1579 writer.WriteElementString("Friction", sop.Friction.ToString(Culture.FormatProvider));
1399 if (sop.Restitution != 0.5f) 1580 if (sop.Restitution != 0.5f)
1400 writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower()); 1581 writer.WriteElementString("Bounce", sop.Restitution.ToString(Culture.FormatProvider));
1401 if (sop.GravityModifier != 1.0f) 1582 if (sop.GravityModifier != 1.0f)
1402 writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); 1583 writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString(Culture.FormatProvider));
1584 WriteVector(writer, "CameraEyeOffset", sop.GetCameraEyeOffset());
1585 WriteVector(writer, "CameraAtOffset", sop.GetCameraAtOffset());
1586
1587 // if (sop.Sound != UUID.Zero) force it till sop crossing does clear it on child prim
1588 {
1589 WriteUUID(writer, "SoundID", sop.Sound, options);
1590 writer.WriteElementString("SoundGain", sop.SoundGain.ToString(Culture.FormatProvider));
1591 writer.WriteElementString("SoundFlags", sop.SoundFlags.ToString().ToLower());
1592 writer.WriteElementString("SoundRadius", sop.SoundRadius.ToString(Culture.FormatProvider));
1593 }
1594 writer.WriteElementString("SoundQueueing", sop.SoundQueueing.ToString().ToLower());
1403 1595
1404 writer.WriteEndElement(); 1596 writer.WriteEndElement();
1405 } 1597 }
@@ -1417,19 +1609,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1417 static void WriteVector(XmlTextWriter writer, string name, Vector3 vec) 1609 static void WriteVector(XmlTextWriter writer, string name, Vector3 vec)
1418 { 1610 {
1419 writer.WriteStartElement(name); 1611 writer.WriteStartElement(name);
1420 writer.WriteElementString("X", vec.X.ToString(Utils.EnUsCulture)); 1612 writer.WriteElementString("X", vec.X.ToString(Culture.FormatProvider));
1421 writer.WriteElementString("Y", vec.Y.ToString(Utils.EnUsCulture)); 1613 writer.WriteElementString("Y", vec.Y.ToString(Culture.FormatProvider));
1422 writer.WriteElementString("Z", vec.Z.ToString(Utils.EnUsCulture)); 1614 writer.WriteElementString("Z", vec.Z.ToString(Culture.FormatProvider));
1423 writer.WriteEndElement(); 1615 writer.WriteEndElement();
1424 } 1616 }
1425 1617
1426 static void WriteQuaternion(XmlTextWriter writer, string name, Quaternion quat) 1618 static void WriteQuaternion(XmlTextWriter writer, string name, Quaternion quat)
1427 { 1619 {
1428 writer.WriteStartElement(name); 1620 writer.WriteStartElement(name);
1429 writer.WriteElementString("X", quat.X.ToString(Utils.EnUsCulture)); 1621 writer.WriteElementString("X", quat.X.ToString(Culture.FormatProvider));
1430 writer.WriteElementString("Y", quat.Y.ToString(Utils.EnUsCulture)); 1622 writer.WriteElementString("Y", quat.Y.ToString(Culture.FormatProvider));
1431 writer.WriteElementString("Z", quat.Z.ToString(Utils.EnUsCulture)); 1623 writer.WriteElementString("Z", quat.Z.ToString(Culture.FormatProvider));
1432 writer.WriteElementString("W", quat.W.ToString(Utils.EnUsCulture)); 1624 writer.WriteElementString("W", quat.W.ToString(Culture.FormatProvider));
1433 writer.WriteEndElement(); 1625 writer.WriteEndElement();
1434 } 1626 }
1435 1627
@@ -1571,22 +1763,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'. 1763 // Don't serialize SculptData. It's just a copy of the asset, which can be loaded separately using 'SculptTexture'.
1572 1764
1573 writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString()); 1765 writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString());
1574 writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString()); 1766 writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString(Culture.FormatProvider));
1575 writer.WriteElementString("FlexiDrag", shp.FlexiDrag.ToString()); 1767 writer.WriteElementString("FlexiDrag", shp.FlexiDrag.ToString(Culture.FormatProvider));
1576 writer.WriteElementString("FlexiGravity", shp.FlexiGravity.ToString()); 1768 writer.WriteElementString("FlexiGravity", shp.FlexiGravity.ToString(Culture.FormatProvider));
1577 writer.WriteElementString("FlexiWind", shp.FlexiWind.ToString()); 1769 writer.WriteElementString("FlexiWind", shp.FlexiWind.ToString(Culture.FormatProvider));
1578 writer.WriteElementString("FlexiForceX", shp.FlexiForceX.ToString()); 1770 writer.WriteElementString("FlexiForceX", shp.FlexiForceX.ToString(Culture.FormatProvider));
1579 writer.WriteElementString("FlexiForceY", shp.FlexiForceY.ToString()); 1771 writer.WriteElementString("FlexiForceY", shp.FlexiForceY.ToString(Culture.FormatProvider));
1580 writer.WriteElementString("FlexiForceZ", shp.FlexiForceZ.ToString()); 1772 writer.WriteElementString("FlexiForceZ", shp.FlexiForceZ.ToString(Culture.FormatProvider));
1581 1773
1582 writer.WriteElementString("LightColorR", shp.LightColorR.ToString()); 1774 writer.WriteElementString("LightColorR", shp.LightColorR.ToString(Culture.FormatProvider));
1583 writer.WriteElementString("LightColorG", shp.LightColorG.ToString()); 1775 writer.WriteElementString("LightColorG", shp.LightColorG.ToString(Culture.FormatProvider));
1584 writer.WriteElementString("LightColorB", shp.LightColorB.ToString()); 1776 writer.WriteElementString("LightColorB", shp.LightColorB.ToString(Culture.FormatProvider));
1585 writer.WriteElementString("LightColorA", shp.LightColorA.ToString()); 1777 writer.WriteElementString("LightColorA", shp.LightColorA.ToString(Culture.FormatProvider));
1586 writer.WriteElementString("LightRadius", shp.LightRadius.ToString()); 1778 writer.WriteElementString("LightRadius", shp.LightRadius.ToString(Culture.FormatProvider));
1587 writer.WriteElementString("LightCutoff", shp.LightCutoff.ToString()); 1779 writer.WriteElementString("LightCutoff", shp.LightCutoff.ToString(Culture.FormatProvider));
1588 writer.WriteElementString("LightFalloff", shp.LightFalloff.ToString()); 1780 writer.WriteElementString("LightFalloff", shp.LightFalloff.ToString(Culture.FormatProvider));
1589 writer.WriteElementString("LightIntensity", shp.LightIntensity.ToString()); 1781 writer.WriteElementString("LightIntensity", shp.LightIntensity.ToString(Culture.FormatProvider));
1590 1782
1591 writer.WriteElementString("FlexiEntry", shp.FlexiEntry.ToString().ToLower()); 1783 writer.WriteElementString("FlexiEntry", shp.FlexiEntry.ToString().ToLower());
1592 writer.WriteElementString("LightEntry", shp.LightEntry.ToString().ToLower()); 1784 writer.WriteElementString("LightEntry", shp.LightEntry.ToString().ToLower());
@@ -1619,6 +1811,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1619 1811
1620 reader.ReadEndElement(); // SceneObjectPart 1812 reader.ReadEndElement(); // SceneObjectPart
1621 1813
1814 obj.AggregateInnerPerms();
1622 // m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID); 1815 // m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID);
1623 return obj; 1816 return obj;
1624 } 1817 }
@@ -1627,12 +1820,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1627 { 1820 {
1628 TaskInventoryDictionary tinv = new TaskInventoryDictionary(); 1821 TaskInventoryDictionary tinv = new TaskInventoryDictionary();
1629 1822
1630 if (reader.IsEmptyElement)
1631 {
1632 reader.Read();
1633 return tinv;
1634 }
1635
1636 reader.ReadStartElement(name, String.Empty); 1823 reader.ReadStartElement(name, String.Empty);
1637 1824
1638 while (reader.Name == "TaskInventoryItem") 1825 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
49 public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) 49 public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset)
50 { 50 {
51 XmlDocument doc = new XmlDocument(); 51 XmlDocument doc = new XmlDocument();
52 doc.XmlResolver=null;
52 XmlNode rootNode; 53 XmlNode rootNode;
53 54
54 if (fileName.StartsWith("http:") || File.Exists(fileName)) 55 if (fileName.StartsWith("http:") || File.Exists(fileName))
55 { 56 {
56 XmlTextReader reader = new XmlTextReader(fileName); 57 using(XmlTextReader reader = new XmlTextReader(fileName))
57 reader.WhitespaceHandling = WhitespaceHandling.None; 58 {
58 doc.Load(reader); 59 reader.WhitespaceHandling = WhitespaceHandling.None;
59 reader.Close(); 60 reader.ProhibitDtd = true;
61
62 doc.Load(reader);
63 }
60 rootNode = doc.FirstChild; 64 rootNode = doc.FirstChild;
61 foreach (XmlNode aPrimNode in rootNode.ChildNodes) 65 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
62 { 66 {
@@ -70,6 +74,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
70 //obj.RegenerateFullIDs(); 74 //obj.RegenerateFullIDs();
71 75
72 scene.AddNewSceneObject(obj, true); 76 scene.AddNewSceneObject(obj, true);
77 obj.InvalidateDeepEffectivePerms();
73 } 78 }
74 } 79 }
75 else 80 else
@@ -265,6 +270,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
265 foreach (XmlNode aPrimNode in rootNode.ChildNodes) 270 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
266 { 271 {
267 SceneObjectGroup obj = DeserializeGroupFromXml2(aPrimNode.OuterXml); 272 SceneObjectGroup obj = DeserializeGroupFromXml2(aPrimNode.OuterXml);
273 scene.AddNewSceneObject(obj, true);
268 if (startScripts) 274 if (startScripts)
269 sceneObjects.Add(obj); 275 sceneObjects.Add(obj);
270 } 276 }