From c9fe500212cf8b8231ef0604a1f577e9bbedfcbe Mon Sep 17 00:00:00 2001 From: MW Date: Tue, 1 Jul 2008 19:23:45 +0000 Subject: Added "save-prims-xml2 ", 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 --- OpenSim/Region/Environment/Scenes/Scene.cs | 21 +++++++++++++++++++++ OpenSim/Region/Environment/Scenes/SceneManager.cs | 5 +++++ 2 files changed, 26 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes') 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 m_serialiser.SavePrimsToXml2(this, fileName); } + + public void SaveNamedPrimsToXml2(string primName, string fileName) + { + List entityList = GetEntities(); + List primList = new List(); + + foreach (EntityBase ent in entityList) + { + if (ent is SceneObjectGroup) + { + if (ent.Name == primName) + { + primList.Add(ent); + } + } + } + + m_serialiser.SavePrimListToXml2(primList, fileName); + } + + /// /// Load a prim archive into the scene. This loads both prims and their assets. /// 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 CurrentOrFirstScene.SavePrimsToXml2(filename); } + public void SaveNamedPrimsToXml2(string primName, string filename) + { + CurrentOrFirstScene.SaveNamedPrimsToXml2( primName, filename); + } + /// /// Load an xml file of prims in OpenSimulator's current 'xml2' file format to the current scene /// -- cgit v1.1