t2-mapper/scripts/convert-dts.ts

36 lines
806 B
TypeScript
Raw Normal View History

2025-11-13 03:22:29 +00:00
import fs from "node:fs/promises";
import { execFileSync } from "node:child_process";
2025-11-13 04:28:31 +00:00
const BLENDER_PATH =
process.env.BLENDER_PATH ||
`/Applications/Blender.app/Contents/MacOS/Blender`;
2025-11-13 03:22:29 +00:00
/**
* Find all .dts files in `docs/base` and convert them to glTF.
2025-11-13 03:22:29 +00:00
*/
async function run() {
for await (const inFile of fs.glob("docs/base/**/*.dts")) {
2025-11-13 03:22:29 +00:00
const outFile = inFile.replace(/\.dts$/i, ".gltf");
execFileSync(
2025-11-13 04:28:31 +00:00
BLENDER_PATH,
2025-11-13 03:22:29 +00:00
[
"--background",
"--python",
"scripts/blender/dts2gltf.py",
"--", // args after here go to the script
inFile,
outFile,
"--format",
"gltf",
// "--scale",
// "1.0",
// "--no-anims",
// "--only-visible",
],
2025-11-29 17:08:20 +00:00
{ stdio: "inherit" },
2025-11-13 03:22:29 +00:00
);
}
}
run();