Skip to content

Commit b06c433

Browse files
committed
Some type fixes + version
1 parent 507e264 commit b06c433

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@needle-tools/three-animation-pointer",
3-
"version": "1.0.0-beta.1",
3+
"version": "1.0.0-beta.2",
44
"description": "KHR_animation_pointer support for three.js",
55
"type": "module",
66
"main": "src/index.js",

src/GLTFLoaderAnimationPointer.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from 'three';
1212

1313
/**
14-
* @typedef {import("three/examples/jsm/loaders/GLTFLoader").GLTFLoaderPlugin} GLTFLoaderPlugin
14+
* @typedef {import("..").GLTFAnimationPointerExtension} PluginType
1515
*/
1616

1717
// DUPLICATED from GLTFLoader.js
@@ -41,7 +41,7 @@ const _animationPointerDebug = false;
4141
*
4242
* Draft Specification: https://github.com/ux3d/glTF/tree/extensions/KHR_animation_pointer/extensions/2.0/Khronos/KHR_animation_pointer
4343
*
44-
* @implements {GLTFLoaderPlugin}
44+
* @implements {PluginType}
4545
*/
4646
export class GLTFAnimationPointerExtension {
4747

@@ -339,7 +339,7 @@ export class GLTFAnimationPointerExtension {
339339

340340
}
341341

342-
if ( targetId === null || isNaN( targetId ) ) {
342+
if ( targetId === null || targetId === undefined || isNaN( targetId ) ) {
343343

344344
console.warn( 'Failed resolving animation node id: ' + targetId, target );
345345
return;
@@ -442,6 +442,11 @@ export class GLTFAnimationPointerExtension {
442442

443443
}
444444

445+
if( !TypedKeyframeTrack ) {
446+
console.warn( 'Unsupported output accessor format', outputAccessor );
447+
return;
448+
}
449+
445450
const interpolation = sampler.interpolation !== undefined ? INTERPOLATION[ sampler.interpolation ] : InterpolateLinear;
446451

447452
let outputArray = parser._getArrayFromAccessor( outputAccessor );

types/index.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
import { GLTFLoaderPlugin } from "three/examples/jsm/loaders/GLTFLoader";
2+
import { GLTFLoaderPlugin } from "../src/GLTFLoaderAnimationPointer";
13

24

35
export type AnimationPointerResolver = {
46
resolvePath(path: string): string | null;
7+
}
8+
9+
export type GLTFAnimationPointerExtension = GLTFLoaderPlugin & {
10+
setAnimationPointerResolver(resolver: AnimationPointerResolver | null): void;
511
}

0 commit comments

Comments
 (0)