@needle-tools/three-animation-pointer 1.0.5 → 1.0.6

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.0.5] - 2025-10-15
8
+ - Fix: Remove leftover log
9
+
7
10
  ## [1.0.5] - 2025-10-15
8
11
  - Add: support for boolean animation tracks (when using ubyte type)
9
12
 
@@ -1,4 +1,4 @@
1
- import { SkinnedMesh as S, InterpolateDiscrete as M, InterpolateLinear as F, AnimationClip as W, PropertyBinding as C, QuaternionKeyframeTrack as w, ColorKeyframeTrack as D, VectorKeyframeTrack as B, BooleanKeyframeTrack as E, NumberKeyframeTrack as O } from "three";
1
+ import { SkinnedMesh as S, InterpolateDiscrete as M, InterpolateLinear as F, AnimationClip as W, PropertyBinding as C, QuaternionKeyframeTrack as w, ColorKeyframeTrack as B, VectorKeyframeTrack as D, BooleanKeyframeTrack as E, NumberKeyframeTrack as O } from "three";
2
2
  const d = {
3
3
  node: "node",
4
4
  material: "material",
@@ -29,7 +29,7 @@ class G {
29
29
  }
30
30
  loadAnimationTargetFromChannelWithAnimationPointer(a) {
31
31
  var u;
32
- L();
32
+ j();
33
33
  const t = a.target, r = t.extensions && t.extensions[R] && t.path && t.path === "pointer";
34
34
  if (!r) return null;
35
35
  let e, n = d.node, s;
@@ -46,7 +46,7 @@ class G {
46
46
  }
47
47
  switch (n) {
48
48
  case d.material:
49
- const T = ("/materials/" + s.toString() + "/").length, g = o.substring(0, T);
49
+ const T = ("/materials/" + s.toString() + "/").length, f = o.substring(0, T);
50
50
  switch (e = o.substring(T), e) {
51
51
  case "pbrMetallicRoughness/baseColorFactor":
52
52
  e = "color";
@@ -130,7 +130,7 @@ class G {
130
130
  e = "specularColor";
131
131
  break;
132
132
  }
133
- o = g + e;
133
+ o = f + e;
134
134
  break;
135
135
  case d.node:
136
136
  const k = ("/nodes/" + s.toString() + "/").length, l = o.substring(0, k);
@@ -173,8 +173,8 @@ class G {
173
173
  o = "/lights/" + s.toString() + "/" + e;
174
174
  break;
175
175
  case d.camera:
176
- const f = ("/cameras/" + s.toString() + "/").length, b = o.substring(0, f);
177
- switch (e = o.substring(f), e) {
176
+ const g = ("/cameras/" + s.toString() + "/").length, b = o.substring(0, g);
177
+ switch (e = o.substring(g), e) {
178
178
  case "perspective/yfov":
179
179
  e = "fov";
180
180
  break;
@@ -222,9 +222,9 @@ class G {
222
222
  return u;
223
223
  }
224
224
  k(this.parser);
225
- function g(l, c) {
225
+ function f(l, c) {
226
226
  try {
227
- const f = c.split(".").filter(Boolean), m = f[f.length - 1].replace(/\[.*\]$/, "");
227
+ const g = c.split(".").filter(Boolean), m = g[g.length - 1].replace(/\[.*\]$/, "");
228
228
  return m in l ? typeof l[m] == "boolean" : !1;
229
229
  } catch {
230
230
  return !1;
@@ -232,19 +232,18 @@ class G {
232
232
  }
233
233
  function k(l) {
234
234
  i = h.join(".");
235
- let c, f = !1;
235
+ let c, g = !1;
236
236
  switch (r.itemSize) {
237
237
  case 1:
238
- const _ = Object.prototype.toString.call(r.array) === "[object Uint8Array]" && // UNSIGNED_BYTE as a strong hint
239
- g(a, i);
240
- _ ? console.log("Assuming boolean animation for", i, "based on property type and accessor type") : console.log("Not a boolean target", i), _ ? (c = E, f = !0) : c = O;
238
+ Object.prototype.toString.call(r.array) === "[object Uint8Array]" && // UNSIGNED_BYTE as a strong hint
239
+ f(a, i) ? (c = E, g = !0) : c = O;
241
240
  break;
242
241
  case 2:
243
242
  case 3:
244
- c = B;
243
+ c = D;
245
244
  break;
246
245
  case 4:
247
- i.endsWith(".quaternion") ? c = w : c = D;
246
+ i.endsWith(".quaternion") ? c = w : c = B;
248
247
  break;
249
248
  }
250
249
  if (!c) {
@@ -253,7 +252,7 @@ class G {
253
252
  }
254
253
  const b = e.interpolation !== void 0 ? U[e.interpolation] : F;
255
254
  let m = l._getArrayFromAccessor(r);
256
- i.endsWith(".fov") && (m = m.map((x) => x / Math.PI * 180)), f && (m = m.map((x) => x > 0));
255
+ i.endsWith(".fov") && (m = m.map((_) => _ / Math.PI * 180)), g && (m = m.map((_) => _ > 0));
257
256
  const p = new c(
258
257
  i,
259
258
  t.array,
@@ -261,16 +260,16 @@ class G {
261
260
  b
262
261
  );
263
262
  if (b === "CUBICSPLINE" && l._createCubicSplineTrackInterpolant(p), u.push(p), i && r.itemSize === 4 && i.startsWith(".materials.") && i.endsWith(".color")) {
264
- const x = new Float32Array(m.length / 4);
265
- for (let _ = 0, P = m.length / 4; _ < P; _ += 1)
266
- x[_] = m[_ * 4 + 3];
267
- const y = new c(
263
+ const _ = new Float32Array(m.length / 4);
264
+ for (let y = 0, P = m.length / 4; y < P; y += 1)
265
+ _[y] = m[y * 4 + 3];
266
+ const x = new c(
268
267
  i.replace(".color", ".opacity"),
269
268
  t.array,
270
- x,
269
+ _,
271
270
  b
272
271
  );
273
- b === "CUBICSPLINE" && l._createCubicSplineTrackInterpolant(p), u.push(y);
272
+ b === "CUBICSPLINE" && l._createCubicSplineTrackInterpolant(p), u.push(x);
274
273
  }
275
274
  }
276
275
  return u;
@@ -287,10 +286,10 @@ class G {
287
286
  */
288
287
  loadAnimation(a) {
289
288
  const t = this, r = this.parser.json, e = this.parser, n = r.animations[a], s = n.name ? n.name : "animation_" + a, i = [], u = [], h = [], o = [], T = [];
290
- for (let g = 0, k = n.channels.length; g < k; g++) {
291
- const l = n.channels[g], c = n.samplers[l.sampler], f = l.target, b = n.parameters !== void 0 ? n.parameters[c.input] : c.input, m = n.parameters !== void 0 ? n.parameters[c.output] : c.output;
289
+ for (let f = 0, k = n.channels.length; f < k; f++) {
290
+ const l = n.channels[f], c = n.samplers[l.sampler], g = l.target, b = n.parameters !== void 0 ? n.parameters[c.input] : c.input, m = n.parameters !== void 0 ? n.parameters[c.output] : c.output;
292
291
  let p = t.loadAnimationTargetFromChannelWithAnimationPointer(l);
293
- p || (p = t.loadAnimationTargetFromChannel(l)), i.push(p), u.push(e.getDependency("accessor", b)), h.push(e.getDependency("accessor", m)), o.push(c), T.push(f);
292
+ p || (p = t.loadAnimationTargetFromChannel(l)), i.push(p), u.push(e.getDependency("accessor", b)), h.push(e.getDependency("accessor", m)), o.push(c), T.push(g);
294
293
  }
295
294
  return Promise.all([
296
295
  Promise.all(i),
@@ -298,14 +297,14 @@ class G {
298
297
  Promise.all(h),
299
298
  Promise.all(o),
300
299
  Promise.all(T)
301
- ]).then(function(g) {
302
- const k = g[0], l = g[1], c = g[2], f = g[3], b = g[4], m = [];
303
- for (let p = 0, x = k.length; p < x; p++) {
304
- const y = k[p], _ = l[p], P = c[p], N = f[p], K = b[p];
305
- if (y === void 0) continue;
306
- y.updateMatrix && (y.updateMatrix(), y.matrixAutoUpdate = !0);
307
- let v = t.createAnimationTracksWithAnimationPointer(y, _, P, N, K);
308
- if (v || (v = e._createAnimationTracks(y, _, P, N, K)), v)
300
+ ]).then(function(f) {
301
+ const k = f[0], l = f[1], c = f[2], g = f[3], b = f[4], m = [];
302
+ for (let p = 0, _ = k.length; p < _; p++) {
303
+ const x = k[p], y = l[p], P = c[p], K = g[p], N = b[p];
304
+ if (x === void 0) continue;
305
+ x.updateMatrix && (x.updateMatrix(), x.matrixAutoUpdate = !0);
306
+ let v = t.createAnimationTracksWithAnimationPointer(x, y, P, K, N);
307
+ if (v || (v = e._createAnimationTracks(x, y, P, K, N)), v)
309
308
  for (let A = 0; A < v.length; A++)
310
309
  m.push(v[A]);
311
310
  }
@@ -313,11 +312,11 @@ class G {
313
312
  });
314
313
  }
315
314
  }
316
- let H = !1, j = null;
317
- function L() {
315
+ let H = !1, L = null;
316
+ function j() {
318
317
  if (H) return;
319
318
  H = !0;
320
- const I = j || (j = C.findNode);
319
+ const I = L || (L = C.findNode);
321
320
  C.findNode = function(a, t) {
322
321
  if (!t) return I(a, t);
323
322
  if (t.startsWith(".materials.")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/three-animation-pointer",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "KHR_animation_pointer support for three.js",
5
5
  "type": "module",
6
6
  "main": "dist/three-animation-pointer.js",
@@ -457,15 +457,6 @@ export class GLTFAnimationPointerExtension {
457
457
 
458
458
  const looksLikeBool = isUInt8 && // UNSIGNED_BYTE as a strong hint
459
459
  isBooleanTarget(node, animationPointerPropertyPath);
460
-
461
- // Log once per target property if it looks like a boolean
462
- if (looksLikeBool) {
463
- console.log('Assuming boolean animation for', animationPointerPropertyPath, 'based on property type and accessor type');
464
- }
465
- else
466
- {
467
- console.log('Not a boolean target', animationPointerPropertyPath);
468
- }
469
460
  if (looksLikeBool) {
470
461
  TypedKeyframeTrack = BooleanKeyframeTrack;
471
462
  convertToBoolean = true; // map 0 => false, >0 => true