mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-01-19 12:14:47 +00:00
36 lines
806 B
TypeScript
36 lines
806 B
TypeScript
import fs from "node:fs/promises";
|
|
import { execFileSync } from "node:child_process";
|
|
|
|
const BLENDER_PATH =
|
|
process.env.BLENDER_PATH ||
|
|
`/Applications/Blender.app/Contents/MacOS/Blender`;
|
|
|
|
/**
|
|
* Find all .dts files in `docs/base` and convert them to glTF.
|
|
*/
|
|
async function run() {
|
|
for await (const inFile of fs.glob("docs/base/**/*.dts")) {
|
|
const outFile = inFile.replace(/\.dts$/i, ".gltf");
|
|
execFileSync(
|
|
BLENDER_PATH,
|
|
[
|
|
"--background",
|
|
"--python",
|
|
"scripts/blender/dts2gltf.py",
|
|
"--", // args after here go to the script
|
|
inFile,
|
|
outFile,
|
|
"--format",
|
|
"gltf",
|
|
// "--scale",
|
|
// "1.0",
|
|
// "--no-anims",
|
|
// "--only-visible",
|
|
],
|
|
{ stdio: "inherit" },
|
|
);
|
|
}
|
|
}
|
|
|
|
run();
|