diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs index f4586b044a..0115d8d697 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs @@ -43,12 +43,17 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver /// /// Path for the assets metadata file /// - public static readonly string ASSETS_METADATA_PATH = "assets.xml"; + //public static readonly string ASSETS_METADATA_PATH = "assets.xml"; /// /// Path for the prims file /// public static readonly string OBJECTS_PATH = "objects/"; + + /// + /// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out. + /// + public static readonly string TERRAINS_PATH = "terrains/"; /// /// Extensions used for asset types in the archive diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs index 3ef81494f2..2c43ffd329 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs @@ -27,12 +27,14 @@ using System; using System.Collections.Generic; +using System.IO; using System.Reflection; using libsecondlife; using log4net; using OpenSim.Framework; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Modules.World.Serialiser; +using OpenSim.Region.Environment.Modules.World.Terrain; using OpenSim.Region.Environment.Scenes; 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); + protected ITerrainModule m_terrainModule; protected IRegionSerialiser m_serialiser; protected List m_sceneObjects; + protected string m_sceneName; protected string m_savePath; public ArchiveWriteRequestExecution( - List sceneObjects, IRegionSerialiser serialiser, string savePath) + List sceneObjects, + ITerrainModule terrainModule, + IRegionSerialiser serialiser, + string sceneName, + string savePath) { m_sceneObjects = sceneObjects; + m_terrainModule = terrainModule; m_serialiser = serialiser; + m_sceneName = sceneName; m_savePath = savePath; } @@ -67,6 +77,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver 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) { //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); } + // Write out assets AssetsArchiver assetsArchiver = new AssetsArchiver(assets); assetsArchiver.Archive(archive); diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs index bed30b0672..cc60cff42b 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -29,6 +29,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Modules.World.Serialiser; +using OpenSim.Region.Environment.Modules.World.Terrain; using OpenSim.Region.Environment.Scenes; using System.Collections.Generic; 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 ArchiveWriteRequestExecution awre = new ArchiveWriteRequestExecution( - sceneObjects, m_scene.RequestModuleInterface(), m_savePath); + sceneObjects, + m_scene.RequestModuleInterface(), + m_scene.RequestModuleInterface(), + m_scene.RegionInfo.RegionName, + m_savePath); new AssetsRequest(assetUuids.Keys, m_scene.AssetCache, awre.ReceivedAllAssets).Execute(); } }