Fix resource lookup; re-export .dts and .dif with custom properties

This commit is contained in:
Brian Beck 2025-12-01 00:17:27 -08:00
parent 8147a1c418
commit 1182726bb4
1156 changed files with 126 additions and 114 deletions

View file

@ -92,7 +92,10 @@ for i, in_path in enumerate(input_files, start=1):
filepath=out_path,
export_format=args.format, # GLB | GLTF_SEPARATE
use_selection=False,
export_apply=True,
export_apply=False,
# Export custom properties, which is where we store the original
# resource path.
export_extras=True,
# Blender and T2 are Z-up, but these assets are destined for Three.js which
# is Y-up. It's easiest to match the Y-up of our destination engine.
export_yup=True,

View file

@ -92,11 +92,14 @@ for i, in_path in enumerate(input_files, start=1):
filepath=out_path,
export_format=args.format, # GLB | GLTF_SEPARATE
use_selection=False,
export_apply=False,
export_materials='EXPORT',
export_normals=True,
export_tangents=False,
export_texcoords=True,
export_apply=False,
# Export custom properties, which is where we store the original
# resource path.
export_extras=True,
# Blender and T2 are Z-up, but these assets are destined for Three.js which
# is Y-up. It's easiest to match the Y-up of our destination engine.
export_yup=True,

View file

@ -1,7 +1,7 @@
import fs from "node:fs";
import { inspect, parseArgs } from "node:util";
import { parseImageFileList } from "@/src/imageFileList";
import { getFilePath } from "@/src/manifest";
import { getLocalFilePath } from "@/src/manifest";
async function run() {
const { values, positionals } = parseArgs({
@ -46,7 +46,7 @@ async function run() {
let framesFile = positionals[0];
if (values.name) {
const resourcePath = `textures/skins/${values.name}.ifl`;
framesFile = getFilePath(resourcePath);
framesFile = getLocalFilePath(resourcePath);
}
const missionScript = fs.readFileSync(framesFile, "utf8");
console.log(

View file

@ -1,7 +1,7 @@
import fs from "node:fs";
import { inspect, parseArgs } from "node:util";
import { parseMissionScript } from "@/src/mission";
import { getFilePath } from "@/src/manifest";
import { getLocalFilePath, getMissionList } from "@/src/manifest";
async function run() {
const { values, positionals } = parseArgs({
@ -23,15 +23,7 @@ async function run() {
console.error("Cannot specify --list (-l) with other options.");
return 1;
}
const manifest = (await import("../public/manifest.json")).default;
const fileNames = Object.keys(manifest);
console.log(
fileNames
.map((f) => f.match(/^missions\/(.+)\.mis$/))
.filter(Boolean)
.map((match) => match[1])
.join("\n"),
);
console.log(getMissionList().join("\n"));
return;
} else if (
(values.name && positionals[0]) ||
@ -45,8 +37,8 @@ async function run() {
let missionFile = positionals[0];
if (values.name) {
const resourcePath = `missions/${values.name}.mis`;
missionFile = getFilePath(resourcePath);
const resourcePath = `missions/${values.name.toLowerCase()}.mis`;
missionFile = getLocalFilePath(resourcePath);
}
const missionScript = fs.readFileSync(missionFile, "utf8");
console.log(

View file

@ -1,7 +1,8 @@
import fs from "node:fs";
import { inspect, parseArgs } from "node:util";
import { parseTerrainBuffer } from "@/src/terrain";
import { getFilePath } from "@/src/manifest";
import { getLocalFilePath, getResourceList } from "@/src/manifest";
import path from "node:path";
async function run() {
const { values, positionals } = parseArgs({
@ -23,13 +24,11 @@ async function run() {
console.error("Cannot specify --list (-l) with other options.");
return 1;
}
const manifest = (await import("../public/manifest.json")).default;
const fileNames = Object.keys(manifest);
console.log(
fileNames
getResourceList()
.map((f) => f.match(/^terrains\/(.+)\.ter$/))
.filter(Boolean)
.map((match) => match[1])
.map((match) => path.basename(getLocalFilePath(match[0]), ".ter"))
.join("\n"),
);
return;
@ -46,7 +45,7 @@ async function run() {
let terrainFile = positionals[0];
if (values.name) {
const resourcePath = `terrains/${values.name}.ter`;
terrainFile = getFilePath(resourcePath);
terrainFile = getLocalFilePath(resourcePath);
}
const terrainBuffer = fs.readFileSync(terrainFile);
const terrainArrayBuffer = terrainBuffer.buffer.slice(