@needle-tools/three-animation-pointer 1.0.0-next.3b7dc2f → 1.0.0-next.6ca715c
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 +8 -0
- package/README.md +29 -1
- package/index.js +5 -0
- package/package.json +9 -3
- package/src/GLTFLoaderAnimationPointer.js +8 -3
- package/types/index.d.ts +9 -1
- package/src/index.js +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this package will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [1.0.0] - 2025-08-27
|
|
8
|
+
- Initial release
|
package/README.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
This package adds a [three.js](https://github.com/mrdoob/three.js) GLTFLoader plugin for [KHR_animation_pointer](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_animation_pointer) support.
|
|
4
4
|
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
Install the package:
|
|
8
|
+
`npm i @needle-tools/three-animation-pointer`
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Register the plugin on your GLTFLoader:
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import { GLTFAnimationPointerExtension } from "@needle-tools/three-animation-pointer"
|
|
15
|
+
|
|
16
|
+
const loader = new GLTFLoader();
|
|
17
|
+
loader.register(p => {
|
|
18
|
+
return new GLTFAnimationPointerExtension(p);
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
5
22
|
## Links
|
|
6
23
|
|
|
7
|
-
- [
|
|
24
|
+
- [Khronos KHR_animation_pointer spec](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_animation_pointer)
|
|
25
|
+
- [three.js repository PR #24108](https://github.com/mrdoob/three.js/pull/24108)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Contact ✒️
|
|
30
|
+
<b>[🌵 Needle](https://needle.tools)</b> •
|
|
31
|
+
[Github](https://github.com/needle-tools) •
|
|
32
|
+
[Twitter](https://twitter.com/NeedleTools) •
|
|
33
|
+
[Discord](https://discord.needle.tools) •
|
|
34
|
+
[Forum](https://forum.needle.tools) •
|
|
35
|
+
[Youtube](https://www.youtube.com/@needle-tools)
|
package/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/three-animation-pointer",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.6ca715c",
|
|
4
4
|
"description": "KHR_animation_pointer support for three.js",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "index.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./index.js",
|
|
11
|
+
"require": "./index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
8
14
|
"files": [
|
|
9
15
|
"src",
|
|
10
16
|
"types",
|
|
@@ -19,7 +25,7 @@
|
|
|
19
25
|
"url": "https://needle.tools/"
|
|
20
26
|
},
|
|
21
27
|
"repository": {
|
|
22
|
-
"url": "https://github.com/needle-tools/three-
|
|
28
|
+
"url": "https://github.com/needle-tools/three-animation-pointer"
|
|
23
29
|
},
|
|
24
30
|
"license": "MIT",
|
|
25
31
|
"devDependencies": {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from 'three';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @typedef {import("
|
|
14
|
+
* @typedef {import("..").GLTFAnimationPointerExtension} PluginType
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
// DUPLICATED from GLTFLoader.js
|
|
@@ -41,7 +41,7 @@ const _animationPointerDebug = false;
|
|
|
41
41
|
*
|
|
42
42
|
* Draft Specification: https://github.com/ux3d/glTF/tree/extensions/KHR_animation_pointer/extensions/2.0/Khronos/KHR_animation_pointer
|
|
43
43
|
*
|
|
44
|
-
* @implements {
|
|
44
|
+
* @implements {PluginType}
|
|
45
45
|
*/
|
|
46
46
|
export class GLTFAnimationPointerExtension {
|
|
47
47
|
|
|
@@ -339,7 +339,7 @@ export class GLTFAnimationPointerExtension {
|
|
|
339
339
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
if ( targetId === null || isNaN( targetId ) ) {
|
|
342
|
+
if ( targetId === null || targetId === undefined || isNaN( targetId ) ) {
|
|
343
343
|
|
|
344
344
|
console.warn( 'Failed resolving animation node id: ' + targetId, target );
|
|
345
345
|
return;
|
|
@@ -442,6 +442,11 @@ export class GLTFAnimationPointerExtension {
|
|
|
442
442
|
|
|
443
443
|
}
|
|
444
444
|
|
|
445
|
+
if( !TypedKeyframeTrack ) {
|
|
446
|
+
console.warn( 'Unsupported output accessor format', outputAccessor );
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
|
|
445
450
|
const interpolation = sampler.interpolation !== undefined ? INTERPOLATION[ sampler.interpolation ] : InterpolateLinear;
|
|
446
451
|
|
|
447
452
|
let outputArray = parser._getArrayFromAccessor( outputAccessor );
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { GLTFLoaderPlugin } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
2
2
|
|
|
3
3
|
export type AnimationPointerResolver = {
|
|
4
4
|
resolvePath(path: string): string | null;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export declare class GLTFAnimationPointerExtension implements GLTFLoaderPlugin {
|
|
8
|
+
name: string;
|
|
9
|
+
parser: any;
|
|
10
|
+
constructor(parser: any);
|
|
11
|
+
setAnimationPointerResolver(resolver: AnimationPointerResolver | null): GLTFAnimationPointerExtension;
|
|
12
|
+
loadAnimation(animationIndex: number): Promise<any>;
|
|
5
13
|
}
|
package/src/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./GLTFLoaderAnimationPointer.js"
|