# LightWave object fixtures (tools/fixtures.py): assimp's LWO test models (LWO2, LWOB, Modo LXOB; models and # models-nonbsd, read from the nixpkgs assimp source, never committed) with assimp's view of them (`assimp info -r`: # meshes, polygons, corners, materials, nodes; world bounds from assimp's PreTransformVertices export). # tests/gen/lwo_cases.luau { name, data, assimp = { meshes, faces, vertices, materials, nodes, min, max } } import importlib.util, os def module(ctx, name): spec = importlib.util.spec_from_file_location(name, os.path.join(ctx.root, "tools", "fixtures", name + ".py")) m = importlib.util.module_from_spec(spec) spec.loader.exec_module(m) return m INPUTS = ["src/Rosetta/model/lwo", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py"] def generate(ctx): M = module(ctx, "_model_ref") fbx = module(ctx, "fbx") # assimp_src, ptv_bounds tmp = M.tempdir() src = fbx.assimp_src(ctx) cases = [] for sub in ("models/LWO", "models-nonbsd/LWO"): d0 = os.path.join(src, "test", sub) for root, _, files in sorted(os.walk(d0)): for f in sorted(files): if f.lower().endswith((".lwo", ".lxo")): p = os.path.join(root, f) cases.append({"name": sub.split("/")[0] + "/" + os.path.relpath(p, d0), "path": p}) infos = M.assimp_info(ctx, [c["path"] for c in cases], raw=True) for c, a in zip(cases, infos): a.pop("min", None) a.pop("max", None) a.pop("perMesh", None) if not a.get("failed"): a.update(fbx.ptv_bounds(ctx, c["path"], tmp)) c["assimp"] = a c["data"] = open(c["path"], "rb").read() del c["path"] ctx.emit("lwo_cases", cases)