@needle-tools/gltf-build-pipeline 1.5.0-alpha.4 → 1.5.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.5.0-alpha.5] - 2023-05-04
|
|
8
|
+
- fix: NEEDLE_opaque should handle if VRM texture index is negative
|
|
9
|
+
- change: exit with code 1 if any file packing fails
|
|
10
|
+
|
|
7
11
|
## [1.5.0-alpha.4] - 2023-05-03
|
|
8
12
|
- fix: issue in NEEDLE_opaque resolving of VRM textures, also resolve `meta.texture`
|
|
9
13
|
- fix: VRMs now compress meshes with mesh-opt if nothing is specified
|
|
@@ -622,7 +622,16 @@ class JsonPointerHandler {
|
|
|
622
622
|
// key texture is matching for example for VRM meta/texture (AvatarSample_A) and the regex is also for handling VRM material properties
|
|
623
623
|
else if (key === "texture" || fullPath.match(/materialProperties\/\d+?\/textureProperties/g)) {
|
|
624
624
|
const index = value;
|
|
625
|
+
// e.g. in meta.texture for VRM avatars it seems like we can have negative values
|
|
626
|
+
if (index < 0) {
|
|
627
|
+
console.warn(`WARN: texture index is negative ${index} at ${fullPath}`);
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
625
630
|
const definition = context.jsonDoc.json.textures[index];
|
|
631
|
+
if (!definition) {
|
|
632
|
+
console.warn(`WARN: texture definition with index ${index} not found or does not exist. Set in \"${fullPath}\"`);
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
626
635
|
const imageIndex = findSource(definition);
|
|
627
636
|
if (this.debug)
|
|
628
637
|
console.log("Texture index", index, imageIndex, context.jsonDoc.json.textures.length, "Textures:" + context.textures.length);
|
package/pack-gltf.mjs
CHANGED
|
@@ -169,18 +169,20 @@ async function packFile(file) {
|
|
|
169
169
|
|
|
170
170
|
let startTime = Date.now();
|
|
171
171
|
const inputArgs = args.slice(2);
|
|
172
|
+
let failed = false;
|
|
172
173
|
foreachGLTF(inputArgs, async (file) => {
|
|
173
|
-
await packFile(file);
|
|
174
|
+
const res = await packFile(file);
|
|
175
|
+
if (!res) failed = true;
|
|
174
176
|
}).then(async () => {
|
|
175
177
|
const duration = Date.now() - startTime;
|
|
176
178
|
const durationInMinutes = duration / 1000 / 60;
|
|
177
179
|
if (allowCaching) {
|
|
178
|
-
// if the user's cache directory has more than 25GB free space, we allow a cache of 2 GB - otherwise 1 GB
|
|
179
|
-
// const freeSpaceInMB = (await getCacheAvailableSpaceOnDisc().catch(() => 0)) / 1024 / 1024;
|
|
180
|
-
// const maxCacheSize = freeSpaceInMB > 25000 ? 2000 : 1000;
|
|
181
180
|
limitCacheSize();
|
|
182
181
|
}
|
|
183
182
|
console.log(`[Needle Build Pipeline] v${getVersion()} — Finished packing ${totalFilesProcessed} files in ${durationInMinutes.toFixed(1)} minutes; total size ${totalFileSizeInMBBefore.toFixed(1)} MB → ${totalFileSizeInMB.toFixed(1)} MB, total GPU memory: ${totalGPUMemoryInMB.toFixed(1)} MB`);
|
|
183
|
+
if (failed) {
|
|
184
|
+
process.exit(1);
|
|
185
|
+
}
|
|
184
186
|
}).catch(err => {
|
|
185
187
|
console.error("ERR: packing failed: " + err.message);
|
|
186
188
|
if (debug) throw err;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/gltf-build-pipeline",
|
|
3
|
-
"version": "1.5.0-alpha.
|
|
3
|
+
"version": "1.5.0-alpha.5",
|
|
4
4
|
"description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|