aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-12-19 19:47:11 +0000
committerJustin Clarke Casey2008-12-19 19:47:11 +0000
commitaa497a18678c6cc9a7425986c5bf5ca91415bd1d (patch)
tree71539fcfec1b22b057b5553776fe24a940fa6b6b
parentminor: Remove some serialization module scene wrappers (diff)
downloadopensim-SC_OLD-aa497a18678c6cc9a7425986c5bf5ca91415bd1d.zip
opensim-SC_OLD-aa497a18678c6cc9a7425986c5bf5ca91415bd1d.tar.gz
opensim-SC_OLD-aa497a18678c6cc9a7425986c5bf5ca91415bd1d.tar.bz2
opensim-SC_OLD-aa497a18678c6cc9a7425986c5bf5ca91415bd1d.tar.xz
* refactor: move saved named prims to xml2 method out into the serialization module
-rw-r--r--OpenSim/Region/Environment/Interfaces/IRegionSerialiserModule.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs29
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs22
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs4
5 files changed, 36 insertions, 26 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionSerialiserModule.cs b/OpenSim/Region/Environment/Interfaces/IRegionSerialiserModule.cs
index 29d5d47..b89f869 100644
--- a/OpenSim/Region/Environment/Interfaces/IRegionSerialiserModule.cs
+++ b/OpenSim/Region/Environment/Interfaces/IRegionSerialiserModule.cs
@@ -102,6 +102,8 @@ namespace OpenSim.Region.Environment.Interfaces
102 /// <param name="min"></param> 102 /// <param name="min"></param>
103 /// <param name="max"></param> 103 /// <param name="max"></param>
104 void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max); 104 void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max);
105
106 void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName);
105 107
106 /// <summary> 108 /// <summary>
107 /// Deserializes a scene object from its xml2 representation. This does not load the object into the scene. 109 /// Deserializes a scene object from its xml2 representation. This does not load the object into the scene.
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
index c856b5b..2e9c551 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
@@ -28,10 +28,10 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31//using System.Reflection; 31using System.Reflection;
32using System.Xml; 32using System.Xml;
33using OpenMetaverse; 33using OpenMetaverse;
34//using log4net; 34using log4net;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Physics.Manager; 36using OpenSim.Region.Physics.Manager;
37 37
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Scenes
42 /// </summary> 42 /// </summary>
43 public class SceneXmlLoader 43 public class SceneXmlLoader
44 { 44 {
45 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) 47 public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset)
48 { 48 {
@@ -213,6 +213,29 @@ namespace OpenSim.Region.Environment.Scenes
213 213
214 SavePrimListToXml2(EntityList, stream, min, max); 214 SavePrimListToXml2(EntityList, stream, min, max);
215 } 215 }
216
217 public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName)
218 {
219 m_log.InfoFormat(
220 "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}",
221 primName, scene.RegionInfo.RegionName, fileName);
222
223 List<EntityBase> entityList = scene.GetEntities();
224 List<EntityBase> primList = new List<EntityBase>();
225
226 foreach (EntityBase ent in entityList)
227 {
228 if (ent is SceneObjectGroup)
229 {
230 if (ent.Name == primName)
231 {
232 primList.Add(ent);
233 }
234 }
235 }
236
237 SavePrimListToXml2(primList, fileName);
238 }
216 239
217 public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName) 240 public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName)
218 { 241 {
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
index 8b5dd2c..c1af947 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
@@ -116,6 +116,11 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
116 { 116 {
117 SceneXmlLoader.SavePrimsToXml2(scene, stream, min, max); 117 SceneXmlLoader.SavePrimsToXml2(scene, stream, min, max);
118 } 118 }
119
120 public void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName)
121 {
122 SceneXmlLoader.SaveNamedPrimsToXml2(scene, primName, fileName);
123 }
119 124
120 public SceneObjectGroup DeserializeGroupFromXml2(string xmlString) 125 public SceneObjectGroup DeserializeGroupFromXml2(string xmlString)
121 { 126 {
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index eaf04ea..70cd45e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1880,28 +1880,6 @@ namespace OpenSim.Region.Environment.Scenes
1880 return false; 1880 return false;
1881 } 1881 }
1882 1882
1883 public void SaveNamedPrimsToXml2(string primName, string fileName)
1884 {
1885 m_log.InfoFormat(
1886 "[SCENE]: Saving prims with name {0} in xml2 format for region {1} to {2}", primName, RegionInfo.RegionName, fileName);
1887
1888 List<EntityBase> entityList = GetEntities();
1889 List<EntityBase> primList = new List<EntityBase>();
1890
1891 foreach (EntityBase ent in entityList)
1892 {
1893 if (ent is SceneObjectGroup)
1894 {
1895 if (ent.Name == primName)
1896 {
1897 primList.Add(ent);
1898 }
1899 }
1900 }
1901
1902 m_serialiser.SavePrimListToXml2(primList, fileName);
1903 }
1904
1905 /// <summary> 1883 /// <summary>
1906 /// Move the given scene object into a new region depending on which region its absolute position has moved 1884 /// Move the given scene object into a new region depending on which region its absolute position has moved
1907 /// into. 1885 /// into.
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index 9e83f25..d585b48 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -215,7 +215,9 @@ namespace OpenSim.Region.Environment.Scenes
215 215
216 public void SaveNamedPrimsToXml2(string primName, string filename) 216 public void SaveNamedPrimsToXml2(string primName, string filename)
217 { 217 {
218 CurrentOrFirstScene.SaveNamedPrimsToXml2( primName, filename); 218 IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
219 if (serialiser != null)
220 serialiser.SaveNamedPrimsToXml2(CurrentOrFirstScene, primName, filename);
219 } 221 }
220 222
221 /// <summary> 223 /// <summary>