From 4de8915dddf7fdf6456b471c303b4d214ad1bb8e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 11 Nov 2012 15:04:02 -0800 Subject: One more module converted: VectorRenderModule. --- .../Scripting/VectorRender/VectorRenderModule.cs | 68 +++++++++++++--------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index b4e3d77..efa99e9 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -40,12 +40,14 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using log4net; using System.Reflection; +using Mono.Addins; //using Cairo; namespace OpenSim.Region.CoreModules.Scripting.VectorRender { - public class VectorRenderModule : IRegionModule, IDynamicTextureRender + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "VectorRenderModule")] + public class VectorRenderModule : ISharedRegionModule, IDynamicTextureRender { // These fields exist for testing purposes, please do not remove. // private static bool s_flipper; @@ -56,6 +58,22 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender private Scene m_scene; private IDynamicTextureManager m_textureManager; + private IDynamicTextureManager TextureManager + { + get + { + if (m_textureManager == null && m_scene != null) + { + m_textureManager = m_scene.RequestModuleInterface(); + if (m_textureManager != null) + { + m_textureManager.RegisterRender(GetContentType(), this); + } + } + return m_textureManager; + } + } + private Graphics m_graph; private string m_fontName = "Arial"; @@ -104,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender public bool AsyncConvertData(UUID id, string bodyData, string extraParams) { // XXX: This isn't actually being done asynchronously! - m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); + TextureManager.ReturnData(id, ConvertData(bodyData, extraParams)); return true; } @@ -131,45 +149,41 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender #endregion - #region IRegionModule Members + #region ISharedRegionModule Members - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - if (m_scene == null) - { - m_scene = scene; - } - - if (m_graph == null) - { - // We won't dispose of these explicitly since this module is only removed when the entire simulator - // is shut down. - Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); - m_graph = Graphics.FromImage(bitmap); - } - IConfig cfg = config.Configs["VectorRender"]; if (null != cfg) { m_fontName = cfg.GetString("font_name", m_fontName); } m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName); + + // We won't dispose of these explicitly since this module is only removed when the entire simulator + // is shut down. + Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); + m_graph = Graphics.FromImage(bitmap); } public void PostInitialise() { - m_textureManager = m_scene.RequestModuleInterface(); - if (m_textureManager != null) + } + + public void AddRegion(Scene scene) + { + if (m_scene == null) { - m_textureManager.RegisterRender(GetContentType(), this); + m_scene = scene; } + } - // This code exists for testing purposes, please do not remove. -// s_asset1Data = m_scene.AssetService.Get("00000000-0000-1111-9999-000000000001").Data; -// s_asset1Data = m_scene.AssetService.Get("9f4acf0d-1841-4e15-bdb8-3a12efc9dd8f").Data; + public void RegionLoaded(Scene scene) + { + } - // Terrain dirt - smallest bin/assets file (6004 bytes) -// s_asset2Data = m_scene.AssetService.Get("b8d3965a-ad78-bf43-699b-bff8eca6c975").Data; + public void RemoveRegion(Scene scene) + { } public void Close() @@ -181,9 +195,9 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender get { return "VectorRenderModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } + get { return null; } } #endregion -- cgit v1.1