@needle-tools/gltf-build-pipeline 2.6.0-alpha → 2.6.0-alpha.1

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,32 +4,39 @@ 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
- ## [2.4.0] - 2023-09-11
7
+ ## [2.6.0-alpha] - 2024-12-16
8
+ - add: create placeholder textures for missing jpg, png, webp, gif, tif on disc
9
+ - fix: compressing a gltf file to a different output directory does not falsely delete old external textures on disc in the input directory
10
+
11
+ ## [2.5.0] - 2024-12-16
12
+ - release
13
+
14
+ ## [2.4.0] - 2024-09-11
8
15
  - release
9
16
 
10
- ## [2.4.0-beta.5] - 2023-09-06
17
+ ## [2.4.0-beta.5] - 2024-09-06
11
18
  - fix: issue where mesh LODs would in some cases be compressed with "draco" while the root file would be compressed with "mesh-opt" if not explicitly specified in the root file. This would cause invalid rendering and randomly scaled LOD meshes. Now mesh LODs will always use the same mesh compression. [NE 5297](https://linear.app/needle/issue/NE-5297)
12
19
  - change: update gltf-transform dependency to 4.0.8
13
20
 
14
- ## [2.4.0-beta] - 2023-08-13
21
+ ## [2.4.0-beta] - 2024-08-13
15
22
  - fix: issue where a mesh lod is removed during second processing of a directory that contains existing mesh lods
16
23
 
17
- ## [2.4.0-alpha.3] - 2023-08-11
24
+ ## [2.4.0-alpha.3] - 2024-08-11
18
25
  - fix: issue where files would not correctly be overriden in subdirectories when no output directory was specified
19
26
 
20
- ## [2.4.0-alpha.2] - 2023-06-29
27
+ ## [2.4.0-alpha.2] - 2024-06-29
21
28
  - fix: prevent joining/flattening of progressive assets
22
29
 
23
- ## [2.4.0-alpha.1] - 2023-06-26
30
+ ## [2.4.0-alpha.1] - 2024-06-26
24
31
  - add: heuristic for choosing mesh compression if not explictly configured
25
32
 
26
- ## [2.3.0-alpha.2] - 2023-06-26
33
+ ## [2.3.0-alpha.2] - 2024-06-26
27
34
  - change: usecase `product` does compress with UASTC again (for certain slots)
28
35
 
29
- ## [2.3.0-alpha.1] - 2023-06-23
36
+ ## [2.3.0-alpha.1] - 2024-06-23
30
37
  - change: bump gltf-transform to 4.0.2 to fix meshopt skinning regression [1439](https://github.com/donmccurdy/glTF-Transform/pull/1439)
31
38
 
32
- ## [2.3.0-alpha] - 2023-06-22
39
+ ## [2.3.0-alpha] - 2024-06-22
33
40
  - add: flatten and join for `product` usecase
34
41
 
35
42
  ## [2.2.1-alpha.8] - 2023-06-22
@@ -7,7 +7,7 @@ import { MeshoptDecoder, MeshoptEncoder } from 'meshoptimizer';
7
7
  import { dedup, flatten, join, prune, resample } from '@gltf-transform/functions';
8
8
  import { ALL_EXTENSIONS as NEEDLE_EXTENSIONS, NEEDLE_compression_texture, NEEDLE_mesh_compression, } from '../extensions/index.js';
9
9
  import { isLOD, isMeshLOD, needle_animation_transform, needle_asset, needle_mesh_transform, needle_texture_transform, } from '../transforms/index.js';
10
- import { getOutputPath, tryRead, writeNodeIO } from "../utils/index.js";
10
+ import { getOutputPath, ioTryReadWithMissingResources, writeNodeIO } from "../utils/index.js";
11
11
  import { addToCache, getHash, tryGetFromCache, } from "../cache/index.js";
12
12
  /** Compress a glTF file
13
13
  */
@@ -63,7 +63,7 @@ export async function packGLTF(inputFile, outputFile, options) {
63
63
  'meshopt.decoder': MeshoptDecoder,
64
64
  'meshopt.encoder': MeshoptEncoder,
65
65
  });
66
- const document = await tryRead(io, inputFile); // await io.read(inputFile);
66
+ const document = await ioTryReadWithMissingResources(io, inputFile); // await io.read(inputFile);
67
67
  /** @ts-ignore */
68
68
  document.getLogger().verbosity = options.verbose ? Verbosity.DEBUG : options.debug ? Verbosity.INFO : Verbosity.WARN;
69
69
  let totalGPUTextureMemory = 0;
@@ -7,7 +7,7 @@ import path, { basename, resolve } from 'path';
7
7
  import { existsSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'fs';
8
8
  import { addMetaToCache, addToCache, getHash, getKey, tryGetFromCache, tryGetMetaFromCache } from '../cache/index.js';
9
9
  import sharp from "sharp";
10
- import { detectTextureCompressionMode, ensureIsDirectory, foreachGLTF, generateGuid, getOutputPath, isLightmap, setLightmapName, validateImageMimeType, writeNodeIO } from '../utils/index.js';
10
+ import { detectTextureCompressionMode, ensureIsDirectory, foreachGLTF, generateGuid, getOutputPath, isLightmap, setLightmapName, ioTryReadWithMissingResources, validateImageMimeType, writeNodeIO } from '../utils/index.js';
11
11
  import { needle_asset, writeNeedleAsset } from './needle_asset.js';
12
12
  import { MeshoptDecoder, MeshoptSimplifier } from 'meshoptimizer';
13
13
  import { compressPrimitive, determineMeshCompression } from './needle_mesh_transform.js';
@@ -61,7 +61,7 @@ async function onProcess(file, opts) {
61
61
  'draco3d.decoder': await draco3d.createDecoderModule(),
62
62
  'draco3d.encoder': await draco3d.createEncoderModule(),
63
63
  });
64
- let document = await io.read(file);
64
+ let document = await ioTryReadWithMissingResources(io, file); // await io.read(file);
65
65
  if (document) {
66
66
  const logger = document.getLogger();
67
67
  //@ts-ignore
@@ -3,4 +3,4 @@ import { NodeIO, Document, PlatformIO } from "@gltf-transform/core";
3
3
  * Handle writing glTf, GLB and VRM files
4
4
  */
5
5
  export declare function writeNodeIO(nodeio: NodeIO, filename: string, document: Document): Promise<string>;
6
- export declare function tryRead(io: PlatformIO, filepath: string, iteration?: number): Promise<Document>;
6
+ export declare function ioTryReadWithMissingResources(io: PlatformIO, filepath: string, iteration?: number): Promise<Document>;
@@ -15,7 +15,7 @@ export async function writeNodeIO(nodeio, filename, document) {
15
15
  }
16
16
  const openFileRegex = /open \'(?<path>.+?)'/;
17
17
  const createdFiles = new Set();
18
- export async function tryRead(io, filepath, iteration = 0) {
18
+ export async function ioTryReadWithMissingResources(io, filepath, iteration = 0) {
19
19
  const document = await io.read(filepath)
20
20
  .catch(err => { return err; });
21
21
  if (document instanceof Error) {
@@ -66,7 +66,7 @@ export async function tryRead(io, filepath, iteration = 0) {
66
66
  }
67
67
  if (retry) {
68
68
  console.warn(`Created empty file for missing resource: ${missingPath}`);
69
- return tryRead(io, filepath, iteration + 1);
69
+ return ioTryReadWithMissingResources(io, filepath, iteration + 1);
70
70
  }
71
71
  }
72
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "2.6.0-alpha",
3
+ "version": "2.6.0-alpha.1",
4
4
  "description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",