Added DynAttrs to the serialized XML format of prims. When copying prims, use deep copy for DynAttrs.

user_profiles
Oren Hurvitz 2013-01-22 11:59:20 +02:00 committed by Justin Clark-Casey (justincc)
parent 86802bcf93
commit af6a7cf95d
3 changed files with 40 additions and 2 deletions

View File

@ -67,7 +67,7 @@ namespace OpenSim.Framework
public void ReadXml(string rawXml) public void ReadXml(string rawXml)
{ {
//System.Console.WriteLine("Trying to deserialize [{0}]", rawXml); // System.Console.WriteLine("Trying to deserialize [{0}]", rawXml);
lock (this) lock (this)
m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml); m_map = (OSDMap)OSDParser.DeserializeLLSDXml(rawXml);
@ -87,7 +87,29 @@ namespace OpenSim.Framework
public void WriteXml(XmlWriter writer) public void WriteXml(XmlWriter writer)
{ {
writer.WriteRaw(ToXml()); writer.WriteRaw(ToXml());
} }
public void CopyFrom(DAMap other)
{
// Deep copy
string data = null;
lock (other)
{
if (other.Count > 0)
{
data = OSDParser.SerializeLLSDXmlString(other.m_map);
}
}
lock (this)
{
if (data == null)
Clear();
else
m_map = (OSDMap)OSDParser.DeserializeLLSDXml(data);
}
}
/// <summary> /// <summary>
/// Returns the number of data stores. /// Returns the number of data stores.

View File

@ -1625,6 +1625,8 @@ namespace OpenSim.Region.Framework.Scenes
Array.Copy(Shape.ExtraParams, extraP, extraP.Length); Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
dupe.Shape.ExtraParams = extraP; dupe.Shape.ExtraParams = extraP;
dupe.DynAttrs.CopyFrom(DynAttrs);
if (userExposed) if (userExposed)
{ {
/* /*

View File

@ -359,6 +359,7 @@ 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("DynAttrs", ProcessDynAttrs);
m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation);
m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0); m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0);
@ -722,6 +723,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty);
} }
private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader)
{
obj.DynAttrs.ReadXml(reader);
}
private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader) private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader)
{ {
obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty)); obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty));
@ -1235,6 +1241,14 @@ 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());
if (sop.DynAttrs.Count > 0)
{
writer.WriteStartElement("DynAttrs");
sop.DynAttrs.WriteXml(writer);
writer.WriteEndElement();
}
WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); WriteBytes(writer, "TextureAnimation", sop.TextureAnimation);
WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); WriteBytes(writer, "ParticleSystem", sop.ParticleSystem);
writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString()); writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString());