Added TextureAnimation and ParticleSystem to serialization.

viewer-2-initial-appearance
Diva Canto 2010-10-19 00:04:02 -07:00
parent b2c1a1c9bd
commit 684449f783
1 changed files with 27 additions and 0 deletions

View File

@ -318,6 +318,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound); m_SOPXmlProcessors.Add("CollisionSound", ProcessCollisionSound);
m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume); m_SOPXmlProcessors.Add("CollisionSoundVolume", ProcessCollisionSoundVolume);
m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl);
m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation);
m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
#endregion #endregion
#region TaskInventoryXmlProcessors initialization #region TaskInventoryXmlProcessors initialization
@ -663,6 +665,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
{ {
obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty);
} }
private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader)
{
obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty));
}
private static void ProcessParticleSystem(SceneObjectPart obj, XmlTextReader reader)
{
obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty));
}
#endregion #endregion
#region TaskInventoryXmlProcessors #region TaskInventoryXmlProcessors
@ -1128,6 +1140,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
if (sop.MediaUrl != null) if (sop.MediaUrl != null)
writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
WriteBytes(writer, "TextureAnimation", sop.TextureAnimation);
WriteBytes(writer, "ParticleSystem", sop.ParticleSystem);
writer.WriteEndElement(); writer.WriteEndElement();
} }
@ -1161,6 +1175,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteEndElement(); writer.WriteEndElement();
} }
static void WriteBytes(XmlTextWriter writer, string name, byte[] data)
{
writer.WriteStartElement(name);
byte[] d;
if (data != null)
d = data;
else
d = Utils.EmptyBytes;
writer.WriteBase64(d, 0, d.Length);
writer.WriteEndElement(); // name
}
static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options) static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options)
{ {
if (tinv.Count > 0) // otherwise skip this if (tinv.Count > 0) // otherwise skip this