aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs87
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs604
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs2
3 files changed, 423 insertions, 270 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
index 5cb271d..998789d 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
@@ -119,21 +119,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
119 return output; 119 return output;
120 } 120 }
121 } 121 }
122 122
123 public static bool TryFromXml(string xml, out CoalescedSceneObjects coa) 123 public static bool TryFromXml(string xml, out CoalescedSceneObjects coa)
124 { 124 {
125// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); 125// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml);
126 126
127 coa = null; 127 coa = null;
128 int i = 0;
129 128
130 using (StringReader sr = new StringReader(xml)) 129 try
131 { 130 {
132 using (XmlTextReader reader = new XmlTextReader(sr)) 131 // Quickly check if this is a coalesced object, without fully parsing the XML
133 { 132 using (StringReader sr = new StringReader(xml))
134 try 133 {
134 using (XmlTextReader reader = new XmlTextReader(sr))
135 { 135 {
136 reader.Read(); 136 reader.MoveToContent(); // skip possible xml declaration
137
137 if (reader.Name != "CoalescedObject") 138 if (reader.Name != "CoalescedObject")
138 { 139 {
139 // m_log.DebugFormat( 140 // m_log.DebugFormat(
@@ -142,49 +143,47 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
142 143
143 return false; 144 return false;
144 } 145 }
145 146 }
146 coa = new CoalescedSceneObjects(UUID.Zero); 147 }
147 reader.Read();
148
149 while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "CoalescedObject")
150 {
151 if (reader.Name == "SceneObjectGroup")
152 {
153 string soXml = reader.ReadOuterXml();
154
155 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(soXml);
156
157 if (so != null)
158 {
159 coa.Add(so);
160 }
161 else
162 {
163 // XXX: Possibly we should fail outright here rather than continuing if a particular component of the
164 // coalesced object fails to load.
165 m_log.WarnFormat(
166 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.",
167 i);
168 }
169 148
170 i++; 149 XmlDocument doc = new XmlDocument();
171 } 150 doc.LoadXml(xml);
172 } 151 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
152 if (e == null)
153 return false;
173 154
174 reader.ReadEndElement(); // CoalescedObject 155 coa = new CoalescedSceneObjects(UUID.Zero);
156
157 XmlNodeList groups = e.SelectNodes("SceneObjectGroup");
158 int i = 0;
159
160 foreach (XmlNode n in groups)
161 {
162 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
163 if (so != null)
164 {
165 coa.Add(so);
175 } 166 }
176 catch (Exception e) 167 else
177 { 168 {
178 m_log.ErrorFormat( 169 // XXX: Possibly we should fail outright here rather than continuing if a particular component of the
179 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed with {0} {1}", 170 // coalesced object fails to load.
180 e.Message, e.StackTrace); 171 m_log.WarnFormat(
181 172 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.",
182 return false; 173 i);
183 } 174 }
175
176 i++;
184 } 177 }
185 } 178 }
179 catch (Exception e)
180 {
181 m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e);
182 Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml);
183 return false;
184 }
186 185
187 return true; 186 return true;
188 } 187 }
189 } 188 }
190} \ No newline at end of file 189}
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 2d4c60a..4caa9cb 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -38,6 +38,7 @@ using OpenSim.Framework;
38using OpenSim.Framework.Serialization.External; 38using OpenSim.Framework.Serialization.External;
39using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces;
41 42
42namespace OpenSim.Region.Framework.Scenes.Serialization 43namespace OpenSim.Region.Framework.Scenes.Serialization
43{ 44{
@@ -51,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 53
53 private static IUserManagement m_UserManagement; 54 private static IUserManagement m_UserManagement;
54 55
55 /// <summary> 56 /// <summary>
56 /// Deserialize a scene object from the original xml format 57 /// Deserialize a scene object from the original xml format
57 /// </summary> 58 /// </summary>
@@ -59,57 +60,62 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
59 /// <returns>The scene object deserialized. Null on failure.</returns> 60 /// <returns>The scene object deserialized. Null on failure.</returns>
60 public static SceneObjectGroup FromOriginalXmlFormat(string xmlData) 61 public static SceneObjectGroup FromOriginalXmlFormat(string xmlData)
61 { 62 {
62 //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); 63 String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData);
63 //int time = System.Environment.TickCount; 64 using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null))
64
65 try
66 { 65 {
67 StringReader sr; 66 using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
68 XmlTextReader reader; 67 {
69 XmlNodeList parts; 68 try {
70 XmlDocument doc; 69 return FromOriginalXmlFormat(reader);
71 int linkNum; 70 }
72 71 catch (Exception e)
73 doc = new XmlDocument(); 72 {
74 doc.LoadXml(xmlData); 73 m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e);
75 parts = doc.GetElementsByTagName("RootPart"); 74 Util.LogFailedXML("[SERIALIZER]:", fixedData);
75 return null;
76 }
77 }
78 }
79 }
76 80
77 if (parts.Count == 0) 81 /// <summary>
78 throw new Exception("Invalid Xml format - no root part"); 82 /// Deserialize a scene object from the original xml format
83 /// </summary>
84 /// <param name="xmlData"></param>
85 /// <returns>The scene object deserialized. Null on failure.</returns>
86 public static SceneObjectGroup FromOriginalXmlFormat(XmlReader reader)
87 {
88 //m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
89 //int time = System.Environment.TickCount;
79 90
80 sr = new StringReader(parts[0].InnerXml); 91 int linkNum;
81 reader = new XmlTextReader(sr);
82 SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader));
83 reader.Close();
84 sr.Close();
85 92
86 parts = doc.GetElementsByTagName("Part"); 93 reader.ReadToFollowing("RootPart");
94 reader.ReadToFollowing("SceneObjectPart");
95 SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader));
96 reader.ReadToFollowing("OtherParts");
87 97
88 for (int i = 0; i < parts.Count; i++) 98 if (reader.ReadToDescendant("Part"))
99 {
100 do
89 { 101 {
90 sr = new StringReader(parts[i].InnerXml); 102 if (reader.ReadToDescendant("SceneObjectPart"))
91 reader = new XmlTextReader(sr); 103 {
92 SceneObjectPart part = SceneObjectPart.FromXml(reader); 104 SceneObjectPart part = SceneObjectPart.FromXml(reader);
93 linkNum = part.LinkNum; 105 linkNum = part.LinkNum;
94 sceneObject.AddPart(part); 106 sceneObject.AddPart(part);
95 part.LinkNum = linkNum; 107 part.LinkNum = linkNum;
96 part.TrimPermissions(); 108 part.TrimPermissions();
97 reader.Close(); 109 }
98 sr.Close(); 110 }
99 } 111 while (reader.ReadToNextSibling("Part"));
112 }
100 113
101 // Script state may, or may not, exist. Not having any, is NOT 114 // Script state may, or may not, exist. Not having any, is NOT
102 // ever a problem. 115 // ever a problem.
103 sceneObject.LoadScriptState(doc); 116 sceneObject.LoadScriptState(reader);
104 117
105 return sceneObject; 118 return sceneObject;
106 }
107 catch (Exception e)
108 {
109 m_log.ErrorFormat(
110 "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
111 return null;
112 }
113 } 119 }
114 120
115 /// <summary> 121 /// <summary>
@@ -232,7 +238,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
232 238
233 if (parts.Count == 0) 239 if (parts.Count == 0)
234 { 240 {
235 m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed: No SceneObjectPart nodes. xml was " + xmlData); 241 m_log.Error("[SERIALIZER]: Deserialization of xml failed: No SceneObjectPart nodes");
242 Util.LogFailedXML("[SERIALIZER]:", xmlData);
236 return null; 243 return null;
237 } 244 }
238 245
@@ -262,6 +269,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
262 sr.Close(); 269 sr.Close();
263 } 270 }
264 271
272 XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion");
273 if (keymotion.Count > 0)
274 sceneObject.RootPart.KeyframeMotion = KeyframeMotion.FromData(sceneObject, Convert.FromBase64String(keymotion[0].InnerText));
275 else
276 sceneObject.RootPart.KeyframeMotion = null;
277
265 // Script state may, or may not, exist. Not having any, is NOT 278 // Script state may, or may not, exist. Not having any, is NOT
266 // ever a problem. 279 // ever a problem.
267 sceneObject.LoadScriptState(doc); 280 sceneObject.LoadScriptState(doc);
@@ -270,7 +283,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
270 } 283 }
271 catch (Exception e) 284 catch (Exception e)
272 { 285 {
273 m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); 286 m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e);
287 Util.LogFailedXML("[SERIALIZER]:", xmlData);
274 return null; 288 return null;
275 } 289 }
276 } 290 }
@@ -293,17 +307,84 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
293 } 307 }
294 } 308 }
295 309
310
311 /// <summary>
312 /// Modifies a SceneObjectGroup.
313 /// </summary>
314 /// <param name="sog">The object</param>
315 /// <returns>Whether the object was actually modified</returns>
316 public delegate bool SceneObjectModifier(SceneObjectGroup sog);
317
318 /// <summary>
319 /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing.
320 /// </summary>
321 /// <param name="assetId">The object's UUID</param>
322 /// <param name="data">Serialized data</param>
323 /// <param name="modifier">The function to run on each SceneObjectGroup</param>
324 /// <returns>The new serialized object's data, or null if an error occurred</returns>
325 public static byte[] ModifySerializedObject(UUID assetId, byte[] data, SceneObjectModifier modifier)
326 {
327 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
328 CoalescedSceneObjects coa = null;
329
330 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data));
331
332 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa))
333 {
334 // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
335
336 if (coa.Objects.Count == 0)
337 {
338 m_log.WarnFormat("[SERIALIZER]: Aborting load of coalesced object from asset {0} as it has zero loaded components", assetId);
339 return null;
340 }
341
342 sceneObjects.AddRange(coa.Objects);
343 }
344 else
345 {
346 SceneObjectGroup deserializedObject = FromOriginalXmlFormat(xmlData);
347
348 if (deserializedObject != null)
349 {
350 sceneObjects.Add(deserializedObject);
351 }
352 else
353 {
354 m_log.WarnFormat("[SERIALIZER]: Aborting load of object from asset {0} as deserialization failed", assetId);
355 return null;
356 }
357 }
358
359 bool modified = false;
360 foreach (SceneObjectGroup sog in sceneObjects)
361 {
362 if (modifier(sog))
363 modified = true;
364 }
365
366 if (modified)
367 {
368 if (coa != null)
369 data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa));
370 else
371 data = Utils.StringToBytes(ToOriginalXmlFormat(sceneObjects[0]));
372 }
373
374 return data;
375 }
376
296 377
297 #region manual serialization 378 #region manual serialization
298 379
299 private static Dictionary<string, Action<SceneObjectPart, XmlTextReader>> m_SOPXmlProcessors 380 private static Dictionary<string, Action<SceneObjectPart, XmlReader>> m_SOPXmlProcessors
300 = new Dictionary<string, Action<SceneObjectPart, XmlTextReader>>(); 381 = new Dictionary<string, Action<SceneObjectPart, XmlReader>>();
301 382
302 private static Dictionary<string, Action<TaskInventoryItem, XmlTextReader>> m_TaskInventoryXmlProcessors 383 private static Dictionary<string, Action<TaskInventoryItem, XmlReader>> m_TaskInventoryXmlProcessors
303 = new Dictionary<string, Action<TaskInventoryItem, XmlTextReader>>(); 384 = new Dictionary<string, Action<TaskInventoryItem, XmlReader>>();
304 385
305 private static Dictionary<string, Action<PrimitiveBaseShape, XmlTextReader>> m_ShapeXmlProcessors 386 private static Dictionary<string, Action<PrimitiveBaseShape, XmlReader>> m_ShapeXmlProcessors
306 = new Dictionary<string, Action<PrimitiveBaseShape, XmlTextReader>>(); 387 = new Dictionary<string, Action<PrimitiveBaseShape, XmlReader>>();
307 388
308 static SceneObjectSerializer() 389 static SceneObjectSerializer()
309 { 390 {
@@ -359,6 +440,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
359 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); 440 m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound);
360 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); 441 m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume);
361 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); 442 m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl);
443 m_SOPXmlProcessors.Add("AttachedPos", ProcessAttachedPos);
444 m_SOPXmlProcessors.Add("DynAttrs", ProcessDynAttrs);
362 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); 445 m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation);
363 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); 446 m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
364 m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0); 447 m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0);
@@ -366,6 +449,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
366 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); 449 m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2);
367 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); 450 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
368 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); 451 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
452
453 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
454 m_SOPXmlProcessors.Add("Density", ProcessDensity);
455 m_SOPXmlProcessors.Add("Friction", ProcessFriction);
456 m_SOPXmlProcessors.Add("Bounce", ProcessBounce);
457 m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier);
458
369 #endregion 459 #endregion
370 460
371 #region TaskInventoryXmlProcessors initialization 461 #region TaskInventoryXmlProcessors initialization
@@ -419,12 +509,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
419 m_ShapeXmlProcessors.Add("ProfileEnd", ProcessShpProfileEnd); 509 m_ShapeXmlProcessors.Add("ProfileEnd", ProcessShpProfileEnd);
420 m_ShapeXmlProcessors.Add("ProfileHollow", ProcessShpProfileHollow); 510 m_ShapeXmlProcessors.Add("ProfileHollow", ProcessShpProfileHollow);
421 m_ShapeXmlProcessors.Add("Scale", ProcessShpScale); 511 m_ShapeXmlProcessors.Add("Scale", ProcessShpScale);
512 m_ShapeXmlProcessors.Add("LastAttachPoint", ProcessShpLastAttach);
422 m_ShapeXmlProcessors.Add("State", ProcessShpState); 513 m_ShapeXmlProcessors.Add("State", ProcessShpState);
423 m_ShapeXmlProcessors.Add("ProfileShape", ProcessShpProfileShape); 514 m_ShapeXmlProcessors.Add("ProfileShape", ProcessShpProfileShape);
424 m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape); 515 m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape);
425 m_ShapeXmlProcessors.Add("SculptTexture", ProcessShpSculptTexture); 516 m_ShapeXmlProcessors.Add("SculptTexture", ProcessShpSculptTexture);
426 m_ShapeXmlProcessors.Add("SculptType", ProcessShpSculptType); 517 m_ShapeXmlProcessors.Add("SculptType", ProcessShpSculptType);
427 m_ShapeXmlProcessors.Add("SculptData", ProcessShpSculptData); 518 // Ignore "SculptData"; this element is deprecated
428 m_ShapeXmlProcessors.Add("FlexiSoftness", ProcessShpFlexiSoftness); 519 m_ShapeXmlProcessors.Add("FlexiSoftness", ProcessShpFlexiSoftness);
429 m_ShapeXmlProcessors.Add("FlexiTension", ProcessShpFlexiTension); 520 m_ShapeXmlProcessors.Add("FlexiTension", ProcessShpFlexiTension);
430 m_ShapeXmlProcessors.Add("FlexiDrag", ProcessShpFlexiDrag); 521 m_ShapeXmlProcessors.Add("FlexiDrag", ProcessShpFlexiDrag);
@@ -449,112 +540,112 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
449 } 540 }
450 541
451 #region SOPXmlProcessors 542 #region SOPXmlProcessors
452 private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader) 543 private static void ProcessAllowedDrop(SceneObjectPart obj, XmlReader reader)
453 { 544 {
454 obj.AllowedDrop = Util.ReadBoolean(reader); 545 obj.AllowedDrop = Util.ReadBoolean(reader);
455 } 546 }
456 547
457 private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader) 548 private static void ProcessCreatorID(SceneObjectPart obj, XmlReader reader)
458 { 549 {
459 obj.CreatorID = Util.ReadUUID(reader, "CreatorID"); 550 obj.CreatorID = Util.ReadUUID(reader, "CreatorID");
460 } 551 }
461 552
462 private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader) 553 private static void ProcessCreatorData(SceneObjectPart obj, XmlReader reader)
463 { 554 {
464 obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); 555 obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty);
465 } 556 }
466 557
467 private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader) 558 private static void ProcessFolderID(SceneObjectPart obj, XmlReader reader)
468 { 559 {
469 obj.FolderID = Util.ReadUUID(reader, "FolderID"); 560 obj.FolderID = Util.ReadUUID(reader, "FolderID");
470 } 561 }
471 562
472 private static void ProcessInventorySerial(SceneObjectPart obj, XmlTextReader reader) 563 private static void ProcessInventorySerial(SceneObjectPart obj, XmlReader reader)
473 { 564 {
474 obj.InventorySerial = (uint)reader.ReadElementContentAsInt("InventorySerial", String.Empty); 565 obj.InventorySerial = (uint)reader.ReadElementContentAsInt("InventorySerial", String.Empty);
475 } 566 }
476 567
477 private static void ProcessTaskInventory(SceneObjectPart obj, XmlTextReader reader) 568 private static void ProcessTaskInventory(SceneObjectPart obj, XmlReader reader)
478 { 569 {
479 obj.TaskInventory = ReadTaskInventory(reader, "TaskInventory"); 570 obj.TaskInventory = ReadTaskInventory(reader, "TaskInventory");
480 } 571 }
481 572
482 private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader) 573 private static void ProcessUUID(SceneObjectPart obj, XmlReader reader)
483 { 574 {
484 obj.UUID = Util.ReadUUID(reader, "UUID"); 575 obj.UUID = Util.ReadUUID(reader, "UUID");
485 } 576 }
486 577
487 private static void ProcessLocalId(SceneObjectPart obj, XmlTextReader reader) 578 private static void ProcessLocalId(SceneObjectPart obj, XmlReader reader)
488 { 579 {
489 obj.LocalId = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty); 580 obj.LocalId = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty);
490 } 581 }
491 582
492 private static void ProcessName(SceneObjectPart obj, XmlTextReader reader) 583 private static void ProcessName(SceneObjectPart obj, XmlReader reader)
493 { 584 {
494 obj.Name = reader.ReadElementString("Name"); 585 obj.Name = reader.ReadElementString("Name");
495 } 586 }
496 587
497 private static void ProcessMaterial(SceneObjectPart obj, XmlTextReader reader) 588 private static void ProcessMaterial(SceneObjectPart obj, XmlReader reader)
498 { 589 {
499 obj.Material = (byte)reader.ReadElementContentAsInt("Material", String.Empty); 590 obj.Material = (byte)reader.ReadElementContentAsInt("Material", String.Empty);
500 } 591 }
501 592
502 private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader) 593 private static void ProcessPassTouches(SceneObjectPart obj, XmlReader reader)
503 { 594 {
504 obj.PassTouches = Util.ReadBoolean(reader); 595 obj.PassTouches = Util.ReadBoolean(reader);
505 } 596 }
506 597
507 private static void ProcessPassCollisions(SceneObjectPart obj, XmlTextReader reader) 598 private static void ProcessPassCollisions(SceneObjectPart obj, XmlReader reader)
508 { 599 {
509 obj.PassCollisions = Util.ReadBoolean(reader); 600 obj.PassCollisions = Util.ReadBoolean(reader);
510 } 601 }
511 602
512 private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader) 603 private static void ProcessRegionHandle(SceneObjectPart obj, XmlReader reader)
513 { 604 {
514 obj.RegionHandle = (ulong)reader.ReadElementContentAsLong("RegionHandle", String.Empty); 605 obj.RegionHandle = (ulong)reader.ReadElementContentAsLong("RegionHandle", String.Empty);
515 } 606 }
516 607
517 private static void ProcessScriptAccessPin(SceneObjectPart obj, XmlTextReader reader) 608 private static void ProcessScriptAccessPin(SceneObjectPart obj, XmlReader reader)
518 { 609 {
519 obj.ScriptAccessPin = reader.ReadElementContentAsInt("ScriptAccessPin", String.Empty); 610 obj.ScriptAccessPin = reader.ReadElementContentAsInt("ScriptAccessPin", String.Empty);
520 } 611 }
521 612
522 private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader) 613 private static void ProcessGroupPosition(SceneObjectPart obj, XmlReader reader)
523 { 614 {
524 obj.GroupPosition = Util.ReadVector(reader, "GroupPosition"); 615 obj.GroupPosition = Util.ReadVector(reader, "GroupPosition");
525 } 616 }
526 617
527 private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader) 618 private static void ProcessOffsetPosition(SceneObjectPart obj, XmlReader reader)
528 { 619 {
529 obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ; 620 obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ;
530 } 621 }
531 622
532 private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader) 623 private static void ProcessRotationOffset(SceneObjectPart obj, XmlReader reader)
533 { 624 {
534 obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset"); 625 obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset");
535 } 626 }
536 627
537 private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader) 628 private static void ProcessVelocity(SceneObjectPart obj, XmlReader reader)
538 { 629 {
539 obj.Velocity = Util.ReadVector(reader, "Velocity"); 630 obj.Velocity = Util.ReadVector(reader, "Velocity");
540 } 631 }
541 632
542 private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader) 633 private static void ProcessAngularVelocity(SceneObjectPart obj, XmlReader reader)
543 { 634 {
544 obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity"); 635 obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity");
545 } 636 }
546 637
547 private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader) 638 private static void ProcessAcceleration(SceneObjectPart obj, XmlReader reader)
548 { 639 {
549 obj.Acceleration = Util.ReadVector(reader, "Acceleration"); 640 obj.Acceleration = Util.ReadVector(reader, "Acceleration");
550 } 641 }
551 642
552 private static void ProcessDescription(SceneObjectPart obj, XmlTextReader reader) 643 private static void ProcessDescription(SceneObjectPart obj, XmlReader reader)
553 { 644 {
554 obj.Description = reader.ReadElementString("Description"); 645 obj.Description = reader.ReadElementString("Description");
555 } 646 }
556 647
557 private static void ProcessColor(SceneObjectPart obj, XmlTextReader reader) 648 private static void ProcessColor(SceneObjectPart obj, XmlReader reader)
558 { 649 {
559 reader.ReadStartElement("Color"); 650 reader.ReadStartElement("Color");
560 if (reader.Name == "R") 651 if (reader.Name == "R")
@@ -568,35 +659,60 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
568 } 659 }
569 } 660 }
570 661
571 private static void ProcessText(SceneObjectPart obj, XmlTextReader reader) 662 private static void ProcessText(SceneObjectPart obj, XmlReader reader)
572 { 663 {
573 obj.Text = reader.ReadElementString("Text", String.Empty); 664 obj.Text = reader.ReadElementString("Text", String.Empty);
574 } 665 }
575 666
576 private static void ProcessSitName(SceneObjectPart obj, XmlTextReader reader) 667 private static void ProcessSitName(SceneObjectPart obj, XmlReader reader)
577 { 668 {
578 obj.SitName = reader.ReadElementString("SitName", String.Empty); 669 obj.SitName = reader.ReadElementString("SitName", String.Empty);
579 } 670 }
580 671
581 private static void ProcessTouchName(SceneObjectPart obj, XmlTextReader reader) 672 private static void ProcessTouchName(SceneObjectPart obj, XmlReader reader)
582 { 673 {
583 obj.TouchName = reader.ReadElementString("TouchName", String.Empty); 674 obj.TouchName = reader.ReadElementString("TouchName", String.Empty);
584 } 675 }
585 676
586 private static void ProcessLinkNum(SceneObjectPart obj, XmlTextReader reader) 677 private static void ProcessLinkNum(SceneObjectPart obj, XmlReader reader)
587 { 678 {
588 obj.LinkNum = reader.ReadElementContentAsInt("LinkNum", String.Empty); 679 obj.LinkNum = reader.ReadElementContentAsInt("LinkNum", String.Empty);
589 } 680 }
590 681
591 private static void ProcessClickAction(SceneObjectPart obj, XmlTextReader reader) 682 private static void ProcessClickAction(SceneObjectPart obj, XmlReader reader)
592 { 683 {
593 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); 684 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
594 } 685 }
595 686
596 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) 687 private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlReader reader)
688 {
689 obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty);
690 }
691
692 private static void ProcessDensity(SceneObjectPart obj, XmlReader reader)
693 {
694 obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty);
695 }
696
697 private static void ProcessFriction(SceneObjectPart obj, XmlReader reader)
698 {
699 obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty);
700 }
701
702 private static void ProcessBounce(SceneObjectPart obj, XmlReader reader)
703 {
704 obj.Restitution = reader.ReadElementContentAsFloat("Bounce", String.Empty);
705 }
706
707 private static void ProcessGravityModifier(SceneObjectPart obj, XmlReader reader)
708 {
709 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
710 }
711
712 private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
597 { 713 {
598 List<string> errorNodeNames; 714 List<string> errorNodeNames;
599 obj.Shape = ReadShape(reader, "Shape", out errorNodeNames); 715 obj.Shape = ReadShape(reader, "Shape", out errorNodeNames, obj);
600 716
601 if (errorNodeNames != null) 717 if (errorNodeNames != null)
602 { 718 {
@@ -606,153 +722,163 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
606 } 722 }
607 } 723 }
608 724
609 private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) 725 private static void ProcessScale(SceneObjectPart obj, XmlReader reader)
610 { 726 {
611 obj.Scale = Util.ReadVector(reader, "Scale"); 727 obj.Scale = Util.ReadVector(reader, "Scale");
612 } 728 }
613 729
614 private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlTextReader reader) 730 private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlReader reader)
615 { 731 {
616 obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation"); 732 obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation");
617 } 733 }
618 734
619 private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlTextReader reader) 735 private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlReader reader)
620 { 736 {
621 obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition"); 737 obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition");
622 } 738 }
623 739
624 private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlTextReader reader) 740 private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlReader reader)
625 { 741 {
626 obj.SitTargetPositionLL = Util.ReadVector(reader, "SitTargetPositionLL"); 742 obj.SitTargetPositionLL = Util.ReadVector(reader, "SitTargetPositionLL");
627 } 743 }
628 744
629 private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlTextReader reader) 745 private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlReader reader)
630 { 746 {
631 obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL"); 747 obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL");
632 } 748 }
633 749
634 private static void ProcessParentID(SceneObjectPart obj, XmlTextReader reader) 750 private static void ProcessParentID(SceneObjectPart obj, XmlReader reader)
635 { 751 {
636 string str = reader.ReadElementContentAsString("ParentID", String.Empty); 752 string str = reader.ReadElementContentAsString("ParentID", String.Empty);
637 obj.ParentID = Convert.ToUInt32(str); 753 obj.ParentID = Convert.ToUInt32(str);
638 } 754 }
639 755
640 private static void ProcessCreationDate(SceneObjectPart obj, XmlTextReader reader) 756 private static void ProcessCreationDate(SceneObjectPart obj, XmlReader reader)
641 { 757 {
642 obj.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty); 758 obj.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty);
643 } 759 }
644 760
645 private static void ProcessCategory(SceneObjectPart obj, XmlTextReader reader) 761 private static void ProcessCategory(SceneObjectPart obj, XmlReader reader)
646 { 762 {
647 obj.Category = (uint)reader.ReadElementContentAsInt("Category", String.Empty); 763 obj.Category = (uint)reader.ReadElementContentAsInt("Category", String.Empty);
648 } 764 }
649 765
650 private static void ProcessSalePrice(SceneObjectPart obj, XmlTextReader reader) 766 private static void ProcessSalePrice(SceneObjectPart obj, XmlReader reader)
651 { 767 {
652 obj.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty); 768 obj.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty);
653 } 769 }
654 770
655 private static void ProcessObjectSaleType(SceneObjectPart obj, XmlTextReader reader) 771 private static void ProcessObjectSaleType(SceneObjectPart obj, XmlReader reader)
656 { 772 {
657 obj.ObjectSaleType = (byte)reader.ReadElementContentAsInt("ObjectSaleType", String.Empty); 773 obj.ObjectSaleType = (byte)reader.ReadElementContentAsInt("ObjectSaleType", String.Empty);
658 } 774 }
659 775
660 private static void ProcessOwnershipCost(SceneObjectPart obj, XmlTextReader reader) 776 private static void ProcessOwnershipCost(SceneObjectPart obj, XmlReader reader)
661 { 777 {
662 obj.OwnershipCost = reader.ReadElementContentAsInt("OwnershipCost", String.Empty); 778 obj.OwnershipCost = reader.ReadElementContentAsInt("OwnershipCost", String.Empty);
663 } 779 }
664 780
665 private static void ProcessGroupID(SceneObjectPart obj, XmlTextReader reader) 781 private static void ProcessGroupID(SceneObjectPart obj, XmlReader reader)
666 { 782 {
667 obj.GroupID = Util.ReadUUID(reader, "GroupID"); 783 obj.GroupID = Util.ReadUUID(reader, "GroupID");
668 } 784 }
669 785
670 private static void ProcessOwnerID(SceneObjectPart obj, XmlTextReader reader) 786 private static void ProcessOwnerID(SceneObjectPart obj, XmlReader reader)
671 { 787 {
672 obj.OwnerID = Util.ReadUUID(reader, "OwnerID"); 788 obj.OwnerID = Util.ReadUUID(reader, "OwnerID");
673 } 789 }
674 790
675 private static void ProcessLastOwnerID(SceneObjectPart obj, XmlTextReader reader) 791 private static void ProcessLastOwnerID(SceneObjectPart obj, XmlReader reader)
676 { 792 {
677 obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); 793 obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
678 } 794 }
679 795
680 private static void ProcessBaseMask(SceneObjectPart obj, XmlTextReader reader) 796 private static void ProcessBaseMask(SceneObjectPart obj, XmlReader reader)
681 { 797 {
682 obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty); 798 obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty);
683 } 799 }
684 800
685 private static void ProcessOwnerMask(SceneObjectPart obj, XmlTextReader reader) 801 private static void ProcessOwnerMask(SceneObjectPart obj, XmlReader reader)
686 { 802 {
687 obj.OwnerMask = (uint)reader.ReadElementContentAsInt("OwnerMask", String.Empty); 803 obj.OwnerMask = (uint)reader.ReadElementContentAsInt("OwnerMask", String.Empty);
688 } 804 }
689 805
690 private static void ProcessGroupMask(SceneObjectPart obj, XmlTextReader reader) 806 private static void ProcessGroupMask(SceneObjectPart obj, XmlReader reader)
691 { 807 {
692 obj.GroupMask = (uint)reader.ReadElementContentAsInt("GroupMask", String.Empty); 808 obj.GroupMask = (uint)reader.ReadElementContentAsInt("GroupMask", String.Empty);
693 } 809 }
694 810
695 private static void ProcessEveryoneMask(SceneObjectPart obj, XmlTextReader reader) 811 private static void ProcessEveryoneMask(SceneObjectPart obj, XmlReader reader)
696 { 812 {
697 obj.EveryoneMask = (uint)reader.ReadElementContentAsInt("EveryoneMask", String.Empty); 813 obj.EveryoneMask = (uint)reader.ReadElementContentAsInt("EveryoneMask", String.Empty);
698 } 814 }
699 815
700 private static void ProcessNextOwnerMask(SceneObjectPart obj, XmlTextReader reader) 816 private static void ProcessNextOwnerMask(SceneObjectPart obj, XmlReader reader)
701 { 817 {
702 obj.NextOwnerMask = (uint)reader.ReadElementContentAsInt("NextOwnerMask", String.Empty); 818 obj.NextOwnerMask = (uint)reader.ReadElementContentAsInt("NextOwnerMask", String.Empty);
703 } 819 }
704 820
705 private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader) 821 private static void ProcessFlags(SceneObjectPart obj, XmlReader reader)
706 { 822 {
707 obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags"); 823 obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags");
708 } 824 }
709 825
710 private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader) 826 private static void ProcessCollisionSound(SceneObjectPart obj, XmlReader reader)
711 { 827 {
712 obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound"); 828 obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound");
713 } 829 }
714 830
715 private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader) 831 private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlReader reader)
716 { 832 {
717 obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty); 833 obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty);
718 } 834 }
719 835
720 private static void ProcessMediaUrl(SceneObjectPart obj, XmlTextReader reader) 836 private static void ProcessMediaUrl(SceneObjectPart obj, XmlReader reader)
721 { 837 {
722 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); 838 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty);
723 } 839 }
724 840
725 private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader) 841 private static void ProcessAttachedPos(SceneObjectPart obj, XmlReader reader)
842 {
843 obj.AttachedPos = Util.ReadVector(reader, "AttachedPos");
844 }
845
846 private static void ProcessDynAttrs(SceneObjectPart obj, XmlReader reader)
847 {
848 obj.DynAttrs.ReadXml(reader);
849 }
850
851 private static void ProcessTextureAnimation(SceneObjectPart obj, XmlReader reader)
726 { 852 {
727 obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty)); 853 obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty));
728 } 854 }
729 855
730 private static void ProcessParticleSystem(SceneObjectPart obj, XmlTextReader reader) 856 private static void ProcessParticleSystem(SceneObjectPart obj, XmlReader reader)
731 { 857 {
732 obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty)); 858 obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty));
733 } 859 }
734 860
735 private static void ProcessPayPrice0(SceneObjectPart obj, XmlTextReader reader) 861 private static void ProcessPayPrice0(SceneObjectPart obj, XmlReader reader)
736 { 862 {
737 obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty); 863 obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty);
738 } 864 }
739 865
740 private static void ProcessPayPrice1(SceneObjectPart obj, XmlTextReader reader) 866 private static void ProcessPayPrice1(SceneObjectPart obj, XmlReader reader)
741 { 867 {
742 obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty); 868 obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty);
743 } 869 }
744 870
745 private static void ProcessPayPrice2(SceneObjectPart obj, XmlTextReader reader) 871 private static void ProcessPayPrice2(SceneObjectPart obj, XmlReader reader)
746 { 872 {
747 obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty); 873 obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty);
748 } 874 }
749 875
750 private static void ProcessPayPrice3(SceneObjectPart obj, XmlTextReader reader) 876 private static void ProcessPayPrice3(SceneObjectPart obj, XmlReader reader)
751 { 877 {
752 obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty); 878 obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty);
753 } 879 }
754 880
755 private static void ProcessPayPrice4(SceneObjectPart obj, XmlTextReader reader) 881 private static void ProcessPayPrice4(SceneObjectPart obj, XmlReader reader)
756 { 882 {
757 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); 883 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty);
758 } 884 }
@@ -760,122 +886,122 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
760 #endregion 886 #endregion
761 887
762 #region TaskInventoryXmlProcessors 888 #region TaskInventoryXmlProcessors
763 private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader) 889 private static void ProcessTIAssetID(TaskInventoryItem item, XmlReader reader)
764 { 890 {
765 item.AssetID = Util.ReadUUID(reader, "AssetID"); 891 item.AssetID = Util.ReadUUID(reader, "AssetID");
766 } 892 }
767 893
768 private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader) 894 private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlReader reader)
769 { 895 {
770 item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty); 896 item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty);
771 } 897 }
772 898
773 private static void ProcessTICreationDate(TaskInventoryItem item, XmlTextReader reader) 899 private static void ProcessTICreationDate(TaskInventoryItem item, XmlReader reader)
774 { 900 {
775 item.CreationDate = (uint)reader.ReadElementContentAsInt("CreationDate", String.Empty); 901 item.CreationDate = (uint)reader.ReadElementContentAsInt("CreationDate", String.Empty);
776 } 902 }
777 903
778 private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader) 904 private static void ProcessTICreatorID(TaskInventoryItem item, XmlReader reader)
779 { 905 {
780 item.CreatorID = Util.ReadUUID(reader, "CreatorID"); 906 item.CreatorID = Util.ReadUUID(reader, "CreatorID");
781 } 907 }
782 908
783 private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader) 909 private static void ProcessTICreatorData(TaskInventoryItem item, XmlReader reader)
784 { 910 {
785 item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); 911 item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty);
786 } 912 }
787 913
788 private static void ProcessTIDescription(TaskInventoryItem item, XmlTextReader reader) 914 private static void ProcessTIDescription(TaskInventoryItem item, XmlReader reader)
789 { 915 {
790 item.Description = reader.ReadElementContentAsString("Description", String.Empty); 916 item.Description = reader.ReadElementContentAsString("Description", String.Empty);
791 } 917 }
792 918
793 private static void ProcessTIEveryonePermissions(TaskInventoryItem item, XmlTextReader reader) 919 private static void ProcessTIEveryonePermissions(TaskInventoryItem item, XmlReader reader)
794 { 920 {
795 item.EveryonePermissions = (uint)reader.ReadElementContentAsInt("EveryonePermissions", String.Empty); 921 item.EveryonePermissions = (uint)reader.ReadElementContentAsInt("EveryonePermissions", String.Empty);
796 } 922 }
797 923
798 private static void ProcessTIFlags(TaskInventoryItem item, XmlTextReader reader) 924 private static void ProcessTIFlags(TaskInventoryItem item, XmlReader reader)
799 { 925 {
800 item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty); 926 item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty);
801 } 927 }
802 928
803 private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader) 929 private static void ProcessTIGroupID(TaskInventoryItem item, XmlReader reader)
804 { 930 {
805 item.GroupID = Util.ReadUUID(reader, "GroupID"); 931 item.GroupID = Util.ReadUUID(reader, "GroupID");
806 } 932 }
807 933
808 private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader) 934 private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlReader reader)
809 { 935 {
810 item.GroupPermissions = (uint)reader.ReadElementContentAsInt("GroupPermissions", String.Empty); 936 item.GroupPermissions = (uint)reader.ReadElementContentAsInt("GroupPermissions", String.Empty);
811 } 937 }
812 938
813 private static void ProcessTIInvType(TaskInventoryItem item, XmlTextReader reader) 939 private static void ProcessTIInvType(TaskInventoryItem item, XmlReader reader)
814 { 940 {
815 item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty); 941 item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty);
816 } 942 }
817 943
818 private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader) 944 private static void ProcessTIItemID(TaskInventoryItem item, XmlReader reader)
819 { 945 {
820 item.ItemID = Util.ReadUUID(reader, "ItemID"); 946 item.ItemID = Util.ReadUUID(reader, "ItemID");
821 } 947 }
822 948
823 private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) 949 private static void ProcessTIOldItemID(TaskInventoryItem item, XmlReader reader)
824 { 950 {
825 item.OldItemID = Util.ReadUUID(reader, "OldItemID"); 951 item.OldItemID = Util.ReadUUID(reader, "OldItemID");
826 } 952 }
827 953
828 private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) 954 private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlReader reader)
829 { 955 {
830 item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); 956 item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
831 } 957 }
832 958
833 private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader) 959 private static void ProcessTIName(TaskInventoryItem item, XmlReader reader)
834 { 960 {
835 item.Name = reader.ReadElementContentAsString("Name", String.Empty); 961 item.Name = reader.ReadElementContentAsString("Name", String.Empty);
836 } 962 }
837 963
838 private static void ProcessTINextPermissions(TaskInventoryItem item, XmlTextReader reader) 964 private static void ProcessTINextPermissions(TaskInventoryItem item, XmlReader reader)
839 { 965 {
840 item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty); 966 item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty);
841 } 967 }
842 968
843 private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader) 969 private static void ProcessTIOwnerID(TaskInventoryItem item, XmlReader reader)
844 { 970 {
845 item.OwnerID = Util.ReadUUID(reader, "OwnerID"); 971 item.OwnerID = Util.ReadUUID(reader, "OwnerID");
846 } 972 }
847 973
848 private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader) 974 private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlReader reader)
849 { 975 {
850 item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty); 976 item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty);
851 } 977 }
852 978
853 private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader) 979 private static void ProcessTIParentID(TaskInventoryItem item, XmlReader reader)
854 { 980 {
855 item.ParentID = Util.ReadUUID(reader, "ParentID"); 981 item.ParentID = Util.ReadUUID(reader, "ParentID");
856 } 982 }
857 983
858 private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader) 984 private static void ProcessTIParentPartID(TaskInventoryItem item, XmlReader reader)
859 { 985 {
860 item.ParentPartID = Util.ReadUUID(reader, "ParentPartID"); 986 item.ParentPartID = Util.ReadUUID(reader, "ParentPartID");
861 } 987 }
862 988
863 private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader) 989 private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlReader reader)
864 { 990 {
865 item.PermsGranter = Util.ReadUUID(reader, "PermsGranter"); 991 item.PermsGranter = Util.ReadUUID(reader, "PermsGranter");
866 } 992 }
867 993
868 private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader) 994 private static void ProcessTIPermsMask(TaskInventoryItem item, XmlReader reader)
869 { 995 {
870 item.PermsMask = reader.ReadElementContentAsInt("PermsMask", String.Empty); 996 item.PermsMask = reader.ReadElementContentAsInt("PermsMask", String.Empty);
871 } 997 }
872 998
873 private static void ProcessTIType(TaskInventoryItem item, XmlTextReader reader) 999 private static void ProcessTIType(TaskInventoryItem item, XmlReader reader)
874 { 1000 {
875 item.Type = reader.ReadElementContentAsInt("Type", String.Empty); 1001 item.Type = reader.ReadElementContentAsInt("Type", String.Empty);
876 } 1002 }
877 1003
878 private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader) 1004 private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlReader reader)
879 { 1005 {
880 item.OwnerChanged = Util.ReadBoolean(reader); 1006 item.OwnerChanged = Util.ReadBoolean(reader);
881 } 1007 }
@@ -883,245 +1009,243 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
883 #endregion 1009 #endregion
884 1010
885 #region ShapeXmlProcessors 1011 #region ShapeXmlProcessors
886 private static void ProcessShpProfileCurve(PrimitiveBaseShape shp, XmlTextReader reader) 1012 private static void ProcessShpProfileCurve(PrimitiveBaseShape shp, XmlReader reader)
887 { 1013 {
888 shp.ProfileCurve = (byte)reader.ReadElementContentAsInt("ProfileCurve", String.Empty); 1014 shp.ProfileCurve = (byte)reader.ReadElementContentAsInt("ProfileCurve", String.Empty);
889 } 1015 }
890 1016
891 private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1017 private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlReader reader)
892 { 1018 {
893 byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry")); 1019 byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry"));
894 shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); 1020 shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length);
895 } 1021 }
896 1022
897 private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader) 1023 private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlReader reader)
898 { 1024 {
899 shp.ExtraParams = Convert.FromBase64String(reader.ReadElementString("ExtraParams")); 1025 shp.ExtraParams = Convert.FromBase64String(reader.ReadElementString("ExtraParams"));
900 } 1026 }
901 1027
902 private static void ProcessShpPathBegin(PrimitiveBaseShape shp, XmlTextReader reader) 1028 private static void ProcessShpPathBegin(PrimitiveBaseShape shp, XmlReader reader)
903 { 1029 {
904 shp.PathBegin = (ushort)reader.ReadElementContentAsInt("PathBegin", String.Empty); 1030 shp.PathBegin = (ushort)reader.ReadElementContentAsInt("PathBegin", String.Empty);
905 } 1031 }
906 1032
907 private static void ProcessShpPathCurve(PrimitiveBaseShape shp, XmlTextReader reader) 1033 private static void ProcessShpPathCurve(PrimitiveBaseShape shp, XmlReader reader)
908 { 1034 {
909 shp.PathCurve = (byte)reader.ReadElementContentAsInt("PathCurve", String.Empty); 1035 shp.PathCurve = (byte)reader.ReadElementContentAsInt("PathCurve", String.Empty);
910 } 1036 }
911 1037
912 private static void ProcessShpPathEnd(PrimitiveBaseShape shp, XmlTextReader reader) 1038 private static void ProcessShpPathEnd(PrimitiveBaseShape shp, XmlReader reader)
913 { 1039 {
914 shp.PathEnd = (ushort)reader.ReadElementContentAsInt("PathEnd", String.Empty); 1040 shp.PathEnd = (ushort)reader.ReadElementContentAsInt("PathEnd", String.Empty);
915 } 1041 }
916 1042
917 private static void ProcessShpPathRadiusOffset(PrimitiveBaseShape shp, XmlTextReader reader) 1043 private static void ProcessShpPathRadiusOffset(PrimitiveBaseShape shp, XmlReader reader)
918 { 1044 {
919 shp.PathRadiusOffset = (sbyte)reader.ReadElementContentAsInt("PathRadiusOffset", String.Empty); 1045 shp.PathRadiusOffset = (sbyte)reader.ReadElementContentAsInt("PathRadiusOffset", String.Empty);
920 } 1046 }
921 1047
922 private static void ProcessShpPathRevolutions(PrimitiveBaseShape shp, XmlTextReader reader) 1048 private static void ProcessShpPathRevolutions(PrimitiveBaseShape shp, XmlReader reader)
923 { 1049 {
924 shp.PathRevolutions = (byte)reader.ReadElementContentAsInt("PathRevolutions", String.Empty); 1050 shp.PathRevolutions = (byte)reader.ReadElementContentAsInt("PathRevolutions", String.Empty);
925 } 1051 }
926 1052
927 private static void ProcessShpPathScaleX(PrimitiveBaseShape shp, XmlTextReader reader) 1053 private static void ProcessShpPathScaleX(PrimitiveBaseShape shp, XmlReader reader)
928 { 1054 {
929 shp.PathScaleX = (byte)reader.ReadElementContentAsInt("PathScaleX", String.Empty); 1055 shp.PathScaleX = (byte)reader.ReadElementContentAsInt("PathScaleX", String.Empty);
930 } 1056 }
931 1057
932 private static void ProcessShpPathScaleY(PrimitiveBaseShape shp, XmlTextReader reader) 1058 private static void ProcessShpPathScaleY(PrimitiveBaseShape shp, XmlReader reader)
933 { 1059 {
934 shp.PathScaleY = (byte)reader.ReadElementContentAsInt("PathScaleY", String.Empty); 1060 shp.PathScaleY = (byte)reader.ReadElementContentAsInt("PathScaleY", String.Empty);
935 } 1061 }
936 1062
937 private static void ProcessShpPathShearX(PrimitiveBaseShape shp, XmlTextReader reader) 1063 private static void ProcessShpPathShearX(PrimitiveBaseShape shp, XmlReader reader)
938 { 1064 {
939 shp.PathShearX = (byte)reader.ReadElementContentAsInt("PathShearX", String.Empty); 1065 shp.PathShearX = (byte)reader.ReadElementContentAsInt("PathShearX", String.Empty);
940 } 1066 }
941 1067
942 private static void ProcessShpPathShearY(PrimitiveBaseShape shp, XmlTextReader reader) 1068 private static void ProcessShpPathShearY(PrimitiveBaseShape shp, XmlReader reader)
943 { 1069 {
944 shp.PathShearY = (byte)reader.ReadElementContentAsInt("PathShearY", String.Empty); 1070 shp.PathShearY = (byte)reader.ReadElementContentAsInt("PathShearY", String.Empty);
945 } 1071 }
946 1072
947 private static void ProcessShpPathSkew(PrimitiveBaseShape shp, XmlTextReader reader) 1073 private static void ProcessShpPathSkew(PrimitiveBaseShape shp, XmlReader reader)
948 { 1074 {
949 shp.PathSkew = (sbyte)reader.ReadElementContentAsInt("PathSkew", String.Empty); 1075 shp.PathSkew = (sbyte)reader.ReadElementContentAsInt("PathSkew", String.Empty);
950 } 1076 }
951 1077
952 private static void ProcessShpPathTaperX(PrimitiveBaseShape shp, XmlTextReader reader) 1078 private static void ProcessShpPathTaperX(PrimitiveBaseShape shp, XmlReader reader)
953 { 1079 {
954 shp.PathTaperX = (sbyte)reader.ReadElementContentAsInt("PathTaperX", String.Empty); 1080 shp.PathTaperX = (sbyte)reader.ReadElementContentAsInt("PathTaperX", String.Empty);
955 } 1081 }
956 1082
957 private static void ProcessShpPathTaperY(PrimitiveBaseShape shp, XmlTextReader reader) 1083 private static void ProcessShpPathTaperY(PrimitiveBaseShape shp, XmlReader reader)
958 { 1084 {
959 shp.PathTaperY = (sbyte)reader.ReadElementContentAsInt("PathTaperY", String.Empty); 1085 shp.PathTaperY = (sbyte)reader.ReadElementContentAsInt("PathTaperY", String.Empty);
960 } 1086 }
961 1087
962 private static void ProcessShpPathTwist(PrimitiveBaseShape shp, XmlTextReader reader) 1088 private static void ProcessShpPathTwist(PrimitiveBaseShape shp, XmlReader reader)
963 { 1089 {
964 shp.PathTwist = (sbyte)reader.ReadElementContentAsInt("PathTwist", String.Empty); 1090 shp.PathTwist = (sbyte)reader.ReadElementContentAsInt("PathTwist", String.Empty);
965 } 1091 }
966 1092
967 private static void ProcessShpPathTwistBegin(PrimitiveBaseShape shp, XmlTextReader reader) 1093 private static void ProcessShpPathTwistBegin(PrimitiveBaseShape shp, XmlReader reader)
968 { 1094 {
969 shp.PathTwistBegin = (sbyte)reader.ReadElementContentAsInt("PathTwistBegin", String.Empty); 1095 shp.PathTwistBegin = (sbyte)reader.ReadElementContentAsInt("PathTwistBegin", String.Empty);
970 } 1096 }
971 1097
972 private static void ProcessShpPCode(PrimitiveBaseShape shp, XmlTextReader reader) 1098 private static void ProcessShpPCode(PrimitiveBaseShape shp, XmlReader reader)
973 { 1099 {
974 shp.PCode = (byte)reader.ReadElementContentAsInt("PCode", String.Empty); 1100 shp.PCode = (byte)reader.ReadElementContentAsInt("PCode", String.Empty);
975 } 1101 }
976 1102
977 private static void ProcessShpProfileBegin(PrimitiveBaseShape shp, XmlTextReader reader) 1103 private static void ProcessShpProfileBegin(PrimitiveBaseShape shp, XmlReader reader)
978 { 1104 {
979 shp.ProfileBegin = (ushort)reader.ReadElementContentAsInt("ProfileBegin", String.Empty); 1105 shp.ProfileBegin = (ushort)reader.ReadElementContentAsInt("ProfileBegin", String.Empty);
980 } 1106 }
981 1107
982 private static void ProcessShpProfileEnd(PrimitiveBaseShape shp, XmlTextReader reader) 1108 private static void ProcessShpProfileEnd(PrimitiveBaseShape shp, XmlReader reader)
983 { 1109 {
984 shp.ProfileEnd = (ushort)reader.ReadElementContentAsInt("ProfileEnd", String.Empty); 1110 shp.ProfileEnd = (ushort)reader.ReadElementContentAsInt("ProfileEnd", String.Empty);
985 } 1111 }
986 1112
987 private static void ProcessShpProfileHollow(PrimitiveBaseShape shp, XmlTextReader reader) 1113 private static void ProcessShpProfileHollow(PrimitiveBaseShape shp, XmlReader reader)
988 { 1114 {
989 shp.ProfileHollow = (ushort)reader.ReadElementContentAsInt("ProfileHollow", String.Empty); 1115 shp.ProfileHollow = (ushort)reader.ReadElementContentAsInt("ProfileHollow", String.Empty);
990 } 1116 }
991 1117
992 private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader) 1118 private static void ProcessShpScale(PrimitiveBaseShape shp, XmlReader reader)
993 { 1119 {
994 shp.Scale = Util.ReadVector(reader, "Scale"); 1120 shp.Scale = Util.ReadVector(reader, "Scale");
995 } 1121 }
996 1122
997 private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader) 1123 private static void ProcessShpState(PrimitiveBaseShape shp, XmlReader reader)
998 { 1124 {
999 shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty); 1125 shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty);
1000 } 1126 }
1001 1127
1002 private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) 1128 private static void ProcessShpLastAttach(PrimitiveBaseShape shp, XmlReader reader)
1129 {
1130 shp.LastAttachPoint = (byte)reader.ReadElementContentAsInt("LastAttachPoint", String.Empty);
1131 }
1132
1133 private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlReader reader)
1003 { 1134 {
1004 shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape"); 1135 shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape");
1005 } 1136 }
1006 1137
1007 private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader) 1138 private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlReader reader)
1008 { 1139 {
1009 shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape"); 1140 shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape");
1010 } 1141 }
1011 1142
1012 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader) 1143 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlReader reader)
1013 { 1144 {
1014 shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture"); 1145 shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture");
1015 } 1146 }
1016 1147
1017 private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader) 1148 private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlReader reader)
1018 { 1149 {
1019 shp.SculptType = (byte)reader.ReadElementContentAsInt("SculptType", String.Empty); 1150 shp.SculptType = (byte)reader.ReadElementContentAsInt("SculptType", String.Empty);
1020 } 1151 }
1021 1152
1022 private static void ProcessShpSculptData(PrimitiveBaseShape shp, XmlTextReader reader) 1153 private static void ProcessShpFlexiSoftness(PrimitiveBaseShape shp, XmlReader reader)
1023 {
1024// m_log.DebugFormat("[SCENE OBJECT SERIALIZER]: Setting sculpt data length {0}", shp.SculptData.Length);
1025
1026 shp.SculptData = Convert.FromBase64String(reader.ReadElementString("SculptData"));
1027 }
1028
1029 private static void ProcessShpFlexiSoftness(PrimitiveBaseShape shp, XmlTextReader reader)
1030 { 1154 {
1031 shp.FlexiSoftness = reader.ReadElementContentAsInt("FlexiSoftness", String.Empty); 1155 shp.FlexiSoftness = reader.ReadElementContentAsInt("FlexiSoftness", String.Empty);
1032 } 1156 }
1033 1157
1034 private static void ProcessShpFlexiTension(PrimitiveBaseShape shp, XmlTextReader reader) 1158 private static void ProcessShpFlexiTension(PrimitiveBaseShape shp, XmlReader reader)
1035 { 1159 {
1036 shp.FlexiTension = reader.ReadElementContentAsFloat("FlexiTension", String.Empty); 1160 shp.FlexiTension = reader.ReadElementContentAsFloat("FlexiTension", String.Empty);
1037 } 1161 }
1038 1162
1039 private static void ProcessShpFlexiDrag(PrimitiveBaseShape shp, XmlTextReader reader) 1163 private static void ProcessShpFlexiDrag(PrimitiveBaseShape shp, XmlReader reader)
1040 { 1164 {
1041 shp.FlexiDrag = reader.ReadElementContentAsFloat("FlexiDrag", String.Empty); 1165 shp.FlexiDrag = reader.ReadElementContentAsFloat("FlexiDrag", String.Empty);
1042 } 1166 }
1043 1167
1044 private static void ProcessShpFlexiGravity(PrimitiveBaseShape shp, XmlTextReader reader) 1168 private static void ProcessShpFlexiGravity(PrimitiveBaseShape shp, XmlReader reader)
1045 { 1169 {
1046 shp.FlexiGravity = reader.ReadElementContentAsFloat("FlexiGravity", String.Empty); 1170 shp.FlexiGravity = reader.ReadElementContentAsFloat("FlexiGravity", String.Empty);
1047 } 1171 }
1048 1172
1049 private static void ProcessShpFlexiWind(PrimitiveBaseShape shp, XmlTextReader reader) 1173 private static void ProcessShpFlexiWind(PrimitiveBaseShape shp, XmlReader reader)
1050 { 1174 {
1051 shp.FlexiWind = reader.ReadElementContentAsFloat("FlexiWind", String.Empty); 1175 shp.FlexiWind = reader.ReadElementContentAsFloat("FlexiWind", String.Empty);
1052 } 1176 }
1053 1177
1054 private static void ProcessShpFlexiForceX(PrimitiveBaseShape shp, XmlTextReader reader) 1178 private static void ProcessShpFlexiForceX(PrimitiveBaseShape shp, XmlReader reader)
1055 { 1179 {
1056 shp.FlexiForceX = reader.ReadElementContentAsFloat("FlexiForceX", String.Empty); 1180 shp.FlexiForceX = reader.ReadElementContentAsFloat("FlexiForceX", String.Empty);
1057 } 1181 }
1058 1182
1059 private static void ProcessShpFlexiForceY(PrimitiveBaseShape shp, XmlTextReader reader) 1183 private static void ProcessShpFlexiForceY(PrimitiveBaseShape shp, XmlReader reader)
1060 { 1184 {
1061 shp.FlexiForceY = reader.ReadElementContentAsFloat("FlexiForceY", String.Empty); 1185 shp.FlexiForceY = reader.ReadElementContentAsFloat("FlexiForceY", String.Empty);
1062 } 1186 }
1063 1187
1064 private static void ProcessShpFlexiForceZ(PrimitiveBaseShape shp, XmlTextReader reader) 1188 private static void ProcessShpFlexiForceZ(PrimitiveBaseShape shp, XmlReader reader)
1065 { 1189 {
1066 shp.FlexiForceZ = reader.ReadElementContentAsFloat("FlexiForceZ", String.Empty); 1190 shp.FlexiForceZ = reader.ReadElementContentAsFloat("FlexiForceZ", String.Empty);
1067 } 1191 }
1068 1192
1069 private static void ProcessShpLightColorR(PrimitiveBaseShape shp, XmlTextReader reader) 1193 private static void ProcessShpLightColorR(PrimitiveBaseShape shp, XmlReader reader)
1070 { 1194 {
1071 shp.LightColorR = reader.ReadElementContentAsFloat("LightColorR", String.Empty); 1195 shp.LightColorR = reader.ReadElementContentAsFloat("LightColorR", String.Empty);
1072 } 1196 }
1073 1197
1074 private static void ProcessShpLightColorG(PrimitiveBaseShape shp, XmlTextReader reader) 1198 private static void ProcessShpLightColorG(PrimitiveBaseShape shp, XmlReader reader)
1075 { 1199 {
1076 shp.LightColorG = reader.ReadElementContentAsFloat("LightColorG", String.Empty); 1200 shp.LightColorG = reader.ReadElementContentAsFloat("LightColorG", String.Empty);
1077 } 1201 }
1078 1202
1079 private static void ProcessShpLightColorB(PrimitiveBaseShape shp, XmlTextReader reader) 1203 private static void ProcessShpLightColorB(PrimitiveBaseShape shp, XmlReader reader)
1080 { 1204 {
1081 shp.LightColorB = reader.ReadElementContentAsFloat("LightColorB", String.Empty); 1205 shp.LightColorB = reader.ReadElementContentAsFloat("LightColorB", String.Empty);
1082 } 1206 }
1083 1207
1084 private static void ProcessShpLightColorA(PrimitiveBaseShape shp, XmlTextReader reader) 1208 private static void ProcessShpLightColorA(PrimitiveBaseShape shp, XmlReader reader)
1085 { 1209 {
1086 shp.LightColorA = reader.ReadElementContentAsFloat("LightColorA", String.Empty); 1210 shp.LightColorA = reader.ReadElementContentAsFloat("LightColorA", String.Empty);
1087 } 1211 }
1088 1212
1089 private static void ProcessShpLightRadius(PrimitiveBaseShape shp, XmlTextReader reader) 1213 private static void ProcessShpLightRadius(PrimitiveBaseShape shp, XmlReader reader)
1090 { 1214 {
1091 shp.LightRadius = reader.ReadElementContentAsFloat("LightRadius", String.Empty); 1215 shp.LightRadius = reader.ReadElementContentAsFloat("LightRadius", String.Empty);
1092 } 1216 }
1093 1217
1094 private static void ProcessShpLightCutoff(PrimitiveBaseShape shp, XmlTextReader reader) 1218 private static void ProcessShpLightCutoff(PrimitiveBaseShape shp, XmlReader reader)
1095 { 1219 {
1096 shp.LightCutoff = reader.ReadElementContentAsFloat("LightCutoff", String.Empty); 1220 shp.LightCutoff = reader.ReadElementContentAsFloat("LightCutoff", String.Empty);
1097 } 1221 }
1098 1222
1099 private static void ProcessShpLightFalloff(PrimitiveBaseShape shp, XmlTextReader reader) 1223 private static void ProcessShpLightFalloff(PrimitiveBaseShape shp, XmlReader reader)
1100 { 1224 {
1101 shp.LightFalloff = reader.ReadElementContentAsFloat("LightFalloff", String.Empty); 1225 shp.LightFalloff = reader.ReadElementContentAsFloat("LightFalloff", String.Empty);
1102 } 1226 }
1103 1227
1104 private static void ProcessShpLightIntensity(PrimitiveBaseShape shp, XmlTextReader reader) 1228 private static void ProcessShpLightIntensity(PrimitiveBaseShape shp, XmlReader reader)
1105 { 1229 {
1106 shp.LightIntensity = reader.ReadElementContentAsFloat("LightIntensity", String.Empty); 1230 shp.LightIntensity = reader.ReadElementContentAsFloat("LightIntensity", String.Empty);
1107 } 1231 }
1108 1232
1109 private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1233 private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlReader reader)
1110 { 1234 {
1111 shp.FlexiEntry = Util.ReadBoolean(reader); 1235 shp.FlexiEntry = Util.ReadBoolean(reader);
1112 } 1236 }
1113 1237
1114 private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1238 private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlReader reader)
1115 { 1239 {
1116 shp.LightEntry = Util.ReadBoolean(reader); 1240 shp.LightEntry = Util.ReadBoolean(reader);
1117 } 1241 }
1118 1242
1119 private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1243 private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlReader reader)
1120 { 1244 {
1121 shp.SculptEntry = Util.ReadBoolean(reader); 1245 shp.SculptEntry = Util.ReadBoolean(reader);
1122 } 1246 }
1123 1247
1124 private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader) 1248 private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader)
1125 { 1249 {
1126 string value = reader.ReadElementContentAsString("Media", String.Empty); 1250 string value = reader.ReadElementContentAsString("Media", String.Empty);
1127 shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); 1251 shp.Media = PrimitiveBaseShape.MediaList.FromXml(value);
@@ -1144,6 +1268,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1144 }); 1268 });
1145 1269
1146 writer.WriteEndElement(); 1270 writer.WriteEndElement();
1271
1272 if (sog.RootPart.KeyframeMotion != null)
1273 {
1274 Byte[] data = sog.RootPart.KeyframeMotion.Serialize();
1275
1276 writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
1277 writer.WriteBase64(data, 0, data.Length);
1278 writer.WriteEndElement();
1279 }
1280
1147 writer.WriteEndElement(); 1281 writer.WriteEndElement();
1148 } 1282 }
1149 1283
@@ -1157,14 +1291,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1157 1291
1158 WriteUUID(writer, "CreatorID", sop.CreatorID, options); 1292 WriteUUID(writer, "CreatorID", sop.CreatorID, options);
1159 1293
1160 if (sop.CreatorData != null && sop.CreatorData != string.Empty) 1294 if (!string.IsNullOrEmpty(sop.CreatorData))
1161 writer.WriteElementString("CreatorData", sop.CreatorData); 1295 writer.WriteElementString("CreatorData", sop.CreatorData);
1162 else if (options.ContainsKey("home")) 1296 else if (options.ContainsKey("home"))
1163 { 1297 {
1164 if (m_UserManagement == null) 1298 if (m_UserManagement == null)
1165 m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>(); 1299 m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>();
1166 string name = m_UserManagement.GetUserName(sop.CreatorID); 1300 string name = m_UserManagement.GetUserName(sop.CreatorID);
1167 writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name); 1301 writer.WriteElementString("CreatorData", ExternalRepresentationUtils.CalcCreatorData((string)options["home"], name));
1168 } 1302 }
1169 1303
1170 WriteUUID(writer, "FolderID", sop.FolderID, options); 1304 WriteUUID(writer, "FolderID", sop.FolderID, options);
@@ -1217,7 +1351,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1217 writer.WriteElementString("SalePrice", sop.SalePrice.ToString()); 1351 writer.WriteElementString("SalePrice", sop.SalePrice.ToString());
1218 writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString()); 1352 writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString());
1219 writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString()); 1353 writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString());
1220 WriteUUID(writer, "GroupID", sop.GroupID, options); 1354
1355 UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.GroupID;
1356 WriteUUID(writer, "GroupID", groupID, options);
1221 1357
1222 UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID; 1358 UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID;
1223 WriteUUID(writer, "OwnerID", ownerID, options); 1359 WriteUUID(writer, "OwnerID", ownerID, options);
@@ -1235,6 +1371,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1235 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); 1371 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
1236 if (sop.MediaUrl != null) 1372 if (sop.MediaUrl != null)
1237 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); 1373 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
1374 WriteVector(writer, "AttachedPos", sop.AttachedPos);
1375
1376 if (sop.DynAttrs.CountNamespaces > 0)
1377 {
1378 writer.WriteStartElement("DynAttrs");
1379 sop.DynAttrs.WriteXml(writer);
1380 writer.WriteEndElement();
1381 }
1382
1238 WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); 1383 WriteBytes(writer, "TextureAnimation", sop.TextureAnimation);
1239 WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); 1384 WriteBytes(writer, "ParticleSystem", sop.ParticleSystem);
1240 writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString()); 1385 writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString());
@@ -1243,6 +1388,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1243 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); 1388 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
1244 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); 1389 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
1245 1390
1391 if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType())
1392 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
1393 if (sop.Density != 1000.0f)
1394 writer.WriteElementString("Density", sop.Density.ToString().ToLower());
1395 if (sop.Friction != 0.6f)
1396 writer.WriteElementString("Friction", sop.Friction.ToString().ToLower());
1397 if (sop.Restitution != 0.5f)
1398 writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower());
1399 if (sop.GravityModifier != 1.0f)
1400 writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower());
1401
1246 writer.WriteEndElement(); 1402 writer.WriteEndElement();
1247 } 1403 }
1248 1404
@@ -1310,20 +1466,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1310 1466
1311 WriteUUID(writer, "CreatorID", item.CreatorID, options); 1467 WriteUUID(writer, "CreatorID", item.CreatorID, options);
1312 1468
1313 if (item.CreatorData != null && item.CreatorData != string.Empty) 1469 if (!string.IsNullOrEmpty(item.CreatorData))
1314 writer.WriteElementString("CreatorData", item.CreatorData); 1470 writer.WriteElementString("CreatorData", item.CreatorData);
1315 else if (options.ContainsKey("home")) 1471 else if (options.ContainsKey("home"))
1316 { 1472 {
1317 if (m_UserManagement == null) 1473 if (m_UserManagement == null)
1318 m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); 1474 m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
1319 string name = m_UserManagement.GetUserName(item.CreatorID); 1475 string name = m_UserManagement.GetUserName(item.CreatorID);
1320 writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name); 1476 writer.WriteElementString("CreatorData", ExternalRepresentationUtils.CalcCreatorData((string)options["home"], name));
1321 } 1477 }
1322 1478
1323 writer.WriteElementString("Description", item.Description); 1479 writer.WriteElementString("Description", item.Description);
1324 writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); 1480 writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString());
1325 writer.WriteElementString("Flags", item.Flags.ToString()); 1481 writer.WriteElementString("Flags", item.Flags.ToString());
1326 WriteUUID(writer, "GroupID", item.GroupID, options); 1482
1483 UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.GroupID;
1484 WriteUUID(writer, "GroupID", groupID, options);
1485
1327 writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString()); 1486 writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString());
1328 writer.WriteElementString("InvType", item.InvType.ToString()); 1487 writer.WriteElementString("InvType", item.InvType.ToString());
1329 WriteUUID(writer, "ItemID", item.ItemID, options); 1488 WriteUUID(writer, "ItemID", item.ItemID, options);
@@ -1344,7 +1503,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1344 WriteUUID(writer, "PermsGranter", item.PermsGranter, options); 1503 WriteUUID(writer, "PermsGranter", item.PermsGranter, options);
1345 writer.WriteElementString("PermsMask", item.PermsMask.ToString()); 1504 writer.WriteElementString("PermsMask", item.PermsMask.ToString());
1346 writer.WriteElementString("Type", item.Type.ToString()); 1505 writer.WriteElementString("Type", item.Type.ToString());
1347 writer.WriteElementString("OwnerChanged", item.OwnerChanged.ToString().ToLower()); 1506
1507 bool ownerChanged = options.ContainsKey("wipe-owners") ? false : item.OwnerChanged;
1508 writer.WriteElementString("OwnerChanged", ownerChanged.ToString().ToLower());
1348 1509
1349 writer.WriteEndElement(); // TaskInventoryItem 1510 writer.WriteEndElement(); // TaskInventoryItem
1350 } 1511 }
@@ -1398,20 +1559,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1398 writer.WriteElementString("ProfileEnd", shp.ProfileEnd.ToString()); 1559 writer.WriteElementString("ProfileEnd", shp.ProfileEnd.ToString());
1399 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString()); 1560 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString());
1400 writer.WriteElementString("State", shp.State.ToString()); 1561 writer.WriteElementString("State", shp.State.ToString());
1562 writer.WriteElementString("LastAttachPoint", shp.LastAttachPoint.ToString());
1401 1563
1402 WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options); 1564 WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options);
1403 WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options); 1565 WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options);
1404 1566
1405 WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); 1567 WriteUUID(writer, "SculptTexture", shp.SculptTexture, options);
1406 writer.WriteElementString("SculptType", shp.SculptType.ToString()); 1568 writer.WriteElementString("SculptType", shp.SculptType.ToString());
1407 writer.WriteStartElement("SculptData"); 1569 // Don't serialize SculptData. It's just a copy of the asset, which can be loaded separately using 'SculptTexture'.
1408 byte[] sd;
1409 if (shp.SculptData != null)
1410 sd = shp.SculptData;
1411 else
1412 sd = Utils.EmptyBytes;
1413 writer.WriteBase64(sd, 0, sd.Length);
1414 writer.WriteEndElement(); // SculptData
1415 1570
1416 writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString()); 1571 writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString());
1417 writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString()); 1572 writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString());
@@ -1442,28 +1597,31 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1442 } 1597 }
1443 } 1598 }
1444 1599
1445 public static SceneObjectPart Xml2ToSOP(XmlTextReader reader) 1600 public static SceneObjectPart Xml2ToSOP(XmlReader reader)
1446 { 1601 {
1447 SceneObjectPart obj = new SceneObjectPart(); 1602 SceneObjectPart obj = new SceneObjectPart();
1448 1603
1449 reader.ReadStartElement("SceneObjectPart"); 1604 reader.ReadStartElement("SceneObjectPart");
1450 1605
1451 ExternalRepresentationUtils.ExecuteReadProcessors( 1606 bool errors = ExternalRepresentationUtils.ExecuteReadProcessors(
1452 obj, 1607 obj,
1453 m_SOPXmlProcessors, 1608 m_SOPXmlProcessors,
1454 reader, 1609 reader,
1455 (o, nodeName, e) 1610 (o, nodeName, e) => {
1456 => m_log.DebugFormat( 1611 m_log.Debug(string.Format("[SceneObjectSerializer]: Error while parsing element {0} in object {1} {2} ",
1457 "[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}", 1612 nodeName, ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID), e);
1458 ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace)); 1613 });
1614
1615 if (errors)
1616 throw new XmlException(string.Format("Error parsing object {0} {1}", obj.Name, obj.UUID));
1459 1617
1460 reader.ReadEndElement(); // SceneObjectPart 1618 reader.ReadEndElement(); // SceneObjectPart
1461 1619
1462 //m_log.DebugFormat("[XXX]: parsed SOP {0} - {1}", obj.Name, obj.UUID); 1620 // m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID);
1463 return obj; 1621 return obj;
1464 } 1622 }
1465 1623
1466 public static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) 1624 public static TaskInventoryDictionary ReadTaskInventory(XmlReader reader, string name)
1467 { 1625 {
1468 TaskInventoryDictionary tinv = new TaskInventoryDictionary(); 1626 TaskInventoryDictionary tinv = new TaskInventoryDictionary();
1469 1627
@@ -1504,7 +1662,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1504 /// <param name="name">The name of the xml element containing the shape</param> 1662 /// <param name="name">The name of the xml element containing the shape</param>
1505 /// <param name="errors">a list containing the failing node names. If no failures then null.</param> 1663 /// <param name="errors">a list containing the failing node names. If no failures then null.</param>
1506 /// <returns>The shape parsed</returns> 1664 /// <returns>The shape parsed</returns>
1507 public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out List<string> errorNodeNames) 1665 public static PrimitiveBaseShape ReadShape(XmlReader reader, string name, out List<string> errorNodeNames, SceneObjectPart obj)
1508 { 1666 {
1509 List<string> internalErrorNodeNames = null; 1667 List<string> internalErrorNodeNames = null;
1510 1668
@@ -1523,18 +1681,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1523 shape, 1681 shape,
1524 m_ShapeXmlProcessors, 1682 m_ShapeXmlProcessors,
1525 reader, 1683 reader,
1526 (o, nodeName, e) 1684 (o, nodeName, e) => {
1527 => 1685 m_log.Debug(string.Format("[SceneObjectSerializer]: Error while parsing element {0} in Shape property of object {1} {2} ",
1528 { 1686 nodeName, obj.Name, obj.UUID), e);
1529// m_log.DebugFormat(
1530// "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}",
1531// nodeName, e.Message, e.StackTrace);
1532 if (internalErrorNodeNames == null)
1533 internalErrorNodeNames = new List<string>();
1534 1687
1535 internalErrorNodeNames.Add(nodeName); 1688 if (internalErrorNodeNames == null)
1536 } 1689 internalErrorNodeNames = new List<string>();
1537 ); 1690 internalErrorNodeNames.Add(nodeName);
1691 });
1538 1692
1539 reader.ReadEndElement(); // Shape 1693 reader.ReadEndElement(); // Shape
1540 1694
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
index a3485d2..3c03130 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
@@ -34,7 +34,7 @@ using OpenMetaverse;
34using log4net; 34using log4net;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.Physics.Manager; 37using OpenSim.Region.PhysicsModules.SharedBase;
38 38
39namespace OpenSim.Region.Framework.Scenes.Serialization 39namespace OpenSim.Region.Framework.Scenes.Serialization
40{ 40{