@needle-tools/gltf-build-pipeline 1.2.0 → 1.2.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,9 @@ 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.2.1] - 2023-07-25
8
+ - change: set reference to materials used by json pointers
9
+
7
10
  ## [1.2.0] - 2023-07-21
8
11
  - add: resolving of material json pointers
9
12
 
@@ -561,12 +561,12 @@ class JsonPointerHandler {
561
561
  const index = parseInt(value.substring("/materials/".length));
562
562
  const mat = context.materials[index];
563
563
  if (mat) {
564
- // UPDATE: I think the code below is not necessary anymore when we resolve the deduplicated material index
565
- // set a reference to the material to avoid dedup
564
+ // set a reference to the material to avoid dedup or the material being removed because it MIGHT not be used by any node
565
+ // BUT a component is referencing the material so we don't want it ever to be removed
566
566
  // see https://github.com/donmccurdy/glTF-Transform/issues/980#issuecomment-1585748202
567
- // if (ext) {
568
- // ext.setReference(value, mat);
569
- // }
567
+ if (ext) {
568
+ ext.setReference(value, mat);
569
+ }
570
570
  let pointer = this.map.get(value);
571
571
  if (!pointer) {
572
572
  const definition = context.jsonDoc.json.materials[index];
@@ -2,7 +2,7 @@ import { PropertyType } from "@gltf-transform/core";
2
2
  import { createOpaqueExtension } from "./NEEDLE_opaque.js";
3
3
  export * from "./NEEDLE_opaque.js";
4
4
  const opaqueOptions = {
5
- debug: false,
5
+ debug: process.argv.includes("debug"),
6
6
  };
7
7
  export const ALL_EXTENSIONS = [
8
8
  createOpaqueExtension("KHR_animation_pointer", [PropertyType.ANIMATION, PropertyType.ANIMATION_CHANNEL], { ...opaqueOptions }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
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",