If the compile-time DynamicTextureModule.ReuseTextures flag is set, check metadata still exists for any reused asset in case some other process has removed it from the cache.
parent
c76c63725b
commit
d89b974680
|
@ -186,8 +186,20 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
|||
public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
|
||||
string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face)
|
||||
{
|
||||
if (RenderPlugins.ContainsKey(contentType))
|
||||
{
|
||||
if (!RenderPlugins.ContainsKey(contentType))
|
||||
return UUID.Zero;
|
||||
|
||||
Scene scene;
|
||||
RegisteredScenes.TryGetValue(simID, out scene);
|
||||
|
||||
if (scene == null)
|
||||
return UUID.Zero;
|
||||
|
||||
SceneObjectPart part = scene.GetSceneObjectPart(primID);
|
||||
|
||||
if (part == null)
|
||||
return UUID.Zero;
|
||||
|
||||
// If we want to reuse dynamic textures then we have to ignore any request from the caller to expire
|
||||
// them.
|
||||
if (ReuseTextures)
|
||||
|
@ -207,14 +219,27 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
|||
updater.Url = "Local image";
|
||||
updater.Disp = disp;
|
||||
|
||||
object reusableTextureUUID = null;
|
||||
object objReusableTextureUUID = null;
|
||||
|
||||
if (ReuseTextures)
|
||||
reusableTextureUUID
|
||||
= m_reuseableDynamicTextures.Get(GenerateReusableTextureKey(data, extraParams));
|
||||
if (ReuseTextures && !updater.BlendWithOldTexture)
|
||||
{
|
||||
string reuseableTextureKey = GenerateReusableTextureKey(data, extraParams);
|
||||
objReusableTextureUUID = m_reuseableDynamicTextures.Get(reuseableTextureKey);
|
||||
|
||||
if (objReusableTextureUUID != null)
|
||||
{
|
||||
// If something else has removed this temporary asset from the cache, detect and invalidate
|
||||
// our cached uuid.
|
||||
if (scene.AssetService.GetMetadata(objReusableTextureUUID.ToString()) == null)
|
||||
{
|
||||
m_reuseableDynamicTextures.Invalidate(reuseableTextureKey);
|
||||
objReusableTextureUUID = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We cannot reuse a dynamic texture if the data is going to be blended with something already there.
|
||||
if (reusableTextureUUID == null || updater.BlendWithOldTexture)
|
||||
if (objReusableTextureUUID == null)
|
||||
{
|
||||
lock (Updaters)
|
||||
{
|
||||
|
@ -230,21 +255,12 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
|||
{
|
||||
// No need to add to updaters as the texture is always the same. Not that this functionality
|
||||
// apppears to be implemented anyway.
|
||||
if (RegisteredScenes.ContainsKey(updater.SimUUID))
|
||||
{
|
||||
SceneObjectPart part = RegisteredScenes[updater.SimUUID].GetSceneObjectPart(updater.PrimID);
|
||||
|
||||
if (part != null)
|
||||
updater.UpdatePart(part, (UUID)reusableTextureUUID);
|
||||
}
|
||||
updater.UpdatePart(part, (UUID)objReusableTextureUUID);
|
||||
}
|
||||
|
||||
return updater.UpdaterID;
|
||||
}
|
||||
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
private string GenerateReusableTextureKey(string data, string extraParams)
|
||||
{
|
||||
return string.Format("{0}{1}", data, extraParams);
|
||||
|
|
Loading…
Reference in New Issue