Fix issues with the DynamicTextureModule and corresponding unit tests.
parent
113a9704f2
commit
db418bff2b
|
@ -83,6 +83,16 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
|||
/// </remarks>
|
||||
private Cache m_reuseableDynamicTextures;
|
||||
|
||||
/// <summary>
|
||||
/// This constructor is only here because of the Unit Tests...
|
||||
/// Don't use it.
|
||||
/// </summary>
|
||||
public DynamicTextureModule()
|
||||
{
|
||||
m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative);
|
||||
m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0);
|
||||
}
|
||||
|
||||
#region IDynamicTextureManager Members
|
||||
|
||||
public void RegisterRender(string handleType, IDynamicTextureRender render)
|
||||
|
|
|
@ -49,21 +49,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
|||
private string m_name = "LoadImageURL";
|
||||
private Scene m_scene;
|
||||
private IDynamicTextureManager m_textureManager;
|
||||
private IDynamicTextureManager TextureManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_textureManager == null && m_scene != null)
|
||||
{
|
||||
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
||||
if (m_textureManager != null)
|
||||
{
|
||||
m_textureManager.RegisterRender(GetContentType(), this);
|
||||
}
|
||||
}
|
||||
return m_textureManager;
|
||||
}
|
||||
}
|
||||
|
||||
private string m_proxyurl = "";
|
||||
private string m_proxyexcepts = "";
|
||||
|
@ -146,6 +131,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
|||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (m_textureManager == null && m_scene == scene)
|
||||
{
|
||||
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
||||
if (m_textureManager != null)
|
||||
{
|
||||
m_textureManager.RegisterRender(GetContentType(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
@ -191,6 +184,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
|||
|
||||
private void HttpRequestReturn(IAsyncResult result)
|
||||
{
|
||||
if (m_textureManager == null)
|
||||
{
|
||||
m_log.WarnFormat("[LOADIMAGEURLMODULE]: No texture manager. Can't function.");
|
||||
return;
|
||||
}
|
||||
|
||||
RequestState state = (RequestState) result.AsyncState;
|
||||
WebRequest request = (WebRequest) state.Request;
|
||||
Stream stream = null;
|
||||
|
@ -271,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
|||
m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}",
|
||||
imageJ2000.Length, state.RequestID);
|
||||
|
||||
TextureManager.ReturnData(
|
||||
m_textureManager.ReturnData(
|
||||
state.RequestID,
|
||||
new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture(
|
||||
request.RequestUri, null, imageJ2000, newSize, false));
|
||||
|
|
|
@ -58,21 +58,6 @@ 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<IDynamicTextureManager>();
|
||||
if (m_textureManager != null)
|
||||
{
|
||||
m_textureManager.RegisterRender(GetContentType(), this);
|
||||
}
|
||||
}
|
||||
return m_textureManager;
|
||||
}
|
||||
}
|
||||
|
||||
private Graphics m_graph;
|
||||
private string m_fontName = "Arial";
|
||||
|
@ -121,8 +106,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
|||
|
||||
public bool AsyncConvertData(UUID id, string bodyData, string extraParams)
|
||||
{
|
||||
if (m_textureManager == null)
|
||||
{
|
||||
m_log.Warn("[VECTORRENDERMODULE]: No texture manager. Can't function");
|
||||
return false;
|
||||
}
|
||||
// XXX: This isn't actually being done asynchronously!
|
||||
TextureManager.ReturnData(id, ConvertData(bodyData, extraParams));
|
||||
m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -180,6 +170,14 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
|||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (m_textureManager == null && m_scene == scene)
|
||||
{
|
||||
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
||||
if (m_textureManager != null)
|
||||
{
|
||||
m_textureManager.RegisterRender(GetContentType(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
|
|
|
@ -383,6 +383,11 @@ namespace OpenSim.Tests.Common
|
|||
}
|
||||
}
|
||||
|
||||
foreach (IRegionModuleBase module in newModules)
|
||||
{
|
||||
if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise();
|
||||
}
|
||||
|
||||
foreach (IRegionModuleBase module in newModules)
|
||||
{
|
||||
foreach (Scene scene in scenes)
|
||||
|
@ -392,11 +397,6 @@ namespace OpenSim.Tests.Common
|
|||
}
|
||||
}
|
||||
|
||||
foreach (IRegionModuleBase module in newModules)
|
||||
{
|
||||
if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise();
|
||||
}
|
||||
|
||||
// RegionLoaded is fired after all modules have been appropriately added to all scenes
|
||||
foreach (IRegionModuleBase module in newModules)
|
||||
foreach (Scene scene in scenes)
|
||||
|
|
Loading…
Reference in New Issue