diff options
author | Melanie | 2012-11-12 15:46:45 +0000 |
---|---|---|
committer | Melanie | 2012-11-12 15:46:45 +0000 |
commit | d9b149b3756442224492ca24c2be3196a873489a (patch) | |
tree | ec1e0649b7aef62ecb9475f78b467062f353866c /OpenSim/Region/CoreModules/Scripting/VectorRender | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Fix mantis #6425 (diff) | |
download | opensim-SC-d9b149b3756442224492ca24c2be3196a873489a.zip opensim-SC-d9b149b3756442224492ca24c2be3196a873489a.tar.gz opensim-SC-d9b149b3756442224492ca24c2be3196a873489a.tar.bz2 opensim-SC-d9b149b3756442224492ca24c2be3196a873489a.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/VectorRender')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | 64 |
1 files changed, 38 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 673c2d1..f395441 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; | |||
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using log4net; | 41 | using log4net; |
42 | using System.Reflection; | 42 | using System.Reflection; |
43 | using Mono.Addins; | ||
43 | 44 | ||
44 | //using Cairo; | 45 | //using Cairo; |
45 | 46 | ||
46 | namespace OpenSim.Region.CoreModules.Scripting.VectorRender | 47 | namespace OpenSim.Region.CoreModules.Scripting.VectorRender |
47 | { | 48 | { |
48 | public class VectorRenderModule : IRegionModule, IDynamicTextureRender | 49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "VectorRenderModule")] |
50 | public class VectorRenderModule : ISharedRegionModule, IDynamicTextureRender | ||
49 | { | 51 | { |
50 | // These fields exist for testing purposes, please do not remove. | 52 | // These fields exist for testing purposes, please do not remove. |
51 | // private static bool s_flipper; | 53 | // private static bool s_flipper; |
@@ -56,6 +58,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
56 | 58 | ||
57 | private Scene m_scene; | 59 | private Scene m_scene; |
58 | private IDynamicTextureManager m_textureManager; | 60 | private IDynamicTextureManager m_textureManager; |
61 | |||
59 | private Graphics m_graph; | 62 | private Graphics m_graph; |
60 | private string m_fontName = "Arial"; | 63 | private string m_fontName = "Arial"; |
61 | 64 | ||
@@ -103,6 +106,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
103 | 106 | ||
104 | public bool AsyncConvertData(UUID id, string bodyData, string extraParams) | 107 | public bool AsyncConvertData(UUID id, string bodyData, string extraParams) |
105 | { | 108 | { |
109 | if (m_textureManager == null) | ||
110 | { | ||
111 | m_log.Warn("[VECTORRENDERMODULE]: No texture manager. Can't function"); | ||
112 | return false; | ||
113 | } | ||
106 | // XXX: This isn't actually being done asynchronously! | 114 | // XXX: This isn't actually being done asynchronously! |
107 | m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); | 115 | m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); |
108 | 116 | ||
@@ -131,45 +139,49 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
131 | 139 | ||
132 | #endregion | 140 | #endregion |
133 | 141 | ||
134 | #region IRegionModule Members | 142 | #region ISharedRegionModule Members |
135 | 143 | ||
136 | public void Initialise(Scene scene, IConfigSource config) | 144 | public void Initialise(IConfigSource config) |
137 | { | 145 | { |
138 | if (m_scene == null) | ||
139 | { | ||
140 | m_scene = scene; | ||
141 | } | ||
142 | |||
143 | if (m_graph == null) | ||
144 | { | ||
145 | // We won't dispose of these explicitly since this module is only removed when the entire simulator | ||
146 | // is shut down. | ||
147 | Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); | ||
148 | m_graph = Graphics.FromImage(bitmap); | ||
149 | } | ||
150 | |||
151 | IConfig cfg = config.Configs["VectorRender"]; | 146 | IConfig cfg = config.Configs["VectorRender"]; |
152 | if (null != cfg) | 147 | if (null != cfg) |
153 | { | 148 | { |
154 | m_fontName = cfg.GetString("font_name", m_fontName); | 149 | m_fontName = cfg.GetString("font_name", m_fontName); |
155 | } | 150 | } |
156 | m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName); | 151 | m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName); |
152 | |||
153 | // We won't dispose of these explicitly since this module is only removed when the entire simulator | ||
154 | // is shut down. | ||
155 | Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); | ||
156 | m_graph = Graphics.FromImage(bitmap); | ||
157 | } | 157 | } |
158 | 158 | ||
159 | public void PostInitialise() | 159 | public void PostInitialise() |
160 | { | 160 | { |
161 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | 161 | } |
162 | if (m_textureManager != null) | 162 | |
163 | public void AddRegion(Scene scene) | ||
164 | { | ||
165 | if (m_scene == null) | ||
163 | { | 166 | { |
164 | m_textureManager.RegisterRender(GetContentType(), this); | 167 | m_scene = scene; |
165 | } | 168 | } |
169 | } | ||
166 | 170 | ||
167 | // This code exists for testing purposes, please do not remove. | 171 | public void RegionLoaded(Scene scene) |
168 | // s_asset1Data = m_scene.AssetService.Get("00000000-0000-1111-9999-000000000001").Data; | 172 | { |
169 | // s_asset1Data = m_scene.AssetService.Get("9f4acf0d-1841-4e15-bdb8-3a12efc9dd8f").Data; | 173 | if (m_textureManager == null && m_scene == scene) |
174 | { | ||
175 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | ||
176 | if (m_textureManager != null) | ||
177 | { | ||
178 | m_textureManager.RegisterRender(GetContentType(), this); | ||
179 | } | ||
180 | } | ||
181 | } | ||
170 | 182 | ||
171 | // Terrain dirt - smallest bin/assets file (6004 bytes) | 183 | public void RemoveRegion(Scene scene) |
172 | // s_asset2Data = m_scene.AssetService.Get("b8d3965a-ad78-bf43-699b-bff8eca6c975").Data; | 184 | { |
173 | } | 185 | } |
174 | 186 | ||
175 | public void Close() | 187 | public void Close() |
@@ -181,9 +193,9 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
181 | get { return "VectorRenderModule"; } | 193 | get { return "VectorRenderModule"; } |
182 | } | 194 | } |
183 | 195 | ||
184 | public bool IsSharedModule | 196 | public Type ReplaceableInterface |
185 | { | 197 | { |
186 | get { return true; } | 198 | get { return null; } |
187 | } | 199 | } |
188 | 200 | ||
189 | #endregion | 201 | #endregion |