@zephyr3d/editor 0.3.4 → 0.3.5
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/dist/assets/{index-DzQzWsCG.js → index-DlnbO59X.js} +2 -2
- package/dist/assistant/zephyr-types-index.json +9 -10
- package/dist/index.html +1 -1
- package/dist/modules/zephyr3d_backend-webgpu.js +13 -12
- package/dist/modules/zephyr3d_backend-webgpu.js.map +1 -1
- package/dist/modules/zephyr3d_base.js +152 -152
- package/dist/modules/zephyr3d_base.js.map +1 -1
- package/dist/modules/zephyr3d_device.js +15 -15
- package/dist/modules/zephyr3d_device.js.map +1 -1
- package/dist/modules/zephyr3d_loaders.js +6 -6
- package/dist/modules/zephyr3d_loaders.js.map +1 -1
- package/dist/modules/zephyr3d_scene.js +1382 -1385
- package/dist/modules/zephyr3d_scene.js.map +1 -1
- package/dist/vendor/zephyr3d/backend-webgpu/dist/capabilities_webgpu.js +7 -6
- package/dist/vendor/zephyr3d/backend-webgpu/dist/capabilities_webgpu.js.map +1 -1
- package/dist/vendor/zephyr3d/backend-webgpu/dist/renderpass_webgpu.js +6 -6
- package/dist/vendor/zephyr3d/backend-webgpu/dist/renderpass_webgpu.js.map +1 -1
- package/dist/vendor/zephyr3d/base/dist/vfs/common.js +152 -152
- package/dist/vendor/zephyr3d/base/dist/vfs/common.js.map +1 -1
- package/dist/vendor/zephyr3d/device/dist/device.js +15 -15
- package/dist/vendor/zephyr3d/device/dist/device.js.map +1 -1
- package/dist/vendor/zephyr3d/loaders/dist/gltf/gltf_importer.js +6 -6
- package/dist/vendor/zephyr3d/loaders/dist/gltf/gltf_importer.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/animation/animationset.js +191 -194
- package/dist/vendor/zephyr3d/scene/dist/animation/animationset.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics_modifier.js +19 -19
- package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics_modifier.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/app/engine.js +131 -131
- package/dist/vendor/zephyr3d/scene/dist/app/engine.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/app/scriptregistry.js +119 -119
- package/dist/vendor/zephyr3d/scene/dist/app/scriptregistry.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/asset/model.js +62 -62
- package/dist/vendor/zephyr3d/scene/dist/asset/model.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/avatar/wardrobe.js +13 -13
- package/dist/vendor/zephyr3d/scene/dist/avatar/wardrobe.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/camera/camera.js +201 -201
- package/dist/vendor/zephyr3d/scene/dist/camera/camera.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/index.d.ts +1 -1
- package/dist/vendor/zephyr3d/scene/dist/material/mixins/lightmodel/pbrmetallicroughness.js +5 -5
- package/dist/vendor/zephyr3d/scene/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/material/mtoon.js +4 -4
- package/dist/vendor/zephyr3d/scene/dist/material/mtoon.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/material/pbrblueprint.js +11 -11
- package/dist/vendor/zephyr3d/scene/dist/material/pbrblueprint.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/material/shader/helper.js +284 -284
- package/dist/vendor/zephyr3d/scene/dist/material/shader/helper.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/posteffect/ssr.js +9 -9
- package/dist/vendor/zephyr3d/scene/dist/posteffect/ssr.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/render/lightpass.js +5 -5
- package/dist/vendor/zephyr3d/scene/dist/render/lightpass.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/render/renderer.js +7 -7
- package/dist/vendor/zephyr3d/scene/dist/render/renderer.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/shadow/esm.js +1 -1
- package/dist/vendor/zephyr3d/scene/dist/shadow/esm.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/shadow/shadow_region.js +45 -45
- package/dist/vendor/zephyr3d/scene/dist/shadow/shadow_region.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/manager.js +275 -275
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/manager.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/camera.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/mesh.js.map +1 -1
- package/dist/vendor/zephyr3d/scene/dist/utility/serialization/scene/sprite.js.map +1 -1
- package/package.json +3 -3
- package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics/convex_collider.js +0 -320
- package/dist/vendor/zephyr3d/scene/dist/animation/joint_dynamics/convex_collider.js.map +0 -1
|
@@ -388,25 +388,25 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
388
388
|
dstClip.addTrack(remap.dstNode, track);
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
/**
|
|
392
|
-
* Animation set
|
|
393
|
-
*
|
|
394
|
-
* Manages a collection of named animation clips for a model and orchestrates:
|
|
395
|
-
* - Playback state (time, loops, speed, weights, fade-in/out).
|
|
396
|
-
* - Blending across multiple tracks targeting the same property via weighted averages.
|
|
397
|
-
* - Skeleton usage and application for clips that drive skeletal animation.
|
|
398
|
-
* - Active track registration and cleanup as clips start/stop.
|
|
399
|
-
*
|
|
400
|
-
* Usage:
|
|
401
|
-
* - Create or retrieve `AnimationClip`s by name.
|
|
402
|
-
* - Start playback with `playAnimation(name, options)`.
|
|
403
|
-
* - Advance animation with `update(deltaSeconds)`.
|
|
404
|
-
* - Optionally adjust weight while playing with `setAnimationWeight(name, weight)`.
|
|
405
|
-
*
|
|
406
|
-
* Lifetime:
|
|
407
|
-
* - Disposing the set releases references to the model, clips, and clears active state.
|
|
408
|
-
*
|
|
409
|
-
* @public
|
|
391
|
+
/**
|
|
392
|
+
* Animation set
|
|
393
|
+
*
|
|
394
|
+
* Manages a collection of named animation clips for a model and orchestrates:
|
|
395
|
+
* - Playback state (time, loops, speed, weights, fade-in/out).
|
|
396
|
+
* - Blending across multiple tracks targeting the same property via weighted averages.
|
|
397
|
+
* - Skeleton usage and application for clips that drive skeletal animation.
|
|
398
|
+
* - Active track registration and cleanup as clips start/stop.
|
|
399
|
+
*
|
|
400
|
+
* Usage:
|
|
401
|
+
* - Create or retrieve `AnimationClip`s by name.
|
|
402
|
+
* - Start playback with `playAnimation(name, options)`.
|
|
403
|
+
* - Advance animation with `update(deltaSeconds)`.
|
|
404
|
+
* - Optionally adjust weight while playing with `setAnimationWeight(name, weight)`.
|
|
405
|
+
*
|
|
406
|
+
* Lifetime:
|
|
407
|
+
* - Disposing the set releases references to the model, clips, and clears active state.
|
|
408
|
+
*
|
|
409
|
+
* @public
|
|
410
410
|
*/ class AnimationSet extends Disposable {
|
|
411
411
|
/** @internal */ _model;
|
|
412
412
|
/** @internal */ _animations;
|
|
@@ -416,10 +416,10 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
416
416
|
/** @internal */ _activeSkinBindings;
|
|
417
417
|
/** @internal */ _activeRigs;
|
|
418
418
|
/** @internal */ _activeAnimations;
|
|
419
|
-
/**
|
|
420
|
-
* Create an AnimationSet controlling the provided model.
|
|
421
|
-
*
|
|
422
|
-
* @param model - The SceneNode (model root) controlled by this animation set.
|
|
419
|
+
/**
|
|
420
|
+
* Create an AnimationSet controlling the provided model.
|
|
421
|
+
*
|
|
422
|
+
* @param model - The SceneNode (model root) controlled by this animation set.
|
|
423
423
|
*/ constructor(model){
|
|
424
424
|
super();
|
|
425
425
|
this._model = model;
|
|
@@ -431,28 +431,28 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
431
431
|
this._skeletons = [];
|
|
432
432
|
this._rigs = [];
|
|
433
433
|
}
|
|
434
|
-
/**
|
|
435
|
-
* The model (SceneNode) controlled by this animation set.
|
|
434
|
+
/**
|
|
435
|
+
* The model (SceneNode) controlled by this animation set.
|
|
436
436
|
*/ get model() {
|
|
437
437
|
return this._model;
|
|
438
438
|
}
|
|
439
|
-
/**
|
|
440
|
-
* Number of animation clips registered in this set.
|
|
439
|
+
/**
|
|
440
|
+
* Number of animation clips registered in this set.
|
|
441
441
|
*/ get numAnimations() {
|
|
442
442
|
return Object.getOwnPropertyNames(this._animations).length;
|
|
443
443
|
}
|
|
444
|
-
/**
|
|
445
|
-
* The skeletons used by animations in this set.
|
|
444
|
+
/**
|
|
445
|
+
* The skeletons used by animations in this set.
|
|
446
446
|
*/ get skeletons() {
|
|
447
447
|
return this._skeletons;
|
|
448
448
|
}
|
|
449
|
-
/**
|
|
450
|
-
* The shared rigs used by animations in this set.
|
|
449
|
+
/**
|
|
450
|
+
* The shared rigs used by animations in this set.
|
|
451
451
|
*/ get rigs() {
|
|
452
452
|
return this._rigs;
|
|
453
453
|
}
|
|
454
|
-
/**
|
|
455
|
-
* Per-skin bindings used by skinned meshes in this set.
|
|
454
|
+
/**
|
|
455
|
+
* Per-skin bindings used by skinned meshes in this set.
|
|
456
456
|
*/ get skinBindings() {
|
|
457
457
|
return this._skeletons;
|
|
458
458
|
}
|
|
@@ -474,20 +474,20 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
474
474
|
}
|
|
475
475
|
return rig;
|
|
476
476
|
}
|
|
477
|
-
/**
|
|
478
|
-
* Retrieve an animation clip by name.
|
|
479
|
-
*
|
|
480
|
-
* @param name - Name of the animation.
|
|
481
|
-
* @returns The clip if present; otherwise null.
|
|
477
|
+
/**
|
|
478
|
+
* Retrieve an animation clip by name.
|
|
479
|
+
*
|
|
480
|
+
* @param name - Name of the animation.
|
|
481
|
+
* @returns The clip if present; otherwise null.
|
|
482
482
|
*/ get(name) {
|
|
483
483
|
return this._animations[name] ?? null;
|
|
484
484
|
}
|
|
485
|
-
/**
|
|
486
|
-
* Create and register a new animation clip.
|
|
487
|
-
*
|
|
488
|
-
* @param name - Unique name for the animation clip.
|
|
489
|
-
* @param embedded - Whether the clip is embedded/owned (implementation-specific). Default false.
|
|
490
|
-
* @returns The created clip, or null if the name is empty or not unique.
|
|
485
|
+
/**
|
|
486
|
+
* Create and register a new animation clip.
|
|
487
|
+
*
|
|
488
|
+
* @param name - Unique name for the animation clip.
|
|
489
|
+
* @param embedded - Whether the clip is embedded/owned (implementation-specific). Default false.
|
|
490
|
+
* @returns The created clip, or null if the name is empty or not unique.
|
|
491
491
|
*/ createAnimation(name, embedded = false) {
|
|
492
492
|
if (!name || this._animations[name]) {
|
|
493
493
|
console.error('Animation must have unique name');
|
|
@@ -499,12 +499,12 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
499
499
|
return animation;
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
/**
|
|
503
|
-
* Delete and dispose an animation clip by name.
|
|
504
|
-
*
|
|
505
|
-
* - If the animation is currently playing, it is first stopped (immediately).
|
|
506
|
-
*
|
|
507
|
-
* @param name - Name of the animation to remove.
|
|
502
|
+
/**
|
|
503
|
+
* Delete and dispose an animation clip by name.
|
|
504
|
+
*
|
|
505
|
+
* - If the animation is currently playing, it is first stopped (immediately).
|
|
506
|
+
*
|
|
507
|
+
* @param name - Name of the animation to remove.
|
|
508
508
|
*/ deleteAnimation(name) {
|
|
509
509
|
const animation = this._animations[name];
|
|
510
510
|
if (animation) {
|
|
@@ -513,24 +513,24 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
513
513
|
animation.dispose();
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
/**
|
|
517
|
-
* Get the list of all registered animation names.
|
|
518
|
-
*
|
|
519
|
-
* @returns An array of clip names.
|
|
516
|
+
/**
|
|
517
|
+
* Get the list of all registered animation names.
|
|
518
|
+
*
|
|
519
|
+
* @returns An array of clip names.
|
|
520
520
|
*/ getAnimationNames() {
|
|
521
521
|
return Object.keys(this._animations);
|
|
522
522
|
}
|
|
523
|
-
/**
|
|
524
|
-
* Advance and apply active animations.
|
|
525
|
-
*
|
|
526
|
-
* Responsibilities per call:
|
|
527
|
-
* - Update time cursor for each active clip (respecting speedRatio and looping).
|
|
528
|
-
* - Enforce repeat limits and apply fade-out termination if configured.
|
|
529
|
-
* - For each animated target, blend active tracks (weighted by clip weight × fade-in × fade-out)
|
|
530
|
-
* and apply the resulting state to the target.
|
|
531
|
-
* - Apply shared rig modifiers once, then update skin binding palettes.
|
|
532
|
-
*
|
|
533
|
-
* @param deltaInSeconds - Time step in seconds since last update.
|
|
523
|
+
/**
|
|
524
|
+
* Advance and apply active animations.
|
|
525
|
+
*
|
|
526
|
+
* Responsibilities per call:
|
|
527
|
+
* - Update time cursor for each active clip (respecting speedRatio and looping).
|
|
528
|
+
* - Enforce repeat limits and apply fade-out termination if configured.
|
|
529
|
+
* - For each animated target, blend active tracks (weighted by clip weight × fade-in × fade-out)
|
|
530
|
+
* and apply the resulting state to the target.
|
|
531
|
+
* - Apply shared rig modifiers once, then update skin binding palettes.
|
|
532
|
+
*
|
|
533
|
+
* @param deltaInSeconds - Time step in seconds since last update.
|
|
534
534
|
*/ update(deltaInSeconds) {
|
|
535
535
|
this._activeAnimations.forEach((v, k)=>{
|
|
536
536
|
if (v.fadeOut > 0 && v.fadeOutStart < 0) {
|
|
@@ -597,11 +597,11 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
597
597
|
v.get()?.apply();
|
|
598
598
|
});
|
|
599
599
|
}
|
|
600
|
-
/**
|
|
601
|
-
* Check whether an animation is currently playing.
|
|
602
|
-
*
|
|
603
|
-
* @param name - Optional animation name. If omitted, returns true if any animation is playing.
|
|
604
|
-
* @returns True if playing; otherwise false.
|
|
600
|
+
/**
|
|
601
|
+
* Check whether an animation is currently playing.
|
|
602
|
+
*
|
|
603
|
+
* @param name - Optional animation name. If omitted, returns true if any animation is playing.
|
|
604
|
+
* @returns True if playing; otherwise false.
|
|
605
605
|
*/ isPlayingAnimation(name) {
|
|
606
606
|
if (name) {
|
|
607
607
|
const animation = this._animations[name];
|
|
@@ -609,23 +609,23 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
609
609
|
}
|
|
610
610
|
return this._activeAnimations.size > 0;
|
|
611
611
|
}
|
|
612
|
-
/**
|
|
613
|
-
* Get an animation clip by name.
|
|
614
|
-
*
|
|
615
|
-
* Alias of `get(name)` returning a nullable type.
|
|
616
|
-
*
|
|
617
|
-
* @param name - Name of the animation.
|
|
618
|
-
* @returns The clip if present; otherwise null.
|
|
612
|
+
/**
|
|
613
|
+
* Get an animation clip by name.
|
|
614
|
+
*
|
|
615
|
+
* Alias of `get(name)` returning a nullable type.
|
|
616
|
+
*
|
|
617
|
+
* @param name - Name of the animation.
|
|
618
|
+
* @returns The clip if present; otherwise null.
|
|
619
619
|
*/ getAnimationClip(name) {
|
|
620
620
|
return this._animations[name] ?? null;
|
|
621
621
|
}
|
|
622
|
-
/**
|
|
623
|
-
* Set the runtime blend weight for a currently playing animation.
|
|
624
|
-
*
|
|
625
|
-
* Has no effect if the clip is not active.
|
|
626
|
-
*
|
|
627
|
-
* @param name - Name of the playing animation.
|
|
628
|
-
* @param weight - New weight value used during blending.
|
|
622
|
+
/**
|
|
623
|
+
* Set the runtime blend weight for a currently playing animation.
|
|
624
|
+
*
|
|
625
|
+
* Has no effect if the clip is not active.
|
|
626
|
+
*
|
|
627
|
+
* @param name - Name of the playing animation.
|
|
628
|
+
* @param weight - New weight value used during blending.
|
|
629
629
|
*/ setAnimationWeight(name, weight) {
|
|
630
630
|
const ani = this._animations[name];
|
|
631
631
|
if (!ani) {
|
|
@@ -637,91 +637,88 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
637
637
|
info.weight = weight;
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
|
-
/**
|
|
641
|
-
* Start (or update) playback of an animation clip.
|
|
642
|
-
*
|
|
643
|
-
* Behavior:
|
|
644
|
-
* - If the clip is already playing,
|
|
645
|
-
* - Otherwise initializes playback state (repeat counter, speed, weight, initial time).
|
|
646
|
-
* - Registers clip tracks and skeletons into the active sets for blending and application.
|
|
647
|
-
*
|
|
648
|
-
* @param name - Name of the animation to play.
|
|
649
|
-
* @param options - Playback options (repeat, speedRatio, fadeIn).
|
|
640
|
+
/**
|
|
641
|
+
* Start (or update) playback of an animation clip.
|
|
642
|
+
*
|
|
643
|
+
* Behavior:
|
|
644
|
+
* - If the clip is already playing, stops it first.
|
|
645
|
+
* - Otherwise initializes playback state (repeat counter, speed, weight, initial time).
|
|
646
|
+
* - Registers clip tracks and skeletons into the active sets for blending and application.
|
|
647
|
+
*
|
|
648
|
+
* @param name - Name of the animation to play.
|
|
649
|
+
* @param options - Playback options (repeat, speedRatio, fadeIn).
|
|
650
650
|
*/ playAnimation(name, options) {
|
|
651
651
|
const ani = this._animations[name];
|
|
652
652
|
if (!ani) {
|
|
653
653
|
console.error(`Animation ${name} not exists`);
|
|
654
654
|
return;
|
|
655
655
|
}
|
|
656
|
+
if (this.isPlayingAnimation(name)) {
|
|
657
|
+
this.stopAnimation(name);
|
|
658
|
+
}
|
|
656
659
|
const fadeIn = Math.max(options?.fadeIn ?? 0, 0);
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
const blendId = track.getBlendId();
|
|
685
|
-
let blendedTracks = nodeTracks.get(blendId);
|
|
686
|
-
if (!blendedTracks) {
|
|
687
|
-
blendedTracks = [];
|
|
688
|
-
nodeTracks.set(blendId, blendedTracks);
|
|
689
|
-
}
|
|
690
|
-
blendedTracks.push(track);
|
|
691
|
-
}
|
|
692
|
-
});
|
|
693
|
-
ani.skeletons?.forEach((v, k)=>{
|
|
694
|
-
const rig = this.model.findSkeletonRigById(k);
|
|
695
|
-
if (rig) {
|
|
696
|
-
const refcount = this._activeRigs.get(rig);
|
|
697
|
-
this._activeRigs.set(rig, refcount ? refcount + 1 : 1);
|
|
698
|
-
rig.playing = true;
|
|
699
|
-
return;
|
|
700
|
-
}
|
|
701
|
-
const binding = this.model.findSkinBindingById(k);
|
|
702
|
-
if (binding) {
|
|
703
|
-
const refcount = this._activeSkinBindings.get(binding);
|
|
704
|
-
this._activeSkinBindings.set(binding, refcount ? refcount + 1 : 1);
|
|
705
|
-
binding.playing = true;
|
|
706
|
-
const rigRefcount = this._activeRigs.get(binding.rig);
|
|
707
|
-
this._activeRigs.set(binding.rig, rigRefcount ? rigRefcount + 1 : 1);
|
|
708
|
-
binding.rig.playing = true;
|
|
660
|
+
const repeat = options?.repeat ?? 0;
|
|
661
|
+
const speedRatio = options?.speedRatio ?? 1;
|
|
662
|
+
const weight = options?.weight ?? ani.weight ?? 1;
|
|
663
|
+
this._activeAnimations.set(ani, {
|
|
664
|
+
repeat,
|
|
665
|
+
weight,
|
|
666
|
+
speedRatio,
|
|
667
|
+
fadeIn,
|
|
668
|
+
fadeOut: 0,
|
|
669
|
+
repeatCounter: 0,
|
|
670
|
+
currentTime: speedRatio < 0 ? ani.timeDuration : 0,
|
|
671
|
+
animateTime: 0,
|
|
672
|
+
fadeOutStart: 0,
|
|
673
|
+
firstFrame: true
|
|
674
|
+
});
|
|
675
|
+
ani.tracks?.forEach((v, k)=>{
|
|
676
|
+
let nodeTracks = this._activeTracks.get(k);
|
|
677
|
+
if (!nodeTracks) {
|
|
678
|
+
nodeTracks = new Map();
|
|
679
|
+
this._activeTracks.set(k, nodeTracks);
|
|
680
|
+
}
|
|
681
|
+
for (const track of v){
|
|
682
|
+
const blendId = track.getBlendId();
|
|
683
|
+
let blendedTracks = nodeTracks.get(blendId);
|
|
684
|
+
if (!blendedTracks) {
|
|
685
|
+
blendedTracks = [];
|
|
686
|
+
nodeTracks.set(blendId, blendedTracks);
|
|
709
687
|
}
|
|
710
|
-
|
|
711
|
-
|
|
688
|
+
blendedTracks.push(track);
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
ani.skeletons?.forEach((v, k)=>{
|
|
692
|
+
const rig = this.model.findSkeletonRigById(k);
|
|
693
|
+
if (rig) {
|
|
694
|
+
const refcount = this._activeRigs.get(rig);
|
|
695
|
+
this._activeRigs.set(rig, refcount ? refcount + 1 : 1);
|
|
696
|
+
rig.playing = true;
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
const binding = this.model.findSkinBindingById(k);
|
|
700
|
+
if (binding) {
|
|
701
|
+
const refcount = this._activeSkinBindings.get(binding);
|
|
702
|
+
this._activeSkinBindings.set(binding, refcount ? refcount + 1 : 1);
|
|
703
|
+
binding.playing = true;
|
|
704
|
+
const rigRefcount = this._activeRigs.get(binding.rig);
|
|
705
|
+
this._activeRigs.set(binding.rig, rigRefcount ? rigRefcount + 1 : 1);
|
|
706
|
+
binding.rig.playing = true;
|
|
707
|
+
}
|
|
708
|
+
});
|
|
712
709
|
}
|
|
713
|
-
/**
|
|
714
|
-
* Stop playback of an animation clip.
|
|
715
|
-
*
|
|
716
|
-
* Behavior:
|
|
717
|
-
* - If `options.fadeOut > 0`, marks the clip for fade-out; actual removal occurs after fade completes.
|
|
718
|
-
* - If `fadeOut` is 0 or omitted, immediately:
|
|
719
|
-
* - Removes the clip from active animations.
|
|
720
|
-
* - Unregisters its tracks from active track maps.
|
|
721
|
-
* - Decrements skeleton reference counts; resets and removes skeletons when refcount reaches 0.
|
|
722
|
-
*
|
|
723
|
-
* @param name - Name of the animation to stop.
|
|
724
|
-
* @param options - Optional fade-out configuration.
|
|
710
|
+
/**
|
|
711
|
+
* Stop playback of an animation clip.
|
|
712
|
+
*
|
|
713
|
+
* Behavior:
|
|
714
|
+
* - If `options.fadeOut > 0`, marks the clip for fade-out; actual removal occurs after fade completes.
|
|
715
|
+
* - If `fadeOut` is 0 or omitted, immediately:
|
|
716
|
+
* - Removes the clip from active animations.
|
|
717
|
+
* - Unregisters its tracks from active track maps.
|
|
718
|
+
* - Decrements skeleton reference counts; resets and removes skeletons when refcount reaches 0.
|
|
719
|
+
*
|
|
720
|
+
* @param name - Name of the animation to stop.
|
|
721
|
+
* @param options - Optional fade-out configuration.
|
|
725
722
|
*/ stopAnimation(name, options) {
|
|
726
723
|
const ani = this._animations[name];
|
|
727
724
|
if (!ani) {
|
|
@@ -774,17 +771,17 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
774
771
|
}
|
|
775
772
|
}
|
|
776
773
|
}
|
|
777
|
-
/**
|
|
778
|
-
* Create a skeletal-only masked clip from an existing clip in this set.
|
|
779
|
-
*
|
|
780
|
-
* The generated clip is a regular `AnimationClip`: it contains cloned node transform tracks
|
|
781
|
-
* for the selected rig joints and can be played/blended through the normal animation system.
|
|
782
|
-
* Non-skeletal tracks are skipped by default.
|
|
783
|
-
*
|
|
784
|
-
* @param sourceName - Name of the source clip.
|
|
785
|
-
* @param targetName - Name of the generated clip.
|
|
786
|
-
* @param options - Humanoid semantic or joint-name based mask options.
|
|
787
|
-
* @returns The generated clip, or null on failure.
|
|
774
|
+
/**
|
|
775
|
+
* Create a skeletal-only masked clip from an existing clip in this set.
|
|
776
|
+
*
|
|
777
|
+
* The generated clip is a regular `AnimationClip`: it contains cloned node transform tracks
|
|
778
|
+
* for the selected rig joints and can be played/blended through the normal animation system.
|
|
779
|
+
* Non-skeletal tracks are skipped by default.
|
|
780
|
+
*
|
|
781
|
+
* @param sourceName - Name of the source clip.
|
|
782
|
+
* @param targetName - Name of the generated clip.
|
|
783
|
+
* @param options - Humanoid semantic or joint-name based mask options.
|
|
784
|
+
* @returns The generated clip, or null on failure.
|
|
788
785
|
*/ createSkeletalMaskedAnimation(sourceName, targetName, options) {
|
|
789
786
|
const sourceClip = this.get(sourceName);
|
|
790
787
|
if (!sourceClip) {
|
|
@@ -991,21 +988,21 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
991
988
|
}
|
|
992
989
|
return dstClip;
|
|
993
990
|
}
|
|
994
|
-
/**
|
|
995
|
-
* Copy an animation clip from another AnimationSet into this one.
|
|
996
|
-
*
|
|
997
|
-
* Prerequisites:
|
|
998
|
-
* - Both sets must reference skeletons with identical joint names and counts.
|
|
999
|
-
* - The source clip must exist in `sourceSet`.
|
|
1000
|
-
*
|
|
1001
|
-
* @param sourceSet - The AnimationSet to copy from.
|
|
1002
|
-
* @param animationName - Name of the clip to copy.
|
|
1003
|
-
* @param targetName - Name for the new clip in this set. Defaults to `animationName`.
|
|
1004
|
-
* @param excludeJoint - Optional predicate; joints whose name returns true are excluded from
|
|
1005
|
-
* skeleton structure matching.
|
|
1006
|
-
* @returns The newly created AnimationClip, or null on failure.
|
|
1007
|
-
*
|
|
1008
|
-
* @deprecated Use AnimationSet.copyHumanoidAnimationFrom instead.
|
|
991
|
+
/**
|
|
992
|
+
* Copy an animation clip from another AnimationSet into this one.
|
|
993
|
+
*
|
|
994
|
+
* Prerequisites:
|
|
995
|
+
* - Both sets must reference skeletons with identical joint names and counts.
|
|
996
|
+
* - The source clip must exist in `sourceSet`.
|
|
997
|
+
*
|
|
998
|
+
* @param sourceSet - The AnimationSet to copy from.
|
|
999
|
+
* @param animationName - Name of the clip to copy.
|
|
1000
|
+
* @param targetName - Name for the new clip in this set. Defaults to `animationName`.
|
|
1001
|
+
* @param excludeJoint - Optional predicate; joints whose name returns true are excluded from
|
|
1002
|
+
* skeleton structure matching.
|
|
1003
|
+
* @returns The newly created AnimationClip, or null on failure.
|
|
1004
|
+
*
|
|
1005
|
+
* @deprecated Use AnimationSet.copyHumanoidAnimationFrom instead.
|
|
1009
1006
|
*/ copyAnimationFrom(sourceSet, animationName, targetName, excludeJoint) {
|
|
1010
1007
|
const destName = targetName ?? animationName;
|
|
1011
1008
|
const sourceClip = sourceSet.get(animationName);
|
|
@@ -1151,8 +1148,8 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1151
1148
|
return ordered;
|
|
1152
1149
|
}
|
|
1153
1150
|
}
|
|
1154
|
-
/**
|
|
1155
|
-
* Reset all skeleton modifiers
|
|
1151
|
+
/**
|
|
1152
|
+
* Reset all skeleton modifiers
|
|
1156
1153
|
*/ resetSkeletonModifiers() {
|
|
1157
1154
|
for (const sk of this._skeletons){
|
|
1158
1155
|
for (const modifier of sk.get().modifiers){
|
|
@@ -1160,12 +1157,12 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1160
1157
|
}
|
|
1161
1158
|
}
|
|
1162
1159
|
}
|
|
1163
|
-
/**
|
|
1164
|
-
* Dispose the animation set and release owned resources.
|
|
1165
|
-
*
|
|
1166
|
-
* - Disposes the weak reference to the model.
|
|
1167
|
-
* - Disposes all registered animation clips.
|
|
1168
|
-
* - Clears active animations, tracks, and skeleton references.
|
|
1160
|
+
/**
|
|
1161
|
+
* Dispose the animation set and release owned resources.
|
|
1162
|
+
*
|
|
1163
|
+
* - Disposes the weak reference to the model.
|
|
1164
|
+
* - Disposes all registered animation clips.
|
|
1165
|
+
* - Clears active animations, tracks, and skeleton references.
|
|
1169
1166
|
*/ onDispose() {
|
|
1170
1167
|
super.onDispose();
|
|
1171
1168
|
for(const k in this._animations){
|