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
parent
0aaf0c4565
commit
c9fe500212
|
@ -401,6 +401,17 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "save-prims-xml2":
|
||||||
|
if (cmdparams.Length > 1)
|
||||||
|
{
|
||||||
|
m_sceneManager.SaveNamedPrimsToXml2(cmdparams[0], cmdparams[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_sceneManager.SaveNamedPrimsToXml2("Primitive", DEFAULT_PRIM_BACKUP_FILENAME);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case "load-oar":
|
case "load-oar":
|
||||||
m_log.Error("[CONSOLE]: Don't use me - I haven't yet been sufficiently implemented!");
|
m_log.Error("[CONSOLE]: Don't use me - I haven't yet been sufficiently implemented!");
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,13 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
|
||||||
/// <param name="fileName"></param>
|
/// <param name="fileName"></param>
|
||||||
void SavePrimsToXml2(Scene scene, string fileName);
|
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>
|
/// <summary>
|
||||||
/// Load an individual scene object from the xml2 format
|
/// Load an individual scene object from the xml2 format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -185,15 +185,20 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SavePrimsToXml2(Scene scene, string fileName)
|
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);
|
FileStream file = new FileStream(fileName, FileMode.Create);
|
||||||
StreamWriter stream = new StreamWriter(file);
|
StreamWriter stream = new StreamWriter(file);
|
||||||
int primCount = 0;
|
int primCount = 0;
|
||||||
stream.WriteLine("<scene>\n");
|
stream.WriteLine("<scene>\n");
|
||||||
|
|
||||||
List<EntityBase> EntityList = scene.GetEntities();
|
foreach (EntityBase ent in entityList)
|
||||||
|
|
||||||
foreach (EntityBase ent in EntityList)
|
|
||||||
{
|
{
|
||||||
if (ent is SceneObjectGroup)
|
if (ent is SceneObjectGroup)
|
||||||
{
|
{
|
||||||
|
|
|
@ -122,6 +122,11 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
|
||||||
return SceneXmlLoader.SaveGroupToXml2(grp);
|
return SceneXmlLoader.SaveGroupToXml2(grp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SavePrimListToXml2(List<EntityBase> entityList, string fileName)
|
||||||
|
{
|
||||||
|
SceneXmlLoader.SavePrimListToXml2(entityList, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
public List<string> SerialiseRegion(Scene scene, string saveDir)
|
public List<string> SerialiseRegion(Scene scene, string saveDir)
|
||||||
{
|
{
|
||||||
List<string> results = new List<string>();
|
List<string> results = new List<string>();
|
||||||
|
|
|
@ -1738,6 +1738,27 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_serialiser.SavePrimsToXml2(this, fileName);
|
m_serialiser.SavePrimsToXml2(this, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void SaveNamedPrimsToXml2(string primName, string fileName)
|
||||||
|
{
|
||||||
|
List<EntityBase> entityList = GetEntities();
|
||||||
|
List<EntityBase> primList = new List<EntityBase>();
|
||||||
|
|
||||||
|
foreach (EntityBase ent in entityList)
|
||||||
|
{
|
||||||
|
if (ent is SceneObjectGroup)
|
||||||
|
{
|
||||||
|
if (ent.Name == primName)
|
||||||
|
{
|
||||||
|
primList.Add(ent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_serialiser.SavePrimListToXml2(primList, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load a prim archive into the scene. This loads both prims and their assets.
|
/// Load a prim archive into the scene. This loads both prims and their assets.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -204,6 +204,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
CurrentOrFirstScene.SavePrimsToXml2(filename);
|
CurrentOrFirstScene.SavePrimsToXml2(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveNamedPrimsToXml2(string primName, string filename)
|
||||||
|
{
|
||||||
|
CurrentOrFirstScene.SaveNamedPrimsToXml2( primName, filename);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load an xml file of prims in OpenSimulator's current 'xml2' file format to the current scene
|
/// Load an xml file of prims in OpenSimulator's current 'xml2' file format to the current scene
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue