@needle-tools/gltf-build-pipeline 2.15.10 → 2.15.12

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
+ ## [2.15.12] - 2026-04-04
8
+ - add: Support for material-only GLB processing
9
+ - fix: PMREM processing for EXRs using DWAB compression (e.g. Blender forest.exr)
10
+
7
11
  ## [2.15.0] - 2026-03-20
8
12
  - add: EXR environment map compression (PMREM / FASTHDR) for Needle Engine, supporting both Unity and Blender exports
9
13
  - fix: cache hashing stability (circular reference handling)
package/dist/cli/index.js CHANGED
@@ -52,6 +52,7 @@ Caches are limited to ${cacheSizeLimit} MB disc space by default.
52
52
  }
53
53
  logger.info("Writing stats to: " + output);
54
54
  writeFileStatsToFile(filestats, output);
55
+ process.exit(0);
55
56
  })
56
57
  .command("transform", "Transform (progressive loading) and compress glTF, GLB or VRM files")
57
58
  .help(`
@@ -7,7 +7,7 @@ import { MeshoptDecoder, MeshoptEncoder } from 'meshoptimizer';
7
7
  import { dedup, metalRough, prune, resample } from '@gltf-transform/functions';
8
8
  import { ALL_EXTENSIONS as NEEDLE_EXTENSIONS, NEEDLE_compression_texture, NEEDLE_mesh_compression, NEEDLE_pmrem, NEEDLE_lightmaps_ext, setExtensionInputFile } 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 { copyExternalResources, getOutputPath, getVersion, ioTryReadWithMissingResources, writeNodeIO } from "../utils/index.js";
10
+ import { copyExternalResources, getOutputPath, getVersion, isMaterialOnlyGLB, ioTryReadWithMissingResources, writeNodeIO } from "../utils/index.js";
11
11
  import { addToCache, getHash, tryGetFromCache, } from "../cache/index.js";
12
12
  import { TestAssertionError } from '../utils/test-assert.js';
13
13
  /** Compress a glTF file
@@ -105,8 +105,11 @@ export async function packGLTF(inputFile, outputFile, options) {
105
105
  dedup({ propertyTypes: [PropertyType.MESH, PropertyType.MATERIAL] }),
106
106
  ];
107
107
  const isProgressiveAsset = isLOD(inputFile);
108
- // TODO: progressive mesh LODs should not be pruned right now because it will remove e.g. UVs from meshes (and probably blend shapes too) (so we just not do it for any progressive asset)
109
- if (!isProgressiveAsset) {
108
+ const materialOnly = isMaterialOnlyGLB(document);
109
+ // TODO: progressive mesh LODs should not be pruned right now because it will remove e.g. UVs from meshes (and probably blend shapes too) (so we just not do it for any progressive asset)
110
+ // Material-only GLBs should not be pruned at all — they have no meshes so
111
+ // prune would strip materials, textures, and buffers, producing an empty file.
112
+ if (!isProgressiveAsset && !materialOnly) {
110
113
  transforms.push(prune({
111
114
  // Pruning animations is not supported yet (e.g. if the animation is only referenced by a component)
112
115
  propertyTypes: [
@@ -413,11 +413,11 @@ async function createTextureLod(args, opts) {
413
413
  // Pass compression settings to the new texture
414
414
  const compressionSettingsExt = texture.getExtension(NEEDLE_compression_texture.EXTENSION_NAME);
415
415
  if (compressionSettingsExt !== undefined && compressionSettingsExt !== null && compressionSettingsExt.getExtensionDefinition) {
416
- logger.info("> Pass compression extension to new texture");
416
+ logger.debug("> Pass compression extension to new texture");
417
417
  const newExt = newDoc.createExtension(NEEDLE_compression_texture);
418
418
  const compressionSettings = compressionSettingsExt.getExtensionDefinition();
419
- if (compressionSettings?.mode === "none") {
420
- // if the mode is set to None then we keep that setting for the new texture
419
+ if (compressionSettings?.mode === "none" || compressionSettings?.mode === "webp" || compressionSettings?.mode === "UASTC" || compressionSettings?.mode === "ETC1S") {
420
+ // explicit compression mode set by the user — keep it for LOD textures
421
421
  }
422
422
  else {
423
423
  switch (opts.config.usecase) {
@@ -1,4 +1,7 @@
1
- import { ILogger } from "@gltf-transform/core";
1
+ import { Document, ILogger } from "@gltf-transform/core";
2
+ /** Returns true when the document contains materials/textures but no meshes, nodes, or scenes.
3
+ * These are standalone material assets that should not be pruned. */
4
+ export declare function isMaterialOnlyGLB(document: Document): boolean;
2
5
  export declare function validateImageMimeType(mimetype: string, image: Uint8Array, logger: ILogger): {
3
6
  error: boolean;
4
7
  message: string;
@@ -1,4 +1,11 @@
1
1
  import { ImageUtils } from "@gltf-transform/core";
2
+ /** Returns true when the document contains materials/textures but no meshes, nodes, or scenes.
3
+ * These are standalone material assets that should not be pruned. */
4
+ export function isMaterialOnlyGLB(document) {
5
+ const root = document.getRoot();
6
+ return root.listMeshes().length === 0
7
+ && root.listMaterials().length > 0;
8
+ }
2
9
  export function validateImageMimeType(mimetype, image, logger) {
3
10
  const actualMimeType = ImageUtils.getMimeType(image);
4
11
  if (actualMimeType != null && actualMimeType != mimetype) {
@@ -1 +1 @@
1
- export declare const version = "2.15.10";
1
+ export declare const version = "2.15.12";
@@ -1 +1 @@
1
- export const version = "2.15.10";
1
+ export const version = "2.15.12";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "2.15.10",
3
+ "version": "2.15.12",
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",
Binary file