@needle-tools/gltf-build-pipeline 2.2.1-alpha.8 → 2.3.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,6 +4,12 @@ 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.3.0-alpha.1] - 2023-06-23
8
+ - change: bump gltf-transform to 4.0.2 to fix meshopt skinning regression [1439](https://github.com/donmccurdy/glTF-Transform/pull/1439)
9
+
10
+ ## [2.3.0-alpha] - 2023-06-22
11
+ - add: flatten and join for `product` usecase
12
+
7
13
  ## [2.2.1-alpha.8] - 2023-06-22
8
14
  - add: CLI <output> support
9
15
  - fix: register webp extension for valid glTF files. [issue 5122](https://linear.app/needle/issue/NE-5122)
@@ -4,7 +4,7 @@ import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
4
4
  import draco3d from 'draco3dgltf';
5
5
  import { existsSync, readFileSync, statSync, writeFileSync } from 'fs';
6
6
  import { MeshoptDecoder, MeshoptEncoder } from 'meshoptimizer';
7
- import { dedup, prune, resample } from '@gltf-transform/functions';
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
10
  import { getOutputPath, writeNodeIO } from "../utils/index.js";
@@ -91,6 +91,10 @@ export async function packGLTF(inputFile, outputFile, options) {
91
91
  }));
92
92
  }
93
93
  await document.transform(...transforms);
94
+ const isVRM = inputFile.toLowerCase().endsWith(".vrm");
95
+ if (!isVRM && config?.usecase === "product") {
96
+ await document.transform(flatten(), join({ keepNamed: false }));
97
+ }
94
98
  if (!outputFile)
95
99
  outputFile = inputFile;
96
100
  else {
@@ -1,5 +1,5 @@
1
1
  import { BufferUtils, Document, NodeIO, PropertyType, TextureChannel, Verbosity } from '@gltf-transform/core';
2
- import { SIMPLIFY_DEFAULTS, WELD_DEFAULTS, listTextureChannels, listTextureSlots, sparse } from '@gltf-transform/functions';
2
+ import { SIMPLIFY_DEFAULTS, WELD_DEFAULTS, flatten, join, listTextureChannels, listTextureSlots, sparse } from '@gltf-transform/functions';
3
3
  import draco3d from 'draco3dgltf';
4
4
  import { NEEDLE_PROGRESSIVE_EXTENSION_NAME, NEEDLE_progressive } from "../extensions/NEEDLE_progressive/index.js";
5
5
  import { createOpaqueExtension, currentGenerator, NEEDLE_compression_texture, NEEDLE_mesh_compression, NEEDLE_progressive_mesh_settings, NEEDLE_progressive_texture_settings, registerExtensions as registerDefaultExtensions } from '../extensions/index.js';
@@ -77,7 +77,7 @@ async function onProcess(file, opts) {
77
77
  transforms.push(make_progressive_textures(file, { size: [smallesTextureSize, smallesTextureSize] }, opts));
78
78
  }
79
79
  // TODO: progressive meshes aren't supported yet for VRMs
80
- const isVRM = file.endsWith(".vrm");
80
+ const isVRM = file.toLowerCase().endsWith(".vrm");
81
81
  if (!isVRM && opts.config?.meshes?.lods !== false) {
82
82
  transforms.push(make_progressive_meshes(file, {}, opts));
83
83
  }
@@ -85,6 +85,9 @@ async function onProcess(file, opts) {
85
85
  logger.warn("WARN: Progressive meshes are not supported for VRM files yet");
86
86
  transforms.push(sparse());
87
87
  logger.info("→ Transforming: " + file);
88
+ if (!isVRM && opts.config?.usecase === "product") {
89
+ await document.transform(flatten(), join({ keepNamed: false }));
90
+ }
88
91
  await document.transform(...transforms);
89
92
  const filename = getOutputPath(file, opts.outpath);
90
93
  ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "2.2.1-alpha.8",
3
+ "version": "2.3.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",
@@ -47,9 +47,9 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@donmccurdy/caporal": "~0.0.10",
50
- "@gltf-transform/core": "^4.0.1",
51
- "@gltf-transform/extensions": "^4.0.1",
52
- "@gltf-transform/functions": "^4.0.1",
50
+ "@gltf-transform/core": "^4.0.2",
51
+ "@gltf-transform/extensions": "^4.0.2",
52
+ "@gltf-transform/functions": "^4.0.2",
53
53
  "command-exists": "^1.2.9",
54
54
  "command-line-args": "^5.2.1",
55
55
  "draco3dgltf": "^1.5.3",