diff options
author | Diva Canto | 2012-11-11 14:46:22 -0800 |
---|---|---|
committer | Diva Canto | 2012-11-11 14:46:22 -0800 |
commit | 6759ed1013b78371b28c2d802c5d793e7b32c723 (patch) | |
tree | b039ae33b620dafa43344a892986397928dee456 /OpenSim/Region/CoreModules/Scripting/LoadImageURL | |
parent | One more module converted: ScriptsHttpRequests. (diff) | |
download | opensim-SC_OLD-6759ed1013b78371b28c2d802c5d793e7b32c723.zip opensim-SC_OLD-6759ed1013b78371b28c2d802c5d793e7b32c723.tar.gz opensim-SC_OLD-6759ed1013b78371b28c2d802c5d793e7b32c723.tar.bz2 opensim-SC_OLD-6759ed1013b78371b28c2d802c5d793e7b32c723.tar.xz |
One more module converted: LoadImageURLModule. Also removed it from its hard-coded instantiation (I think I understood what the problem was, and that I've done it right).
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/LoadImageURL')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 45e6527..a08a183 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs | |||
@@ -37,16 +37,33 @@ using OpenSim.Region.Framework.Interfaces; | |||
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using log4net; | 38 | using log4net; |
39 | using System.Reflection; | 39 | using System.Reflection; |
40 | using Mono.Addins; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | 42 | namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL |
42 | { | 43 | { |
43 | public class LoadImageURLModule : IRegionModule, IDynamicTextureRender | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LoadImageURLModule")] |
45 | public class LoadImageURLModule : ISharedRegionModule, IDynamicTextureRender | ||
44 | { | 46 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 48 | ||
47 | private string m_name = "LoadImageURL"; | 49 | private string m_name = "LoadImageURL"; |
48 | private Scene m_scene; | 50 | private Scene m_scene; |
49 | private IDynamicTextureManager m_textureManager; | 51 | private IDynamicTextureManager m_textureManager; |
52 | private IDynamicTextureManager TextureManager | ||
53 | { | ||
54 | get | ||
55 | { | ||
56 | if (m_textureManager == null && m_scene != null) | ||
57 | { | ||
58 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | ||
59 | if (m_textureManager != null) | ||
60 | { | ||
61 | m_textureManager.RegisterRender(GetContentType(), this); | ||
62 | } | ||
63 | } | ||
64 | return m_textureManager; | ||
65 | } | ||
66 | } | ||
50 | 67 | ||
51 | private string m_proxyurl = ""; | 68 | private string m_proxyurl = ""; |
52 | private string m_proxyexcepts = ""; | 69 | private string m_proxyexcepts = ""; |
@@ -104,29 +121,31 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
104 | 121 | ||
105 | #endregion | 122 | #endregion |
106 | 123 | ||
107 | #region IRegionModule Members | 124 | #region ISharedRegionModule Members |
108 | 125 | ||
109 | public void Initialise(Scene scene, IConfigSource config) | 126 | public void Initialise(IConfigSource config) |
110 | { | 127 | { |
111 | if (m_scene == null) | ||
112 | { | ||
113 | m_scene = scene; | ||
114 | } | ||
115 | |||
116 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); | 128 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); |
117 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); | 129 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); |
118 | } | 130 | } |
119 | 131 | ||
120 | public void PostInitialise() | 132 | public void PostInitialise() |
121 | { | 133 | { |
122 | if (m_scene != null) | 134 | } |
123 | { | 135 | |
124 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | 136 | public void AddRegion(Scene scene) |
125 | if (m_textureManager != null) | 137 | { |
126 | { | 138 | if (m_scene == null) |
127 | m_textureManager.RegisterRender(GetContentType(), this); | 139 | m_scene = scene; |
128 | } | 140 | |
129 | } | 141 | } |
142 | |||
143 | public void RemoveRegion(Scene scene) | ||
144 | { | ||
145 | } | ||
146 | |||
147 | public void RegionLoaded(Scene scene) | ||
148 | { | ||
130 | } | 149 | } |
131 | 150 | ||
132 | public void Close() | 151 | public void Close() |
@@ -138,9 +157,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
138 | get { return m_name; } | 157 | get { return m_name; } |
139 | } | 158 | } |
140 | 159 | ||
141 | public bool IsSharedModule | 160 | public Type ReplaceableInterface |
142 | { | 161 | { |
143 | get { return true; } | 162 | get { return null; } |
144 | } | 163 | } |
145 | 164 | ||
146 | #endregion | 165 | #endregion |
@@ -252,7 +271,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
252 | m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}", | 271 | m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}", |
253 | imageJ2000.Length, state.RequestID); | 272 | imageJ2000.Length, state.RequestID); |
254 | 273 | ||
255 | m_textureManager.ReturnData( | 274 | TextureManager.ReturnData( |
256 | state.RequestID, | 275 | state.RequestID, |
257 | new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture( | 276 | new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture( |
258 | request.RequestUri, null, imageJ2000, newSize, false)); | 277 | request.RequestUri, null, imageJ2000, newSize, false)); |