Files
healer-man/scripts/runewaker-pipeline/lib/rom-derived-support-styling-file.mjs
2026-10-06 22:25:34 -04:00

15 lines
757 B
JavaScript

import { readFile } from "node:fs/promises";
import { NodeIO } from "@gltf-transform/core";
import { ALL_EXTENSIONS } from "@gltf-transform/extensions";
import { applyRunewakerDerivedSupportStyling } from "./rom-derived-support-styling.mjs";
export async function applyRunewakerDerivedSupportStylingToFile(file, options) {
if (!options.policyId) return { status: "not-requested", geometryChanged: false };
const sourceDdsBytes = await readFile(options.sourceDdsFile);
const io = new NodeIO().registerExtensions(ALL_EXTENSIONS);
const document = await io.read(file);
const report = applyRunewakerDerivedSupportStyling(document, { ...options, sourceDdsBytes });
if (report.status === "applied") await io.write(file, document);
return report;
}