and fixes caching
This commit is contained in:
Aaron Kimbre 2022-03-31 12:56:28 -05:00
parent be80d7b2ab
commit 17c6d5bc1a

View File

@ -360,6 +360,8 @@ def prebuilt(content, file_format, lod):
)
if filename:
filename = filename[0].split("\\\\")[-1].lower().split(".")[0]
if "/" in filename:
filename = filename.split("/")[-1].lower()
else:
return f"No filename for LOT {content.lot}"
@ -372,6 +374,7 @@ def prebuilt(content, file_format, lod):
elif file_format in ["obj", "mtl"]:
cache = pathlib.Path(f'app/cache/BrickModels/{filename}.lod{lod}.{file_format}')
if not cache.is_file():
cache.parent.mkdir(parents=True, exist_ok=True)
try:
ldd.main(str(lxfml.as_posix()), str(cache.with_suffix("").as_posix()), lod) # convert to OBJ