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

View File

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