diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs
index 80dced7079..6ad3b732a9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs
@@ -41,6 +41,7 @@ using OpenSim.Framework.Communications.Clients;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Hypergrid;
+using OpenSim.Region.Framework.Scenes.Serialization;
namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion
{
@@ -641,7 +642,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion
SceneObjectGroup sog = null;
try
{
- sog = new SceneObjectGroup(sogXmlStr);
+ sog = SceneObjectSerializer.FromXml2Format(sogXmlStr);
sog.ExtraFromXmlString(extraStr);
}
catch (Exception ex)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index cceb444113..fd2d746d5b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -406,78 +406,6 @@ namespace OpenSim.Region.Framework.Scenes
SetRootPart(part);
}
- ///
- /// Create an object using serialized data in OpenSim's xml2 format.
- ///
- public SceneObjectGroup(string xmlData)
- {
- SetFromXml(xmlData);
- }
-
- protected void SetFromXml(string xmlData)
- {
-
- //m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
- //int time = System.Environment.TickCount;
-
- // libomv.types changes UUID to Guid
- xmlData = xmlData.Replace("", "");
- xmlData = xmlData.Replace("", "");
-
- // Handle Nested property
- xmlData = xmlData.Replace("", "");
- xmlData = xmlData.Replace("", "");
-
- try
- {
-
- XmlDocument doc = new XmlDocument();
- doc.LoadXml(xmlData);
-
- XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart");
-
- // Process the root part first
- if (parts.Count > 0)
- {
- StringReader sr = new StringReader(parts[0].OuterXml);
- XmlTextReader reader = new XmlTextReader(sr);
- SetRootPart(CreatePartFromXml(reader));
- reader.Close();
- sr.Close();
- }
-
- // Then deal with the rest
- for (int i=1; i
/// Constructor. This object is added to the scene later via AttachToScene()
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs
index 212ca72ee2..49fe8a4678 100644
--- a/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs
@@ -125,14 +125,14 @@ namespace OpenSim.Region.Framework.Scenes
foreach (XmlNode aPrimNode in rootNode.ChildNodes)
{
// There is only ever one prim. This oddity should be removeable post 0.5.9
- return new SceneObjectGroup(aPrimNode.OuterXml);
+ return SceneObjectSerializer.FromXml2Format(aPrimNode.OuterXml);
}
return null;
}
else
{
- return new SceneObjectGroup(rootNode.OuterXml);
+ return SceneObjectSerializer.FromXml2Format(rootNode.OuterXml);
}
}
@@ -193,7 +193,7 @@ namespace OpenSim.Region.Framework.Scenes
/// The scene object created. null if the scene object already existed
protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData)
{
- SceneObjectGroup obj = new SceneObjectGroup(xmlData);
+ SceneObjectGroup obj = SceneObjectSerializer.FromXml2Format(xmlData);
if (scene.AddRestoredSceneObject(obj, true, false))
return obj;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 9eac3be388..aa331d9a55 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
///
///
///
- public static SceneObjectGroup FromOriginalXmlFormat(UUID fromUserInventoryItemID, string serialization)
+ public static SceneObjectGroup FromOriginalXmlFormat(UUID fromUserInventoryItemID, string xmlData)
{
//m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
//int time = System.Environment.TickCount;
@@ -67,12 +67,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
SceneObjectGroup sceneObject = new SceneObjectGroup();
// libomv.types changes UUID to Guid
- serialization = serialization.Replace("", "");
- serialization = serialization.Replace("", "");
+ xmlData = xmlData.Replace("", "");
+ xmlData = xmlData.Replace("", "");
// Handle Nested property
- serialization = serialization.Replace("", "");
- serialization = serialization.Replace("", "");
+ xmlData = xmlData.Replace("", "");
+ xmlData = xmlData.Replace("", "");
try
{
@@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
int linkNum;
doc = new XmlDocument();
- doc.LoadXml(serialization);
+ doc.LoadXml(xmlData);
parts = doc.GetElementsByTagName("RootPart");
if (parts.Count == 0)
@@ -122,7 +122,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
catch (Exception e)
{
m_log.ErrorFormat(
- "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, serialization);
+ "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
}
//m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
@@ -130,6 +130,70 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
return sceneObject;
}
+ ///
+ /// Deserialize a scene object from the 'xml2' format
+ ///
+ ///
+ ///
+ public static SceneObjectGroup FromXml2Format(string xmlData)
+ {
+ //m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
+ //int time = System.Environment.TickCount;
+
+ SceneObjectGroup sceneObject = new SceneObjectGroup();
+
+ // libomv.types changes UUID to Guid
+ xmlData = xmlData.Replace("", "");
+ xmlData = xmlData.Replace("", "");
+
+ // Handle Nested property
+ xmlData = xmlData.Replace("", "");
+ xmlData = xmlData.Replace("", "");
+
+ try
+ {
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(xmlData);
+
+ XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart");
+
+ // Process the root part first
+ if (parts.Count > 0)
+ {
+ StringReader sr = new StringReader(parts[0].OuterXml);
+ XmlTextReader reader = new XmlTextReader(sr);
+ sceneObject.SetRootPart(SceneObjectPart.FromXml(reader));
+ reader.Close();
+ sr.Close();
+ }
+
+ // Then deal with the rest
+ for (int i = 1; i < parts.Count; i++)
+ {
+ StringReader sr = new StringReader(parts[i].OuterXml);
+ XmlTextReader reader = new XmlTextReader(sr);
+ SceneObjectPart part = SceneObjectPart.FromXml(reader);
+ sceneObject.AddPart(part);
+ part.StoreUndoState();
+ reader.Close();
+ sr.Close();
+ }
+
+ // Script state may, or may not, exist. Not having any, is NOT
+ // ever a problem.
+
+ sceneObject.LoadScriptState(doc);
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
+ }
+
+ //m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
+
+ return sceneObject;
+ }
+
///
/// Serialize a scene object to the original xml format
///
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
index c9a760b9af..a4ee27010c 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
@@ -25,15 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#region Header
-
-// CMModel.cs
-// User: bongiojp
-//
-//
-
-#endregion Header
-
using System;
using System.Collections;
using System.Collections.Generic;
@@ -45,6 +36,7 @@ using OpenSim;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
+using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Region.Physics.Manager;
using log4net;
@@ -211,14 +203,15 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
foreach (string xml in xmllist)
{
- try{
- temp = new SceneObjectGroup(xml);
+ try
+ {
+ temp = SceneObjectSerializer.FromXml2Format(xml);
temp.SetScene(scene);
foreach (SceneObjectPart part in temp.Children.Values)
part.RegionHandle = scene.RegionInfo.RegionHandle;
ReplacementList.Add(temp.UUID, (EntityBase)temp);
}
- catch(Exception e)
+ catch (Exception e)
{
m_log.Info("[CMMODEL]: Error while creating replacement list for rollback: " + e);
}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
index 4d650389c1..cbd2a6fbf2 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
@@ -25,15 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#region Header
-
-// ContentManagementEntity.cs
-// User: bongiojp
-//
-//
-
-#endregion Header
-
using System;
using System.Collections.Generic;
using System.Drawing;
@@ -45,6 +36,7 @@ using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
+using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Region.Physics.Manager;
using log4net;
@@ -87,7 +79,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
public ContentManagementEntity(string objectXML, Scene scene, bool physics)
: base(objectXML, scene, false)
{
- m_UnchangedEntity = new SceneObjectGroup(objectXML);
+ m_UnchangedEntity = SceneObjectSerializer.FromXml2Format(objectXML);
}
#endregion Constructors
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
index 7ff58daad0..184c55ad06 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
@@ -25,16 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#region Header
-
-// MetaEntity.cs
-// User: bongiojp
-//
-// TODO:
-// Create a physics manager to the meta object if there isn't one or the object knows of no scene but the user wants physics enabled.
-
-#endregion Header
-
using System;
using System.Collections.Generic;
using System.Drawing;
@@ -46,6 +36,7 @@ using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
+using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Region.Physics.Manager;
using log4net;
@@ -98,7 +89,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
///
public MetaEntity(string objectXML, Scene scene, bool physics)
{
- m_Entity = new SceneObjectGroup(objectXML);
+ m_Entity = SceneObjectSerializer.FromXml2Format(objectXML);
m_Entity.SetScene(scene);
Initialize(physics);
}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs
index 22f09fd33d..da3ba46911 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs
@@ -25,16 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#region Header
-
-// PointMetaEntity.cs created with MonoDevelop
-// User: bongiojp at 3:03 PMĀ 8/6/2008
-//
-// To change standard headers go to Edit->Preferences->Coding->Standard Headers
-//
-
-#endregion Header
-
using System;
using System.Collections.Generic;
using System.Drawing;