diff options
author | MW | 2008-07-01 19:23:45 +0000 |
---|---|---|
committer | MW | 2008-07-01 19:23:45 +0000 |
commit | c9fe500212cf8b8231ef0604a1f577e9bbedfcbe (patch) | |
tree | 4515ef7ae75a913ff2172c5ad2d3be747ffc893d /OpenSim/Region | |
parent | Mantis#1640. Thank you, Chernega for a patch that addresses: (diff) | |
download | opensim-SC-c9fe500212cf8b8231ef0604a1f577e9bbedfcbe.zip opensim-SC-c9fe500212cf8b8231ef0604a1f577e9bbedfcbe.tar.gz opensim-SC-c9fe500212cf8b8231ef0604a1f577e9bbedfcbe.tar.bz2 opensim-SC-c9fe500212cf8b8231ef0604a1f577e9bbedfcbe.tar.xz |
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 '')
6 files changed, 58 insertions, 4 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 60e00a2..4afe37b 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -401,6 +401,17 @@ namespace OpenSim | |||
401 | } | 401 | } |
402 | break; | 402 | break; |
403 | 403 | ||
404 | case "save-prims-xml2": | ||
405 | if (cmdparams.Length > 1) | ||
406 | { | ||
407 | m_sceneManager.SaveNamedPrimsToXml2(cmdparams[0], cmdparams[1]); | ||
408 | } | ||
409 | else | ||
410 | { | ||
411 | m_sceneManager.SaveNamedPrimsToXml2("Primitive", DEFAULT_PRIM_BACKUP_FILENAME); | ||
412 | } | ||
413 | break; | ||
414 | |||
404 | case "load-oar": | 415 | case "load-oar": |
405 | m_log.Error("[CONSOLE]: Don't use me - I haven't yet been sufficiently implemented!"); | 416 | m_log.Error("[CONSOLE]: Don't use me - I haven't yet been sufficiently implemented!"); |
406 | 417 | ||
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> |