@needle-tools/engine 3.19.2 → 3.19.4
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 +10 -0
- package/dist/needle-engine.js +8937 -8894
- package/dist/needle-engine.light.js +8639 -8596
- package/dist/needle-engine.light.min.js +183 -183
- package/dist/needle-engine.light.umd.cjs +188 -188
- package/dist/needle-engine.min.js +184 -184
- package/dist/needle-engine.umd.cjs +189 -189
- package/lib/engine/extensions/NEEDLE_progressive.js +14 -12
- package/lib/engine/extensions/NEEDLE_progressive.js.map +1 -1
- package/lib/engine-components/Animation.js +6 -6
- package/lib/engine-components/Animation.js.map +1 -1
- package/lib/engine-components/Collider.d.ts +2 -0
- package/lib/engine-components/Collider.js +4 -0
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/Interactable.js +0 -1
- package/lib/engine-components/Interactable.js.map +1 -1
- package/lib/engine-components/OrbitControls.d.ts +11 -1
- package/lib/engine-components/OrbitControls.js +53 -3
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/Renderer.js +4 -1
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/VideoPlayer.d.ts +1 -2
- package/lib/engine-components/VideoPlayer.js +9 -7
- package/lib/engine-components/VideoPlayer.js.map +1 -1
- package/lib/engine-components/timeline/PlayableDirector.js +50 -36
- package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
- package/lib/engine-components/timeline/TimelineModels.d.ts +2 -2
- package/lib/engine-components/webxr/WebARSessionRoot.js +2 -2
- package/lib/engine-components/webxr/WebARSessionRoot.js.map +1 -1
- package/lib/engine-components/webxr/WebXRController.d.ts +0 -1
- package/lib/engine-components/webxr/WebXRController.js +0 -14
- package/lib/engine-components/webxr/WebXRController.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/extensions/NEEDLE_progressive.ts +14 -12
- package/src/engine-components/Animation.ts +5 -4
- package/src/engine-components/Collider.ts +5 -0
- package/src/engine-components/Interactable.ts +1 -10
- package/src/engine-components/OrbitControls.ts +29 -3
- package/src/engine-components/Renderer.ts +4 -1
- package/src/engine-components/VideoPlayer.ts +7 -5
- package/src/engine-components/timeline/PlayableDirector.ts +48 -34
- package/src/engine-components/timeline/TimelineModels.ts +2 -2
- package/src/engine-components/webxr/WebARSessionRoot.ts +2 -2
- package/src/engine-components/webxr/WebXRController.ts +1141 -1156
|
@@ -325,9 +325,11 @@ export class PlayableDirector extends Behaviour {
|
|
|
325
325
|
const binding = track.outputs[i];
|
|
326
326
|
if (typeof binding === "object") {
|
|
327
327
|
let isActive: boolean = false;
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
328
|
+
if (track.clips) {
|
|
329
|
+
for (const clip of track.clips) {
|
|
330
|
+
if (clip.start <= time && time <= clip.end) {
|
|
331
|
+
isActive = true;
|
|
332
|
+
}
|
|
331
333
|
}
|
|
332
334
|
}
|
|
333
335
|
const obj = binding as THREE.Object3D;
|
|
@@ -411,20 +413,22 @@ export class PlayableDirector extends Behaviour {
|
|
|
411
413
|
}
|
|
412
414
|
}
|
|
413
415
|
if (track.type === Models.TrackType.Control) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
if (
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
416
|
+
if (track.clips) {
|
|
417
|
+
for (let i = 0; i < track.clips.length; i++) {
|
|
418
|
+
const clip = track.clips[i];
|
|
419
|
+
let binding = clip.asset.sourceObject;
|
|
420
|
+
if (typeof binding === "string") {
|
|
421
|
+
if (this._guidsMap && this._guidsMap[binding])
|
|
422
|
+
binding = this._guidsMap[binding];
|
|
423
|
+
const obj = GameObject.findByGuid(binding, root);
|
|
424
|
+
if (obj === null || typeof obj !== "object") {
|
|
425
|
+
console.warn("Failed to resolve sourceObject binding", binding, track.name, clip);
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
if (debug)
|
|
429
|
+
console.log("Resolved binding", binding, "to", obj);
|
|
430
|
+
clip.asset.sourceObject = obj;
|
|
431
|
+
}
|
|
428
432
|
}
|
|
429
433
|
}
|
|
430
434
|
}
|
|
@@ -443,11 +447,15 @@ export class PlayableDirector extends Behaviour {
|
|
|
443
447
|
if (!this.playableAsset || !this.playableAsset.tracks) return;
|
|
444
448
|
for (const track of this.playableAsset.tracks) {
|
|
445
449
|
if (track.muted === true) continue;
|
|
446
|
-
|
|
447
|
-
|
|
450
|
+
if (track.clips) {
|
|
451
|
+
for (const clip of track.clips) {
|
|
452
|
+
if (clip.end > this._duration) this._duration = clip.end;
|
|
453
|
+
}
|
|
448
454
|
}
|
|
449
|
-
|
|
450
|
-
|
|
455
|
+
if (track.markers) {
|
|
456
|
+
for (const marker of track.markers) {
|
|
457
|
+
if (marker.time > this._duration) this._duration = marker.time + .001;
|
|
458
|
+
}
|
|
451
459
|
}
|
|
452
460
|
}
|
|
453
461
|
// console.log("timeline duration", this._duration, this.playableAsset);
|
|
@@ -474,7 +482,7 @@ export class PlayableDirector extends Behaviour {
|
|
|
474
482
|
}
|
|
475
483
|
// only handle animation tracks
|
|
476
484
|
if (track.type === Models.TrackType.Animation) {
|
|
477
|
-
if (track.clips.length <= 0) {
|
|
485
|
+
if (!track.clips || track.clips.length <= 0) {
|
|
478
486
|
if (debug) console.warn("Animation track has no clips", track);
|
|
479
487
|
continue;
|
|
480
488
|
}
|
|
@@ -533,7 +541,7 @@ export class PlayableDirector extends Behaviour {
|
|
|
533
541
|
}
|
|
534
542
|
}
|
|
535
543
|
else if (track.type === Models.TrackType.Audio) {
|
|
536
|
-
if (track.clips.length <= 0) continue;
|
|
544
|
+
if (!track.clips || track.clips.length <= 0) continue;
|
|
537
545
|
const audio = new Tracks.AudioTrackHandler();
|
|
538
546
|
audio.director = this;
|
|
539
547
|
audio.track = track;
|
|
@@ -549,12 +557,14 @@ export class PlayableDirector extends Behaviour {
|
|
|
549
557
|
const signalHandler: Tracks.SignalTrackHandler = new Tracks.SignalTrackHandler();
|
|
550
558
|
signalHandler.director = this;
|
|
551
559
|
signalHandler.track = track;
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
560
|
+
if (track.markers) {
|
|
561
|
+
for (const marker of track.markers) {
|
|
562
|
+
switch (marker.type) {
|
|
563
|
+
case Models.MarkerType.Signal:
|
|
564
|
+
signalHandler.models.push(marker as Models.SignalMarkerModel);
|
|
565
|
+
signalHandler.didTrigger.push(false);
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
558
568
|
}
|
|
559
569
|
}
|
|
560
570
|
if (signalHandler !== null && signalHandler.models.length > 0) {
|
|
@@ -569,9 +579,11 @@ export class PlayableDirector extends Behaviour {
|
|
|
569
579
|
const handler = new Tracks.SignalTrackHandler();
|
|
570
580
|
handler.director = this;
|
|
571
581
|
handler.track = track;
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
582
|
+
if (track.markers) {
|
|
583
|
+
for (const marker of track.markers) {
|
|
584
|
+
handler.models.push(marker as Models.SignalMarkerModel);
|
|
585
|
+
handler.didTrigger.push(false);
|
|
586
|
+
}
|
|
575
587
|
}
|
|
576
588
|
for (const bound of track.outputs) {
|
|
577
589
|
handler.receivers.push(bound as SignalReceiver);
|
|
@@ -582,8 +594,10 @@ export class PlayableDirector extends Behaviour {
|
|
|
582
594
|
const handler = new Tracks.ControlTrackHandler();
|
|
583
595
|
handler.director = this;
|
|
584
596
|
handler.track = track;
|
|
585
|
-
|
|
586
|
-
|
|
597
|
+
if (track.clips) {
|
|
598
|
+
for (const clip of track.clips) {
|
|
599
|
+
handler.models.push(clip);
|
|
600
|
+
}
|
|
587
601
|
}
|
|
588
602
|
handler.resolveSourceObjects(this.context);
|
|
589
603
|
this._controlTracks.push(handler);
|
|
@@ -28,8 +28,8 @@ export declare type TrackModel = {
|
|
|
28
28
|
type: TrackType;
|
|
29
29
|
muted: boolean;
|
|
30
30
|
outputs: Array<null | string | object>;
|
|
31
|
-
clips
|
|
32
|
-
markers
|
|
31
|
+
clips?: Array<ClipModel>;
|
|
32
|
+
markers?: Array<MarkerModel>;
|
|
33
33
|
trackOffset?: TrackOffset;
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -109,9 +109,9 @@ export class WebARSessionRoot extends Behaviour {
|
|
|
109
109
|
// }
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
private
|
|
112
|
+
private onCreatePlacementAnchor(hit: XRHitTestResult, pose: XRPose) {
|
|
113
113
|
this._anchor = null;
|
|
114
|
-
hit
|
|
114
|
+
hit?.createAnchor?.call(hit, pose.transform)?.then(anchor => {
|
|
115
115
|
if (this.context.isInAR)
|
|
116
116
|
this._anchor = anchor;
|
|
117
117
|
});
|