from rpak import Rpak from progressDisplay import percent_complete import os from itertools import chain path = "." rpaks: list[Rpak] = [] for file in os.listdir(path): if file.endswith(".rpak"): rpaks.append(Rpak(file)) textures = map(lambda x : x.Assets['textures'], rpaks) textures = list(chain.from_iterable(textures)) textureGuids = map(lambda x : x.assetEntry.nameHash, textures) textureDict = dict(zip(textureGuids, textures)) materials = map(lambda x : x.Assets['materials'], rpaks) materials = list(chain.from_iterable(materials)) length = len(materials) for index, material in enumerate(materials): material.populateTextures(textureDict) percent_complete(index, length, title="Linking textures") test = list(filter(lambda x : x.header.name.endswith('00_gloss_flat_gls') == True, textures)) test