* Abstracted some methods from SceneObjectGroup to allow them to be overridden more easily. Specifically object creation from XML.

0.6.1-post-fixes
Adam Frisby 2008-11-16 04:40:36 +00:00
parent 8e119130c5
commit 29eec33506
2 changed files with 13 additions and 3 deletions

View File

@ -472,6 +472,11 @@ namespace OpenSim.Region.Environment.Scenes
/// Create an object using serialized data in OpenSim's xml2 format.
/// </summary>
public SceneObjectGroup(string xmlData)
{
SetFromXml(xmlData);
}
protected void SetFromXml(string xmlData)
{
// libomv.types changes UUID to Guid
xmlData = xmlData.Replace("<UUID>", "<Guid>");
@ -486,7 +491,7 @@ namespace OpenSim.Region.Environment.Scenes
reader.Read();
reader.ReadStartElement("SceneObjectGroup");
SetRootPart(SceneObjectPart.FromXml(reader));
SetRootPart(CreatePartFromXml(reader));
reader.Read();
bool more = true;
@ -498,7 +503,7 @@ namespace OpenSim.Region.Environment.Scenes
case XmlNodeType.Element:
if (reader.Name == "SceneObjectPart")
{
SceneObjectPart part = SceneObjectPart.FromXml(reader);
SceneObjectPart part = CreatePartFromXml(reader);
AddPart(part);
part.StoreUndoState();
}
@ -519,6 +524,12 @@ namespace OpenSim.Region.Environment.Scenes
sr.Close();
}
protected virtual SceneObjectPart CreatePartFromXml(XmlTextReader reader)
{
SceneObjectPart part = SceneObjectPart.FromXml(reader);
return part;
}
/// <summary>
/// Constructor. This object is added to the scene later via AttachToScene()
/// </summary>

View File

@ -1306,7 +1306,6 @@ if (m_shape != null) {
/// <summary>
/// Restore this part from the serialized xml representation.
/// </summary>
/// <param name="xmlreader"></param>
/// <returns></returns>
public static SceneObjectPart FromXml(XmlReader xmlReader)
{