* Save terrain information in archive
* Not yet reloading * Terrain saving will be optional a little further down the line0.6.0-stable
parent
ca06387123
commit
f8d9ccc70e
|
@ -43,13 +43,18 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Path for the assets metadata file
|
/// Path for the assets metadata file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly string ASSETS_METADATA_PATH = "assets.xml";
|
//public static readonly string ASSETS_METADATA_PATH = "assets.xml";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Path for the prims file
|
/// Path for the prims file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly string OBJECTS_PATH = "objects/";
|
public static readonly string OBJECTS_PATH = "objects/";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string TERRAINS_PATH = "terrains/";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extensions used for asset types in the archive
|
/// Extensions used for asset types in the archive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -27,12 +27,14 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Modules.World.Serialiser;
|
using OpenSim.Region.Environment.Modules.World.Serialiser;
|
||||||
|
using OpenSim.Region.Environment.Modules.World.Terrain;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.World.Archiver
|
namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
|
@ -49,15 +51,23 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
protected ITerrainModule m_terrainModule;
|
||||||
protected IRegionSerialiser m_serialiser;
|
protected IRegionSerialiser m_serialiser;
|
||||||
protected List<SceneObjectGroup> m_sceneObjects;
|
protected List<SceneObjectGroup> m_sceneObjects;
|
||||||
|
protected string m_sceneName;
|
||||||
protected string m_savePath;
|
protected string m_savePath;
|
||||||
|
|
||||||
public ArchiveWriteRequestExecution(
|
public ArchiveWriteRequestExecution(
|
||||||
List<SceneObjectGroup> sceneObjects, IRegionSerialiser serialiser, string savePath)
|
List<SceneObjectGroup> sceneObjects,
|
||||||
|
ITerrainModule terrainModule,
|
||||||
|
IRegionSerialiser serialiser,
|
||||||
|
string sceneName,
|
||||||
|
string savePath)
|
||||||
{
|
{
|
||||||
m_sceneObjects = sceneObjects;
|
m_sceneObjects = sceneObjects;
|
||||||
|
m_terrainModule = terrainModule;
|
||||||
m_serialiser = serialiser;
|
m_serialiser = serialiser;
|
||||||
|
m_sceneName = sceneName;
|
||||||
m_savePath = savePath;
|
m_savePath = savePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +77,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
|
|
||||||
TarArchiveWriter archive = new TarArchiveWriter();
|
TarArchiveWriter archive = new TarArchiveWriter();
|
||||||
|
|
||||||
|
// Write out terrain
|
||||||
|
string terrainPath = String.Format("{0}{1}.png", ArchiveConstants.TERRAINS_PATH, m_sceneName);
|
||||||
|
MemoryStream ms = new MemoryStream();
|
||||||
|
m_terrainModule.SaveToStream(terrainPath, ms);
|
||||||
|
archive.AddFile(terrainPath, ms.ToArray());
|
||||||
|
ms.Close();
|
||||||
|
|
||||||
|
// Write out scene object metadata
|
||||||
foreach (SceneObjectGroup sceneObject in m_sceneObjects)
|
foreach (SceneObjectGroup sceneObject in m_sceneObjects)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
|
//m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
|
||||||
|
@ -84,6 +102,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
archive.AddFile(filename, serializedObject);
|
archive.AddFile(filename, serializedObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write out assets
|
||||||
AssetsArchiver assetsArchiver = new AssetsArchiver(assets);
|
AssetsArchiver assetsArchiver = new AssetsArchiver(assets);
|
||||||
assetsArchiver.Archive(archive);
|
assetsArchiver.Archive(archive);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Modules.World.Serialiser;
|
using OpenSim.Region.Environment.Modules.World.Serialiser;
|
||||||
|
using OpenSim.Region.Environment.Modules.World.Terrain;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -187,7 +188,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
// Asynchronously request all the assets required to perform this archive operation
|
// Asynchronously request all the assets required to perform this archive operation
|
||||||
ArchiveWriteRequestExecution awre
|
ArchiveWriteRequestExecution awre
|
||||||
= new ArchiveWriteRequestExecution(
|
= new ArchiveWriteRequestExecution(
|
||||||
sceneObjects, m_scene.RequestModuleInterface<IRegionSerialiser>(), m_savePath);
|
sceneObjects,
|
||||||
|
m_scene.RequestModuleInterface<ITerrainModule>(),
|
||||||
|
m_scene.RequestModuleInterface<IRegionSerialiser>(),
|
||||||
|
m_scene.RegionInfo.RegionName,
|
||||||
|
m_savePath);
|
||||||
new AssetsRequest(assetUuids.Keys, m_scene.AssetCache, awre.ReceivedAllAssets).Execute();
|
new AssetsRequest(assetUuids.Keys, m_scene.AssetCache, awre.ReceivedAllAssets).Execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue