Route OAR SOG loading through the common SceneObjectSerializer.FromXml2Format() rather than the functionally identical but buggy Xml2ToSOG().

Remove buggy Xml2ToSOG().
0.7.3-extended
Justin Clark-Casey (justincc) 2012-05-16 00:10:42 +01:00
parent 0d73f81fb5
commit 5473c4f8cc
3 changed files with 5 additions and 115 deletions

View File

@ -265,8 +265,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
*/
SceneObjectGroup sceneObject = SceneObjectSerializer.FromXml2Format(serialisedSceneObject);
// SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject);
SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject);
// For now, give all incoming scene objects new uuids. This will allow scenes to be cloned
// on the same region server and multiple examples a single object archive to be imported

View File

@ -1417,51 +1417,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
}
}
//////// Read /////////
public static bool Xml2ToSOG(XmlTextReader reader, SceneObjectGroup sog)
{
reader.Read();
reader.ReadStartElement("SceneObjectGroup");
SceneObjectPart root = Xml2ToSOP(reader);
if (root != null)
sog.SetRootPart(root);
else
{
return false;
}
if (sog.UUID == UUID.Zero)
sog.UUID = sog.RootPart.UUID;
reader.Read(); // OtherParts
while (!reader.EOF)
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (reader.Name == "SceneObjectPart")
{
SceneObjectPart child = Xml2ToSOP(reader);
if (child != null)
sog.AddPart(child);
}
else
{
//Logger.Log("Found unexpected prim XML element " + reader.Name, Helpers.LogLevel.Debug);
reader.Read();
}
break;
case XmlNodeType.EndElement:
default:
reader.Read();
break;
}
}
return true;
}
public static SceneObjectPart Xml2ToSOP(XmlTextReader reader)
{
SceneObjectPart obj = new SceneObjectPart();

View File

@ -223,50 +223,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString)
{
XmlDocument doc = new XmlDocument();
XmlNode rootNode;
XmlTextReader reader = new XmlTextReader(new StringReader(xmlString));
reader.WhitespaceHandling = WhitespaceHandling.None;
doc.Load(reader);
reader.Close();
rootNode = doc.FirstChild;
// This is to deal with neighbouring regions that are still surrounding the group xml with the <scene>
// tag. It should be possible to remove the first part of this if statement once we go past 0.5.9 (or
// when some other changes forces all regions to upgrade).
// This might seem rather pointless since prim crossing from this revision to an earlier revision remains
// broken. But it isn't much work to accomodate the old format here.
if (rootNode.LocalName.Equals("scene"))
{
foreach (XmlNode aPrimNode in rootNode.ChildNodes)
{
// There is only ever one prim. This oddity should be removeable post 0.5.9
//return SceneObjectSerializer.FromXml2Format(aPrimNode.OuterXml);
using (reader = new XmlTextReader(new StringReader(aPrimNode.OuterXml)))
{
SceneObjectGroup obj = new SceneObjectGroup();
if (SceneObjectSerializer.Xml2ToSOG(reader, obj))
return obj;
return null;
}
}
return null;
}
else
{
//return SceneObjectSerializer.FromXml2Format(rootNode.OuterXml);
using (reader = new XmlTextReader(new StringReader(rootNode.OuterXml)))
{
SceneObjectGroup obj = new SceneObjectGroup();
if (SceneObjectSerializer.Xml2ToSOG(reader, obj))
return obj;
return null;
}
}
return SceneObjectSerializer.FromXml2Format(xmlString);
}
/// <summary>
@ -307,8 +264,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
foreach (XmlNode aPrimNode in rootNode.ChildNodes)
{
SceneObjectGroup obj = CreatePrimFromXml2(scene, aPrimNode.OuterXml);
if (obj != null && startScripts)
SceneObjectGroup obj = DeserializeGroupFromXml2(aPrimNode.OuterXml);
if (startScripts)
sceneObjects.Add(obj);
}
@ -319,27 +276,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
}
}
/// <summary>
/// Create a prim from the xml2 representation.
/// </summary>
/// <param name="scene"></param>
/// <param name="xmlData"></param>
/// <returns>The scene object created. null if the scene object already existed</returns>
protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData)
{
//SceneObjectGroup obj = SceneObjectSerializer.FromXml2Format(xmlData);
using (XmlTextReader reader = new XmlTextReader(new StringReader(xmlData)))
{
SceneObjectGroup obj = new SceneObjectGroup();
SceneObjectSerializer.Xml2ToSOG(reader, obj);
if (scene.AddRestoredSceneObject(obj, true, false))
return obj;
else
return null;
}
}
#endregion
}
}
}