diff options
Added "save-prims-xml2 <PrimName> <FileName>", as we were lacking a method to save a single primitive or small group of them. This command will save all prims in the current scene that name matches the "PrimName" parameter. The saved file is in standard xml2 format, so can be loaded using load-xml2
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World')
3 files changed, 21 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>(); |