static private void prepTextures(NIFFile file) { for (int i = 0; i < file.getObjects().Count; i++) { NIFObject obj = file.getObjects()[i]; if (obj is NiSourceTexture) { NiSourceTexture tex = (NiSourceTexture)obj; try { // preload texture bool doLoad = false; lock (NIFLoader.texDataCache) { if (!NIFLoader.texDataCache.ContainsKey(tex.texFilename)) { doLoad = true; } } if (doLoad) { byte[] data = AssetDatabaseInst.DB.extractUsingFilename(tex.texFilename, Assets.RiftAssets.AssetDatabase.RequestCategory.TEXTURE); TextureData texData; DDSLoader.DatabaseLoaderTexture_DDS.LoadDDS(data, out texData); lock (NIFLoader.texDataCache) { if (!NIFLoader.texDataCache.ContainsKey(tex.texFilename)) { NIFLoader.texDataCache.Add(tex.texFilename, texData); } } } } catch (Exception ex) { } } } }
static public List <NiSkinningMeshModifier> getSkinMods(NIFFile nf) { List <NiSkinningMeshModifier> mods = new List <NiSkinningMeshModifier>(); foreach (NIFObject o in nf.getObjects()) { if (o is NiSkinningMeshModifier) { mods.Add((NiSkinningMeshModifier)o); } } return(mods); }
static private NiMesh getMeshForMod(NIFFile nf, NiSkinningMeshModifier skinMod) { foreach (NIFObject o in nf.getObjects()) { if (o is NiMesh) { if (((NiMesh)o).modLinks.Contains(skinMod.index)) { return((NiMesh)o); } } } return(null); }