use foreach to get textures

master
Christopher 2020-06-28 15:23:10 +02:00
parent 3cae461bbf
commit 4f96158ac3
1 changed files with 7 additions and 10 deletions

View File

@ -10,6 +10,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using static OpenMetaverse.Primitive;
[assembly: Addin("TextureFetcher", "0.1")] [assembly: Addin("TextureFetcher", "0.1")]
[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] [assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
@ -128,22 +129,18 @@ namespace OpenSim.Modules.TextureFetcher
Primitive.TextureEntry textures = part.Shape.Textures; Primitive.TextureEntry textures = part.Shape.Textures;
int allSides = part.GetNumberOfSides(); int allSides = part.GetNumberOfSides();
for (uint i = 0; i <= allSides; i++) foreach(TextureEntryFace face in textures.FaceTextures)
{ {
m_log.Info("[" + Name + "] Get face " + i); if(face != null)
if (textures.FaceTextures[i] != null)
{ {
if (textures.FaceTextures[i].TextureID != null) if (face.TextureID != null)
allTextures.Add(textures.FaceTextures[i].TextureID); allTextures.Add(face.TextureID);
if (textures.FaceTextures[i].MaterialID != null) if (face.MaterialID != null)
allTextures.Add(textures.FaceTextures[i].MaterialID); allTextures.Add(face.MaterialID);
} }
} }
if (part.Shape.SculptTexture != UUID.Zero)
allTextures.Add(part.Shape.SculptTexture);
//Convert texture uuid list to inventar items. //Convert texture uuid list to inventar items.
foreach (UUID texture in allTextures) foreach (UUID texture in allTextures)
{ {