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
|
|
|
|
|
|
|
|
/**
|
2025-11-26 00:56:54 +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() {
|
2025-11-26 00:56:54 +00:00
|
|
|
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();
|