From 791c4d5b9fe831cab3dd984184714e6e674918f9 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 10 Nov 2012 08:10:43 -0800 Subject: [PATCH] One more module converted: J2KDecoderModule. --- .../Agent/TextureSender/J2KDecoderModule.cs | 42 ++++++++++++++----- .../Resources/CoreModulePlugin.addin.xml | 1 + 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index a1a250176d..2879154ba6 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { public delegate void J2KDecodeDelegate(UUID assetID); - public class J2KDecoderModule : IRegionModule, IJ2KDecoder + public class J2KDecoderModule : ISharedRegionModule, IJ2KDecoder { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -56,26 +56,21 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender /// Cache that will store decoded JPEG2000 layer boundary data private IImprovedAssetCache m_cache; /// Reference to a scene (doesn't matter which one as long as it can load the cache module) + private UUID m_CreatorID = UUID.Zero; private Scene m_scene; - #region IRegionModule + #region ISharedRegionModule private bool m_useCSJ2K = true; public string Name { get { return "J2KDecoderModule"; } } - public bool IsSharedModule { get { return true; } } public J2KDecoderModule() { } - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) { - if (m_scene == null) - m_scene = scene; - - scene.RegisterModuleInterface(this); - IConfig startupConfig = source.Configs["Startup"]; if (startupConfig != null) { @@ -83,6 +78,24 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender } } + public void AddRegion(Scene scene) + { + if (m_scene == null) + { + m_scene = scene; + m_CreatorID = scene.RegionInfo.RegionID; + } + + scene.RegisterModuleInterface(this); + + } + + public void RemoveRegion(Scene scene) + { + if (m_scene == scene) + m_scene = null; + } + public void PostInitialise() { m_cache = m_scene.RequestModuleInterface(); @@ -92,6 +105,15 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { } + public void RegionLoaded(Scene scene) + { + } + + public Type ReplaceableInterface + { + get { return null; } + } + #endregion IRegionModule #region IJ2KDecoder @@ -279,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { string assetID = "j2kCache_" + AssetId.ToString(); - AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_scene.RegionInfo.RegionID.ToString()); + AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_CreatorID.ToString()); layerDecodeAsset.Local = true; layerDecodeAsset.Temporary = true; diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 5a413a90cf..820f11baf9 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -43,6 +43,7 @@ +