From 29eec3350649f377e61d144d73178c67757070ba Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 16 Nov 2008 04:40:36 +0000 Subject: * Abstracted some methods from SceneObjectGroup to allow them to be overridden more easily. Specifically object creation from XML. --- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 15 +++++++++++++-- OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 1 - 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index acb6888..0af2ad2 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -473,6 +473,11 @@ namespace OpenSim.Region.Environment.Scenes /// public SceneObjectGroup(string xmlData) { + SetFromXml(xmlData); + } + + protected void SetFromXml(string xmlData) + { // libomv.types changes UUID to Guid xmlData = xmlData.Replace("", ""); xmlData = xmlData.Replace("", ""); @@ -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; + } + /// /// Constructor. This object is added to the scene later via AttachToScene() /// diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 5dbf3b7..acec921 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -1306,7 +1306,6 @@ if (m_shape != null) { /// /// Restore this part from the serialized xml representation. /// - /// /// public static SceneObjectPart FromXml(XmlReader xmlReader) { -- cgit v1.1