Skip to content

Instantly share code, notes, and snippets.

@minexew
Created April 11, 2020 13:04
Show Gist options
  • Save minexew/480984467fa374335581b6d833fb3817 to your computer and use it in GitHub Desktop.
Save minexew/480984467fa374335581b6d833fb3817 to your computer and use it in GitHub Desktop.
import os
for f in sorted(os.listdir("AllModel")):
if f.endswith(".mtl"):
with open(f"AllModel/{f}", "rt") as file:
for line in file:
if line.startswith("\tmap_Kd "):
texture = line.rstrip()[-6:]
print(f"INSERT INTO \"model_texture\" VALUES('Stalker','{f.replace('mtl', 'mbac')}','{texture}');")
break
else:
raise Exception(f"WTF {f}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment