* refactor: break out sog loading code into two parts so that post-deserialization changes can be carried out before adding it to a scene

This commit is contained in:
Justin Clarke Casey
2008-07-18 14:42:06 +00:00
parent a6e2589537
commit f8721c3c1c
5 changed files with 22 additions and 24 deletions

View File

@@ -81,12 +81,11 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
void SavePrimListToXml2(List<EntityBase> entityList, string fileName);
/// <summary>
/// Load an individual scene object from the xml2 format
/// Deserializes a scene object from its xml2 representation. This does not load the object into the scene.
/// </summary>
/// <param name="scene"></param>
/// <param name="xmlString"></param>
/// <returns>The scene object created. null if the scene object already existed</returns>
SceneObjectGroup LoadGroupFromXml2(Scene scene, string xmlString);
SceneObjectGroup DeserializeGroupFromXml2(string xmlString);
/// <summary>
/// Serialize an individual scene object into the xml2 format

View File

@@ -104,7 +104,7 @@ namespace OpenSim.Region.Environment.Scenes
return grp.ToXmlString2();
}
public static SceneObjectGroup LoadGroupFromXml2(Scene scene, string xmlString)
public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString)
{
XmlDocument doc = new XmlDocument();
XmlNode rootNode;
@@ -124,15 +124,15 @@ namespace OpenSim.Region.Environment.Scenes
{
foreach (XmlNode aPrimNode in rootNode.ChildNodes)
{
CreatePrimFromXml2(scene, aPrimNode.OuterXml);
// There is only ever one prim. This oddity should be removeable post 0.5.9
return new SceneObjectGroup(aPrimNode.OuterXml);
}
// There is only ever one prim, but it's easiest to return null here since this part should disappear post 0.5.9 anyway
return null;
}
else
{
return CreatePrimFromXml2(scene, rootNode.OuterXml);
return new SceneObjectGroup(rootNode.OuterXml);
}
}

View File

@@ -112,9 +112,9 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
SceneXmlLoader.SavePrimsToXml2(scene, fileName);
}
public SceneObjectGroup LoadGroupFromXml2(Scene scene, string xmlString)
public SceneObjectGroup DeserializeGroupFromXml2(string xmlString)
{
return SceneXmlLoader.LoadGroupFromXml2(scene, xmlString);
return SceneXmlLoader.DeserializeGroupFromXml2(xmlString);
}
public string SaveGroupToXml2(SceneObjectGroup grp)