mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
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
This commit is contained in:
@@ -73,6 +73,13 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
|
||||
/// <param name="fileName"></param>
|
||||
void SavePrimsToXml2(Scene scene, string fileName);
|
||||
|
||||
/// <summary>
|
||||
/// Save a set of prims in the xml2 format
|
||||
/// </summary>
|
||||
/// <param name="entityList"></param>
|
||||
/// <param name="fileName"></param>
|
||||
void SavePrimListToXml2(List<EntityBase> entityList, string fileName);
|
||||
|
||||
/// <summary>
|
||||
/// Load an individual scene object from the xml2 format
|
||||
/// </summary>
|
||||
|
||||
@@ -185,19 +185,24 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
}
|
||||
|
||||
public static void SavePrimsToXml2(Scene scene, string fileName)
|
||||
{
|
||||
List<EntityBase> EntityList = scene.GetEntities();
|
||||
|
||||
SavePrimListToXml2(EntityList, fileName);
|
||||
}
|
||||
|
||||
public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName)
|
||||
{
|
||||
FileStream file = new FileStream(fileName, FileMode.Create);
|
||||
StreamWriter stream = new StreamWriter(file);
|
||||
int primCount = 0;
|
||||
stream.WriteLine("<scene>\n");
|
||||
|
||||
List<EntityBase> EntityList = scene.GetEntities();
|
||||
|
||||
foreach (EntityBase ent in EntityList)
|
||||
foreach (EntityBase ent in entityList)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
stream.WriteLine(((SceneObjectGroup) ent).ToXmlString2());
|
||||
stream.WriteLine(((SceneObjectGroup)ent).ToXmlString2());
|
||||
primCount++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +122,11 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
|
||||
return SceneXmlLoader.SaveGroupToXml2(grp);
|
||||
}
|
||||
|
||||
public void SavePrimListToXml2(List<EntityBase> entityList, string fileName)
|
||||
{
|
||||
SceneXmlLoader.SavePrimListToXml2(entityList, fileName);
|
||||
}
|
||||
|
||||
public List<string> SerialiseRegion(Scene scene, string saveDir)
|
||||
{
|
||||
List<string> results = new List<string>();
|
||||
|
||||
Reference in New Issue
Block a user