aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs141
1 files changed, 130 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 4caa9cb..dc5de58 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
278 // 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
279 // ever a problem. 279 // ever a problem.
280 sceneObject.LoadScriptState(doc); 280 sceneObject.LoadScriptState(doc);
281 281
282 return sceneObject; 282 return sceneObject;
283 } 283 }
284 catch (Exception e) 284 catch (Exception e)
@@ -307,14 +307,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
307 } 307 }
308 } 308 }
309 309
310<<<<<<< HEAD
310 311
312=======
313>>>>>>> avn/ubitvar
311 /// <summary> 314 /// <summary>
312 /// Modifies a SceneObjectGroup. 315 /// Modifies a SceneObjectGroup.
313 /// </summary> 316 /// </summary>
314 /// <param name="sog">The object</param> 317 /// <param name="sog">The object</param>
315 /// <returns>Whether the object was actually modified</returns> 318 /// <returns>Whether the object was actually modified</returns>
316 public delegate bool SceneObjectModifier(SceneObjectGroup sog); 319 public delegate bool SceneObjectModifier(SceneObjectGroup sog);
320<<<<<<< HEAD
317 321
322=======
323
324>>>>>>> avn/ubitvar
318 /// <summary> 325 /// <summary>
319 /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing. 326 /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing.
320 /// </summary> 327 /// </summary>
@@ -328,7 +335,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
328 CoalescedSceneObjects coa = null; 335 CoalescedSceneObjects coa = null;
329 336
330 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); 337 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data));
338<<<<<<< HEAD
331 339
340=======
341
342>>>>>>> avn/ubitvar
332 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) 343 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa))
333 { 344 {
334 // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); 345 // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
@@ -373,7 +384,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
373 384
374 return data; 385 return data;
375 } 386 }
387<<<<<<< HEAD
376 388
389=======
390>>>>>>> avn/ubitvar
377 391
378 #region manual serialization 392 #region manual serialization
379 393
@@ -450,11 +464,27 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
450 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); 464 m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
451 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); 465 m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
452 466
467 m_SOPXmlProcessors.Add("Buoyancy", ProcessBuoyancy);
468 m_SOPXmlProcessors.Add("Force", ProcessForce);
469 m_SOPXmlProcessors.Add("Torque", ProcessTorque);
470 m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive);
471
472
473 m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle);
474
453 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType); 475 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
454 m_SOPXmlProcessors.Add("Density", ProcessDensity); 476 m_SOPXmlProcessors.Add("Density", ProcessDensity);
455 m_SOPXmlProcessors.Add("Friction", ProcessFriction); 477 m_SOPXmlProcessors.Add("Friction", ProcessFriction);
456 m_SOPXmlProcessors.Add("Bounce", ProcessBounce); 478 m_SOPXmlProcessors.Add("Bounce", ProcessBounce);
457 m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier); 479 m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier);
480 m_SOPXmlProcessors.Add("CameraEyeOffset", ProcessCameraEyeOffset);
481 m_SOPXmlProcessors.Add("CameraAtOffset", ProcessCameraAtOffset);
482
483 m_SOPXmlProcessors.Add("SoundID", ProcessSoundID);
484 m_SOPXmlProcessors.Add("SoundGain", ProcessSoundGain);
485 m_SOPXmlProcessors.Add("SoundFlags", ProcessSoundFlags);
486 m_SOPXmlProcessors.Add("SoundRadius", ProcessSoundRadius);
487 m_SOPXmlProcessors.Add("SoundQueueing", ProcessSoundQueueing);
458 488
459 #endregion 489 #endregion
460 490
@@ -483,7 +513,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
483 m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); 513 m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask);
484 m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); 514 m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType);
485 m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); 515 m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged);
486 516
487 #endregion 517 #endregion
488 518
489 #region ShapeXmlProcessors initialization 519 #region ShapeXmlProcessors initialization
@@ -709,7 +739,62 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
709 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); 739 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
710 } 740 }
711 741
742<<<<<<< HEAD
712 private static void ProcessShape(SceneObjectPart obj, XmlReader reader) 743 private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
744=======
745 private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlTextReader reader)
746 {
747 obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset"));
748 }
749
750 private static void ProcessCameraAtOffset(SceneObjectPart obj, XmlTextReader reader)
751 {
752 obj.SetCameraAtOffset(Util.ReadVector(reader, "CameraAtOffset"));
753 }
754
755 private static void ProcessSoundID(SceneObjectPart obj, XmlTextReader reader)
756 {
757 obj.Sound = Util.ReadUUID(reader, "SoundID");
758 }
759
760 private static void ProcessSoundGain(SceneObjectPart obj, XmlTextReader reader)
761 {
762 obj.SoundGain = reader.ReadElementContentAsDouble("SoundGain", String.Empty);
763 }
764
765 private static void ProcessSoundFlags(SceneObjectPart obj, XmlTextReader reader)
766 {
767 obj.SoundFlags = (byte)reader.ReadElementContentAsInt("SoundFlags", String.Empty);
768 }
769
770 private static void ProcessSoundRadius(SceneObjectPart obj, XmlTextReader reader)
771 {
772 obj.SoundRadius = reader.ReadElementContentAsDouble("SoundRadius", String.Empty);
773 }
774
775 private static void ProcessSoundQueueing(SceneObjectPart obj, XmlTextReader reader)
776 {
777 obj.SoundQueueing = Util.ReadBoolean(reader);
778 }
779 private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader)
780 {
781 SOPVehicle vehicle = SOPVehicle.FromXml2(reader);
782
783 if (vehicle == null)
784 {
785 obj.VehicleParams = null;
786 m_log.DebugFormat(
787 "[SceneObjectSerializer]: Parsing Vehicle for object part {0} {1} encountered errors. Please see earlier log entries.",
788 obj.Name, obj.UUID);
789 }
790 else
791 {
792 obj.VehicleParams = vehicle;
793 }
794 }
795
796 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
797>>>>>>> avn/ubitvar
713 { 798 {
714 List<string> errorNodeNames; 799 List<string> errorNodeNames;
715 obj.Shape = ReadShape(reader, "Shape", out errorNodeNames, obj); 800 obj.Shape = ReadShape(reader, "Shape", out errorNodeNames, obj);
@@ -883,6 +968,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
883 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); 968 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty);
884 } 969 }
885 970
971 private static void ProcessBuoyancy(SceneObjectPart obj, XmlTextReader reader)
972 {
973 obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty);
974 }
975
976 private static void ProcessForce(SceneObjectPart obj, XmlTextReader reader)
977 {
978 obj.Force = Util.ReadVector(reader, "Force");
979 }
980 private static void ProcessTorque(SceneObjectPart obj, XmlTextReader reader)
981 {
982 obj.Torque = Util.ReadVector(reader, "Torque");
983 }
984
985 private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlTextReader reader)
986 {
987 obj.VolumeDetectActive = Util.ReadBoolean(reader);
988 }
989
886 #endregion 990 #endregion
887 991
888 #region TaskInventoryXmlProcessors 992 #region TaskInventoryXmlProcessors
@@ -1271,12 +1375,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1271 1375
1272 if (sog.RootPart.KeyframeMotion != null) 1376 if (sog.RootPart.KeyframeMotion != null)
1273 { 1377 {
1274 Byte[] data = sog.RootPart.KeyframeMotion.Serialize(); 1378 Byte[] data = sog.RootPart.KeyframeMotion.Serialize();
1275 1379
1276 writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); 1380 writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
1277 writer.WriteBase64(data, 0, data.Length); 1381 writer.WriteBase64(data, 0, data.Length);
1278 writer.WriteEndElement(); 1382 writer.WriteEndElement();
1279 } 1383 }
1384
1280 1385
1281 writer.WriteEndElement(); 1386 writer.WriteEndElement();
1282 } 1387 }
@@ -1388,8 +1493,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1388 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); 1493 writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
1389 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); 1494 writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
1390 1495
1391 if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) 1496 writer.WriteElementString("Buoyancy", sop.Buoyancy.ToString());
1392 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); 1497
1498 WriteVector(writer, "Force", sop.Force);
1499 WriteVector(writer, "Torque", sop.Torque);
1500
1501 writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower());
1502
1503 if (sop.VehicleParams != null)
1504 sop.VehicleParams.ToXml2(writer);
1505
1506 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
1393 if (sop.Density != 1000.0f) 1507 if (sop.Density != 1000.0f)
1394 writer.WriteElementString("Density", sop.Density.ToString().ToLower()); 1508 writer.WriteElementString("Density", sop.Density.ToString().ToLower());
1395 if (sop.Friction != 0.6f) 1509 if (sop.Friction != 0.6f)
@@ -1398,7 +1512,18 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1398 writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower()); 1512 writer.WriteElementString("Bounce", sop.Restitution.ToString().ToLower());
1399 if (sop.GravityModifier != 1.0f) 1513 if (sop.GravityModifier != 1.0f)
1400 writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower()); 1514 writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower());
1515 WriteVector(writer, "CameraEyeOffset", sop.GetCameraEyeOffset());
1516 WriteVector(writer, "CameraAtOffset", sop.GetCameraAtOffset());
1401 1517
1518 // if (sop.Sound != UUID.Zero) force it till sop crossing does clear it on child prim
1519 {
1520 WriteUUID(writer, "SoundID", sop.Sound, options);
1521 writer.WriteElementString("SoundGain", sop.SoundGain.ToString().ToLower());
1522 writer.WriteElementString("SoundFlags", sop.SoundFlags.ToString().ToLower());
1523 writer.WriteElementString("SoundRadius", sop.SoundRadius.ToString().ToLower());
1524 }
1525 writer.WriteElementString("SoundQueueing", sop.SoundQueueing.ToString().ToLower());
1526
1402 writer.WriteEndElement(); 1527 writer.WriteEndElement();
1403 } 1528 }
1404 1529
@@ -1625,12 +1750,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1625 { 1750 {
1626 TaskInventoryDictionary tinv = new TaskInventoryDictionary(); 1751 TaskInventoryDictionary tinv = new TaskInventoryDictionary();
1627 1752
1628 if (reader.IsEmptyElement)
1629 {
1630 reader.Read();
1631 return tinv;
1632 }
1633
1634 reader.ReadStartElement(name, String.Empty); 1753 reader.ReadStartElement(name, String.Empty);
1635 1754
1636 while (reader.Name == "TaskInventoryItem") 1755 while (reader.Name == "TaskInventoryItem")