add cache for not existing textures

master
Christopher 2020-06-28 16:04:17 +02:00
parent 6ac1e6eaf9
commit 789d658f4a
1 changed files with 9 additions and 2 deletions

View File

@ -22,6 +22,8 @@ namespace OpenSim.Modules.TextureFetcher
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
Scene m_scene = null; Scene m_scene = null;
List<UUID> m_textureBlackList = new List<UUID>();
public string Name public string Name
{ {
get { return "TextureFetcher"; } get { return "TextureFetcher"; }
@ -74,7 +76,7 @@ namespace OpenSim.Modules.TextureFetcher
private void AddObject(SceneObjectGroup obj) private void AddObject(SceneObjectGroup obj)
{ {
foreach(SceneObjectPart _part in obj.Parts) foreach (SceneObjectPart _part in obj.Parts)
copyTexturesToInventory(_part); copyTexturesToInventory(_part);
} }
@ -132,7 +134,9 @@ namespace OpenSim.Modules.TextureFetcher
for(uint i = 0; i < allSides; i++) for(uint i = 0; i < allSides; i++)
{ {
TextureEntryFace face = textures.GetFace(i); TextureEntryFace face = textures.GetFace(i);
allTextures.Add(face.TextureID);
if(!m_textureBlackList.Contains(face.TextureID))
allTextures.Add(face.TextureID);
} }
//Remove not existing textures //Remove not existing textures
@ -143,7 +147,10 @@ namespace OpenSim.Modules.TextureFetcher
bool[] existing = m_scene.AssetService.AssetsExist(_assetIDs); bool[] existing = m_scene.AssetService.AssetsExist(_assetIDs);
for (int i = 0; i < existing.Length; i++) for (int i = 0; i < existing.Length; i++)
if (existing[i] == false) if (existing[i] == false)
{
m_textureBlackList.Add(allTextures[i]);
allTextures[i] = UUID.Zero; allTextures[i] = UUID.Zero;
}
//Convert texture uuid list to inventar items. //Convert texture uuid list to inventar items.
foreach (UUID texture in allTextures) foreach (UUID texture in allTextures)