diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 65 |
1 files changed, 59 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index ce4fb40..40e88f1 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -271,7 +271,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
271 | // Script state may, or may not, exist. Not having any, is NOT | 271 | // Script state may, or may not, exist. Not having any, is NOT |
272 | // ever a problem. | 272 | // ever a problem. |
273 | sceneObject.LoadScriptState(doc); | 273 | sceneObject.LoadScriptState(doc); |
274 | 274 | ||
275 | return sceneObject; | 275 | return sceneObject; |
276 | } | 276 | } |
277 | catch (Exception e) | 277 | catch (Exception e) |
@@ -365,6 +365,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
365 | m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); | 365 | m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); |
366 | m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); | 366 | m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); |
367 | m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); | 367 | m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); |
368 | m_SOPXmlProcessors.Add("AttachedPos", ProcessAttachedPos); | ||
368 | m_SOPXmlProcessors.Add("DynAttrs", ProcessDynAttrs); | 369 | m_SOPXmlProcessors.Add("DynAttrs", ProcessDynAttrs); |
369 | m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); | 370 | m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); |
370 | m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); | 371 | m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); |
@@ -390,6 +391,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
390 | m_SOPXmlProcessors.Add("CameraEyeOffset", ProcessCameraEyeOffset); | 391 | m_SOPXmlProcessors.Add("CameraEyeOffset", ProcessCameraEyeOffset); |
391 | m_SOPXmlProcessors.Add("CameraAtOffset", ProcessCameraAtOffset); | 392 | m_SOPXmlProcessors.Add("CameraAtOffset", ProcessCameraAtOffset); |
392 | 393 | ||
394 | m_SOPXmlProcessors.Add("SoundID", ProcessSoundID); | ||
395 | m_SOPXmlProcessors.Add("SoundGain", ProcessSoundGain); | ||
396 | m_SOPXmlProcessors.Add("SoundFlags", ProcessSoundFlags); | ||
397 | m_SOPXmlProcessors.Add("SoundRadius", ProcessSoundRadius); | ||
398 | m_SOPXmlProcessors.Add("SoundQueueing", ProcessSoundQueueing); | ||
399 | |||
393 | #endregion | 400 | #endregion |
394 | 401 | ||
395 | #region TaskInventoryXmlProcessors initialization | 402 | #region TaskInventoryXmlProcessors initialization |
@@ -443,6 +450,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
443 | m_ShapeXmlProcessors.Add("ProfileEnd", ProcessShpProfileEnd); | 450 | m_ShapeXmlProcessors.Add("ProfileEnd", ProcessShpProfileEnd); |
444 | m_ShapeXmlProcessors.Add("ProfileHollow", ProcessShpProfileHollow); | 451 | m_ShapeXmlProcessors.Add("ProfileHollow", ProcessShpProfileHollow); |
445 | m_ShapeXmlProcessors.Add("Scale", ProcessShpScale); | 452 | m_ShapeXmlProcessors.Add("Scale", ProcessShpScale); |
453 | m_ShapeXmlProcessors.Add("LastAttachPoint", ProcessShpLastAttach); | ||
446 | m_ShapeXmlProcessors.Add("State", ProcessShpState); | 454 | m_ShapeXmlProcessors.Add("State", ProcessShpState); |
447 | m_ShapeXmlProcessors.Add("ProfileShape", ProcessShpProfileShape); | 455 | m_ShapeXmlProcessors.Add("ProfileShape", ProcessShpProfileShape); |
448 | m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape); | 456 | m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape); |
@@ -652,6 +660,30 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
652 | obj.SetCameraAtOffset(Util.ReadVector(reader, "CameraAtOffset")); | 660 | obj.SetCameraAtOffset(Util.ReadVector(reader, "CameraAtOffset")); |
653 | } | 661 | } |
654 | 662 | ||
663 | private static void ProcessSoundID(SceneObjectPart obj, XmlTextReader reader) | ||
664 | { | ||
665 | obj.Sound = Util.ReadUUID(reader, "SoundID"); | ||
666 | } | ||
667 | |||
668 | private static void ProcessSoundGain(SceneObjectPart obj, XmlTextReader reader) | ||
669 | { | ||
670 | obj.SoundGain = reader.ReadElementContentAsDouble("SoundGain", String.Empty); | ||
671 | } | ||
672 | |||
673 | private static void ProcessSoundFlags(SceneObjectPart obj, XmlTextReader reader) | ||
674 | { | ||
675 | obj.SoundFlags = (byte)reader.ReadElementContentAsInt("SoundFlags", String.Empty); | ||
676 | } | ||
677 | |||
678 | private static void ProcessSoundRadius(SceneObjectPart obj, XmlTextReader reader) | ||
679 | { | ||
680 | obj.SoundRadius = reader.ReadElementContentAsDouble("SoundRadius", String.Empty); | ||
681 | } | ||
682 | |||
683 | private static void ProcessSoundQueueing(SceneObjectPart obj, XmlTextReader reader) | ||
684 | { | ||
685 | obj.SoundQueueing = Util.ReadBoolean(reader); | ||
686 | } | ||
655 | private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader) | 687 | private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader) |
656 | { | 688 | { |
657 | SOPVehicle vehicle = SOPVehicle.FromXml2(reader); | 689 | SOPVehicle vehicle = SOPVehicle.FromXml2(reader); |
@@ -798,6 +830,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
798 | obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); | 830 | obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); |
799 | } | 831 | } |
800 | 832 | ||
833 | private static void ProcessAttachedPos(SceneObjectPart obj, XmlTextReader reader) | ||
834 | { | ||
835 | obj.AttachedPos = Util.ReadVector(reader, "AttachedPos"); | ||
836 | } | ||
837 | |||
801 | private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader) | 838 | private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader) |
802 | { | 839 | { |
803 | obj.DynAttrs.ReadXml(reader); | 840 | obj.DynAttrs.ReadXml(reader); |
@@ -1099,6 +1136,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1099 | shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty); | 1136 | shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty); |
1100 | } | 1137 | } |
1101 | 1138 | ||
1139 | private static void ProcessShpLastAttach(PrimitiveBaseShape shp, XmlTextReader reader) | ||
1140 | { | ||
1141 | shp.LastAttachPoint = (byte)reader.ReadElementContentAsInt("LastAttachPoint", String.Empty); | ||
1142 | } | ||
1143 | |||
1102 | private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) | 1144 | private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) |
1103 | { | 1145 | { |
1104 | shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape"); | 1146 | shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape"); |
@@ -1253,6 +1295,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1253 | writer.WriteBase64(data, 0, data.Length); | 1295 | writer.WriteBase64(data, 0, data.Length); |
1254 | writer.WriteEndElement(); | 1296 | writer.WriteEndElement(); |
1255 | } | 1297 | } |
1298 | |||
1256 | 1299 | ||
1257 | writer.WriteEndElement(); | 1300 | writer.WriteEndElement(); |
1258 | } | 1301 | } |
@@ -1267,7 +1310,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1267 | 1310 | ||
1268 | WriteUUID(writer, "CreatorID", sop.CreatorID, options); | 1311 | WriteUUID(writer, "CreatorID", sop.CreatorID, options); |
1269 | 1312 | ||
1270 | if (sop.CreatorData != null && sop.CreatorData != string.Empty) | 1313 | if (!string.IsNullOrEmpty(sop.CreatorData)) |
1271 | writer.WriteElementString("CreatorData", sop.CreatorData); | 1314 | writer.WriteElementString("CreatorData", sop.CreatorData); |
1272 | else if (options.ContainsKey("home")) | 1315 | else if (options.ContainsKey("home")) |
1273 | { | 1316 | { |
@@ -1345,8 +1388,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1345 | writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); | 1388 | writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); |
1346 | if (sop.MediaUrl != null) | 1389 | if (sop.MediaUrl != null) |
1347 | writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); | 1390 | writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); |
1391 | WriteVector(writer, "AttachedPos", sop.AttachedPos); | ||
1348 | 1392 | ||
1349 | if (sop.DynAttrs.Count > 0) | 1393 | if (sop.DynAttrs.CountNamespaces > 0) |
1350 | { | 1394 | { |
1351 | writer.WriteStartElement("DynAttrs"); | 1395 | writer.WriteStartElement("DynAttrs"); |
1352 | sop.DynAttrs.WriteXml(writer); | 1396 | sop.DynAttrs.WriteXml(writer); |
@@ -1371,8 +1415,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1371 | if (sop.VehicleParams != null) | 1415 | if (sop.VehicleParams != null) |
1372 | sop.VehicleParams.ToXml2(writer); | 1416 | sop.VehicleParams.ToXml2(writer); |
1373 | 1417 | ||
1374 | if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) | 1418 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); |
1375 | writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); | ||
1376 | if (sop.Density != 1000.0f) | 1419 | if (sop.Density != 1000.0f) |
1377 | writer.WriteElementString("Density", sop.Density.ToString().ToLower()); | 1420 | writer.WriteElementString("Density", sop.Density.ToString().ToLower()); |
1378 | if (sop.Friction != 0.6f) | 1421 | if (sop.Friction != 0.6f) |
@@ -1384,6 +1427,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1384 | WriteVector(writer, "CameraEyeOffset", sop.GetCameraEyeOffset()); | 1427 | WriteVector(writer, "CameraEyeOffset", sop.GetCameraEyeOffset()); |
1385 | WriteVector(writer, "CameraAtOffset", sop.GetCameraAtOffset()); | 1428 | WriteVector(writer, "CameraAtOffset", sop.GetCameraAtOffset()); |
1386 | 1429 | ||
1430 | // if (sop.Sound != UUID.Zero) force it till sop crossing does clear it on child prim | ||
1431 | { | ||
1432 | WriteUUID(writer, "SoundID", sop.Sound, options); | ||
1433 | writer.WriteElementString("SoundGain", sop.SoundGain.ToString().ToLower()); | ||
1434 | writer.WriteElementString("SoundFlags", sop.SoundFlags.ToString().ToLower()); | ||
1435 | writer.WriteElementString("SoundRadius", sop.SoundRadius.ToString().ToLower()); | ||
1436 | } | ||
1437 | writer.WriteElementString("SoundQueueing", sop.SoundQueueing.ToString().ToLower()); | ||
1438 | |||
1387 | writer.WriteEndElement(); | 1439 | writer.WriteEndElement(); |
1388 | } | 1440 | } |
1389 | 1441 | ||
@@ -1451,7 +1503,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1451 | 1503 | ||
1452 | WriteUUID(writer, "CreatorID", item.CreatorID, options); | 1504 | WriteUUID(writer, "CreatorID", item.CreatorID, options); |
1453 | 1505 | ||
1454 | if (item.CreatorData != null && item.CreatorData != string.Empty) | 1506 | if (!string.IsNullOrEmpty(item.CreatorData)) |
1455 | writer.WriteElementString("CreatorData", item.CreatorData); | 1507 | writer.WriteElementString("CreatorData", item.CreatorData); |
1456 | else if (options.ContainsKey("home")) | 1508 | else if (options.ContainsKey("home")) |
1457 | { | 1509 | { |
@@ -1539,6 +1591,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1539 | writer.WriteElementString("ProfileEnd", shp.ProfileEnd.ToString()); | 1591 | writer.WriteElementString("ProfileEnd", shp.ProfileEnd.ToString()); |
1540 | writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString()); | 1592 | writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString()); |
1541 | writer.WriteElementString("State", shp.State.ToString()); | 1593 | writer.WriteElementString("State", shp.State.ToString()); |
1594 | writer.WriteElementString("LastAttachPoint", shp.LastAttachPoint.ToString()); | ||
1542 | 1595 | ||
1543 | WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options); | 1596 | WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options); |
1544 | WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options); | 1597 | WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options); |