diff options
Diffstat (limited to 'OpenSim/Region/Environment')
5 files changed, 47 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs index e6090a7..3ae7a54 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs | |||
@@ -74,6 +74,13 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser | |||
74 | void SavePrimsToXml2(Scene scene, string fileName); | 74 | void SavePrimsToXml2(Scene scene, string fileName); |
75 | 75 | ||
76 | /// <summary> | 76 | /// <summary> |
77 | /// Save a set of prims in the xml2 format | ||
78 | /// </summary> | ||
79 | /// <param name="entityList"></param> | ||
80 | /// <param name="fileName"></param> | ||
81 | void SavePrimListToXml2(List<EntityBase> entityList, string fileName); | ||
82 | |||
83 | /// <summary> | ||
77 | /// Load an individual scene object from the xml2 format | 84 | /// Load an individual scene object from the xml2 format |
78 | /// </summary> | 85 | /// </summary> |
79 | /// <param name="scene"></param> | 86 | /// <param name="scene"></param> |
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs index ed211e4..9bab2b6 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs | |||
@@ -186,18 +186,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
186 | 186 | ||
187 | public static void SavePrimsToXml2(Scene scene, string fileName) | 187 | public static void SavePrimsToXml2(Scene scene, string fileName) |
188 | { | 188 | { |
189 | List<EntityBase> EntityList = scene.GetEntities(); | ||
190 | |||
191 | SavePrimListToXml2(EntityList, fileName); | ||
192 | } | ||
193 | |||
194 | public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName) | ||
195 | { | ||
189 | FileStream file = new FileStream(fileName, FileMode.Create); | 196 | FileStream file = new FileStream(fileName, FileMode.Create); |
190 | StreamWriter stream = new StreamWriter(file); | 197 | StreamWriter stream = new StreamWriter(file); |
191 | int primCount = 0; | 198 | int primCount = 0; |
192 | stream.WriteLine("<scene>\n"); | 199 | stream.WriteLine("<scene>\n"); |
193 | 200 | ||
194 | List<EntityBase> EntityList = scene.GetEntities(); | 201 | foreach (EntityBase ent in entityList) |
195 | |||
196 | foreach (EntityBase ent in EntityList) | ||
197 | { | 202 | { |
198 | if (ent is SceneObjectGroup) | 203 | if (ent is SceneObjectGroup) |
199 | { | 204 | { |
200 | stream.WriteLine(((SceneObjectGroup) ent).ToXmlString2()); | 205 | stream.WriteLine(((SceneObjectGroup)ent).ToXmlString2()); |
201 | primCount++; | 206 | primCount++; |
202 | } | 207 | } |
203 | } | 208 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs index 28f3996..c7b5fa5 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs | |||
@@ -122,6 +122,11 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser | |||
122 | return SceneXmlLoader.SaveGroupToXml2(grp); | 122 | return SceneXmlLoader.SaveGroupToXml2(grp); |
123 | } | 123 | } |
124 | 124 | ||
125 | public void SavePrimListToXml2(List<EntityBase> entityList, string fileName) | ||
126 | { | ||
127 | SceneXmlLoader.SavePrimListToXml2(entityList, fileName); | ||
128 | } | ||
129 | |||
125 | public List<string> SerialiseRegion(Scene scene, string saveDir) | 130 | public List<string> SerialiseRegion(Scene scene, string saveDir) |
126 | { | 131 | { |
127 | List<string> results = new List<string>(); | 132 | List<string> results = new List<string>(); |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 261f73d..375756d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1738,6 +1738,27 @@ namespace OpenSim.Region.Environment.Scenes | |||
1738 | m_serialiser.SavePrimsToXml2(this, fileName); | 1738 | m_serialiser.SavePrimsToXml2(this, fileName); |
1739 | } | 1739 | } |
1740 | 1740 | ||
1741 | |||
1742 | public void SaveNamedPrimsToXml2(string primName, string fileName) | ||
1743 | { | ||
1744 | List<EntityBase> entityList = GetEntities(); | ||
1745 | List<EntityBase> primList = new List<EntityBase>(); | ||
1746 | |||
1747 | foreach (EntityBase ent in entityList) | ||
1748 | { | ||
1749 | if (ent is SceneObjectGroup) | ||
1750 | { | ||
1751 | if (ent.Name == primName) | ||
1752 | { | ||
1753 | primList.Add(ent); | ||
1754 | } | ||
1755 | } | ||
1756 | } | ||
1757 | |||
1758 | m_serialiser.SavePrimListToXml2(primList, fileName); | ||
1759 | } | ||
1760 | |||
1761 | |||
1741 | /// <summary> | 1762 | /// <summary> |
1742 | /// Load a prim archive into the scene. This loads both prims and their assets. | 1763 | /// Load a prim archive into the scene. This loads both prims and their assets. |
1743 | /// </summary> | 1764 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index add8081..a3a9c75 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -204,6 +204,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
204 | CurrentOrFirstScene.SavePrimsToXml2(filename); | 204 | CurrentOrFirstScene.SavePrimsToXml2(filename); |
205 | } | 205 | } |
206 | 206 | ||
207 | public void SaveNamedPrimsToXml2(string primName, string filename) | ||
208 | { | ||
209 | CurrentOrFirstScene.SaveNamedPrimsToXml2( primName, filename); | ||
210 | } | ||
211 | |||
207 | /// <summary> | 212 | /// <summary> |
208 | /// Load an xml file of prims in OpenSimulator's current 'xml2' file format to the current scene | 213 | /// Load an xml file of prims in OpenSimulator's current 'xml2' file format to the current scene |
209 | /// </summary> | 214 | /// </summary> |