diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 383063d240..c882146881 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -8,6 +8,7 @@ + diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index b6d28abbcf..e0331d39f4 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs @@ -28,7 +28,11 @@ using System; using System.Collections.Generic; using System.IO; +using System.Reflection; + +using log4net; using Nini.Config; + using OpenMetaverse; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.Framework.Interfaces; @@ -37,25 +41,32 @@ using OpenSim.Region.Framework.Scenes.Serialization; namespace OpenSim.Region.CoreModules.World.Serialiser { - public class SerialiserModule : IRegionModule, IRegionSerialiserModule + public class SerialiserModule : ISharedRegionModule, IRegionSerialiserModule { + private static readonly ILog m_log = + LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Commander m_commander = new Commander("export"); private List m_regions = new List(); private string m_savedir = "exports" + "/"; private List m_serialisers = new List(); - #region IRegionModule Members + #region ISharedRegionModule Members - public void Initialise(Scene scene, IConfigSource source) + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) { - scene.RegisterModuleCommander(m_commander); - scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; - scene.RegisterModuleInterface(this); - - lock (m_regions) + IConfig config = source.Configs["Serialiser"]; + if (config != null) { - m_regions.Add(scene); + m_savedir = config.GetString("save_dir", m_savedir); } + + m_log.InfoFormat("[Serialiser] Enabled, using save dir \"{0}\"", m_savedir); } public void PostInitialise() @@ -69,6 +80,31 @@ namespace OpenSim.Region.CoreModules.World.Serialiser LoadCommanderCommands(); } + + public void AddRegion(Scene scene) + { + scene.RegisterModuleCommander(m_commander); + scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; + scene.RegisterModuleInterface(this); + + lock (m_regions) + { + m_regions.Add(scene); + } + } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + lock (m_regions) + { + m_regions.Remove(scene); + } + } + public void Close() { m_regions.Clear(); @@ -79,13 +115,9 @@ namespace OpenSim.Region.CoreModules.World.Serialiser get { return "ExportSerialisationModule"; } } - public bool IsSharedModule - { - get { return true; } - } - #endregion + #region IRegionSerialiser Members public void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 8cd1d554b4..7fb2d25878 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -367,7 +367,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests presence2.AddAttachment(sog1); presence2.AddAttachment(sog2); - IRegionModule serialiser = new SerialiserModule(); + ISharedRegionModule serialiser = new SerialiserModule(); SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser);