@zephyr3d/scene 0.9.11 → 0.9.13
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/animation/animationset.js +188 -188
- package/dist/animation/animationset.js.map +1 -1
- package/dist/animation/animationtimeline.js +117 -117
- package/dist/animation/animationtimeline.js.map +1 -1
- package/dist/app/scriptregistry.js +9 -9
- package/dist/app/scriptregistry.js.map +1 -1
- package/dist/material/mixins/lit.js +7 -3
- package/dist/material/mixins/lit.js.map +1 -1
- package/dist/utility/serialization/scene/camera.js +1 -1
- package/dist/utility/serialization/scene/camera.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,9 +8,9 @@ import { HumanoidBodyRig } from './skeleton.js';
|
|
|
8
8
|
import { createSkeletalMaskedAnimationClip } from './animationmask.js';
|
|
9
9
|
|
|
10
10
|
let nextAnimationPlaybackId = 1;
|
|
11
|
-
/**
|
|
12
|
-
* Runtime handle for one playback of an AnimationClip.
|
|
13
|
-
* @public
|
|
11
|
+
/**
|
|
12
|
+
* Runtime handle for one playback of an AnimationClip.
|
|
13
|
+
* @public
|
|
14
14
|
*/ class AnimationPlayback extends Observable {
|
|
15
15
|
/** @internal */ _animationSet;
|
|
16
16
|
/** @internal */ _clip;
|
|
@@ -606,25 +606,25 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
606
606
|
dstClip.addTrack(remap.dstNode, track);
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
/**
|
|
610
|
-
* Animation set
|
|
611
|
-
*
|
|
612
|
-
* Manages a collection of named animation clips for a model and orchestrates:
|
|
613
|
-
* - Playback state (time, loops, speed, weights, fade-in/out).
|
|
614
|
-
* - Blending across multiple tracks targeting the same property via weighted averages.
|
|
615
|
-
* - Skeleton usage and application for clips that drive skeletal animation.
|
|
616
|
-
* - Active track registration and cleanup as clips start/stop.
|
|
617
|
-
*
|
|
618
|
-
* Usage:
|
|
619
|
-
* - Create or retrieve `AnimationClip`s by name.
|
|
620
|
-
* - Start playback with `playAnimation(name, options)`.
|
|
621
|
-
* - Advance animation with `update(deltaSeconds)`.
|
|
622
|
-
* - Optionally adjust weight while playing with `setAnimationWeight(name, weight)`.
|
|
623
|
-
*
|
|
624
|
-
* Lifetime:
|
|
625
|
-
* - Disposing the set releases references to the model, clips, and clears active state.
|
|
626
|
-
*
|
|
627
|
-
* @public
|
|
609
|
+
/**
|
|
610
|
+
* Animation set
|
|
611
|
+
*
|
|
612
|
+
* Manages a collection of named animation clips for a model and orchestrates:
|
|
613
|
+
* - Playback state (time, loops, speed, weights, fade-in/out).
|
|
614
|
+
* - Blending across multiple tracks targeting the same property via weighted averages.
|
|
615
|
+
* - Skeleton usage and application for clips that drive skeletal animation.
|
|
616
|
+
* - Active track registration and cleanup as clips start/stop.
|
|
617
|
+
*
|
|
618
|
+
* Usage:
|
|
619
|
+
* - Create or retrieve `AnimationClip`s by name.
|
|
620
|
+
* - Start playback with `playAnimation(name, options)`.
|
|
621
|
+
* - Advance animation with `update(deltaSeconds)`.
|
|
622
|
+
* - Optionally adjust weight while playing with `setAnimationWeight(name, weight)`.
|
|
623
|
+
*
|
|
624
|
+
* Lifetime:
|
|
625
|
+
* - Disposing the set releases references to the model, clips, and clears active state.
|
|
626
|
+
*
|
|
627
|
+
* @public
|
|
628
628
|
*/ class AnimationSet extends makeObservable(Disposable)() {
|
|
629
629
|
/** @internal */ _model;
|
|
630
630
|
/** @internal */ _animations;
|
|
@@ -634,18 +634,18 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
634
634
|
/** @internal */ _activeSkinBindings;
|
|
635
635
|
/** @internal */ _activeRigs;
|
|
636
636
|
/** @internal */ _activeAnimations;
|
|
637
|
-
/**
|
|
638
|
-
* Callbacks driven by the same logical clock as the animations (see {@link update}).
|
|
639
|
-
*
|
|
640
|
-
* Used by higher-level constructs (e.g. timeline runners) that need to advance
|
|
641
|
-
* wall-clock-independent timers in sync with playback, so they pause/scale with the
|
|
642
|
-
* game clock instead of running on real time.
|
|
643
|
-
* @internal
|
|
637
|
+
/**
|
|
638
|
+
* Callbacks driven by the same logical clock as the animations (see {@link update}).
|
|
639
|
+
*
|
|
640
|
+
* Used by higher-level constructs (e.g. timeline runners) that need to advance
|
|
641
|
+
* wall-clock-independent timers in sync with playback, so they pause/scale with the
|
|
642
|
+
* game clock instead of running on real time.
|
|
643
|
+
* @internal
|
|
644
644
|
*/ _timelineTickers;
|
|
645
|
-
/**
|
|
646
|
-
* Create an AnimationSet controlling the provided model.
|
|
647
|
-
*
|
|
648
|
-
* @param model - The SceneNode (model root) controlled by this animation set.
|
|
645
|
+
/**
|
|
646
|
+
* Create an AnimationSet controlling the provided model.
|
|
647
|
+
*
|
|
648
|
+
* @param model - The SceneNode (model root) controlled by this animation set.
|
|
649
649
|
*/ constructor(model){
|
|
650
650
|
super();
|
|
651
651
|
this._model = model;
|
|
@@ -658,40 +658,40 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
658
658
|
this._rigs = [];
|
|
659
659
|
this._timelineTickers = new Set();
|
|
660
660
|
}
|
|
661
|
-
/**
|
|
662
|
-
* Register a callback advanced by {@link update} using the same delta time as the animations.
|
|
663
|
-
* @internal
|
|
661
|
+
/**
|
|
662
|
+
* Register a callback advanced by {@link update} using the same delta time as the animations.
|
|
663
|
+
* @internal
|
|
664
664
|
*/ _registerTimelineTicker(ticker) {
|
|
665
665
|
this._timelineTickers.add(ticker);
|
|
666
666
|
}
|
|
667
|
-
/**
|
|
668
|
-
* Unregister a callback previously registered with {@link _registerTimelineTicker}.
|
|
669
|
-
* @internal
|
|
667
|
+
/**
|
|
668
|
+
* Unregister a callback previously registered with {@link _registerTimelineTicker}.
|
|
669
|
+
* @internal
|
|
670
670
|
*/ _unregisterTimelineTicker(ticker) {
|
|
671
671
|
this._timelineTickers.delete(ticker);
|
|
672
672
|
}
|
|
673
|
-
/**
|
|
674
|
-
* The model (SceneNode) controlled by this animation set.
|
|
673
|
+
/**
|
|
674
|
+
* The model (SceneNode) controlled by this animation set.
|
|
675
675
|
*/ get model() {
|
|
676
676
|
return this._model;
|
|
677
677
|
}
|
|
678
|
-
/**
|
|
679
|
-
* Number of animation clips registered in this set.
|
|
678
|
+
/**
|
|
679
|
+
* Number of animation clips registered in this set.
|
|
680
680
|
*/ get numAnimations() {
|
|
681
681
|
return Object.getOwnPropertyNames(this._animations).length;
|
|
682
682
|
}
|
|
683
|
-
/**
|
|
684
|
-
* The skeletons used by animations in this set.
|
|
683
|
+
/**
|
|
684
|
+
* The skeletons used by animations in this set.
|
|
685
685
|
*/ get skeletons() {
|
|
686
686
|
return this._skeletons;
|
|
687
687
|
}
|
|
688
|
-
/**
|
|
689
|
-
* The shared rigs used by animations in this set.
|
|
688
|
+
/**
|
|
689
|
+
* The shared rigs used by animations in this set.
|
|
690
690
|
*/ get rigs() {
|
|
691
691
|
return this._rigs;
|
|
692
692
|
}
|
|
693
|
-
/**
|
|
694
|
-
* Per-skin bindings used by skinned meshes in this set.
|
|
693
|
+
/**
|
|
694
|
+
* Per-skin bindings used by skinned meshes in this set.
|
|
695
695
|
*/ get skinBindings() {
|
|
696
696
|
return this._skeletons;
|
|
697
697
|
}
|
|
@@ -713,20 +713,20 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
713
713
|
}
|
|
714
714
|
return rig;
|
|
715
715
|
}
|
|
716
|
-
/**
|
|
717
|
-
* Retrieve an animation clip by name.
|
|
718
|
-
*
|
|
719
|
-
* @param name - Name of the animation.
|
|
720
|
-
* @returns The clip if present; otherwise null.
|
|
716
|
+
/**
|
|
717
|
+
* Retrieve an animation clip by name.
|
|
718
|
+
*
|
|
719
|
+
* @param name - Name of the animation.
|
|
720
|
+
* @returns The clip if present; otherwise null.
|
|
721
721
|
*/ get(name) {
|
|
722
722
|
return this._animations[name] ?? null;
|
|
723
723
|
}
|
|
724
|
-
/**
|
|
725
|
-
* Create and register a new animation clip.
|
|
726
|
-
*
|
|
727
|
-
* @param name - Unique name for the animation clip.
|
|
728
|
-
* @param embedded - Whether the clip is embedded/owned (implementation-specific). Default false.
|
|
729
|
-
* @returns The created clip, or null if the name is empty or not unique.
|
|
724
|
+
/**
|
|
725
|
+
* Create and register a new animation clip.
|
|
726
|
+
*
|
|
727
|
+
* @param name - Unique name for the animation clip.
|
|
728
|
+
* @param embedded - Whether the clip is embedded/owned (implementation-specific). Default false.
|
|
729
|
+
* @returns The created clip, or null if the name is empty or not unique.
|
|
730
730
|
*/ createAnimation(name, embedded = false) {
|
|
731
731
|
if (!name || this._animations[name]) {
|
|
732
732
|
console.error('Animation must have unique name');
|
|
@@ -738,12 +738,12 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
738
738
|
return animation;
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
/**
|
|
742
|
-
* Delete and dispose an animation clip by name.
|
|
743
|
-
*
|
|
744
|
-
* - If the animation is currently playing, it is first stopped (immediately).
|
|
745
|
-
*
|
|
746
|
-
* @param name - Name of the animation to remove.
|
|
741
|
+
/**
|
|
742
|
+
* Delete and dispose an animation clip by name.
|
|
743
|
+
*
|
|
744
|
+
* - If the animation is currently playing, it is first stopped (immediately).
|
|
745
|
+
*
|
|
746
|
+
* @param name - Name of the animation to remove.
|
|
747
747
|
*/ deleteAnimation(name) {
|
|
748
748
|
const animation = this._animations[name];
|
|
749
749
|
if (animation) {
|
|
@@ -752,24 +752,24 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
752
752
|
animation.dispose();
|
|
753
753
|
}
|
|
754
754
|
}
|
|
755
|
-
/**
|
|
756
|
-
* Get the list of all registered animation names.
|
|
757
|
-
*
|
|
758
|
-
* @returns An array of clip names.
|
|
755
|
+
/**
|
|
756
|
+
* Get the list of all registered animation names.
|
|
757
|
+
*
|
|
758
|
+
* @returns An array of clip names.
|
|
759
759
|
*/ getAnimationNames() {
|
|
760
760
|
return Object.keys(this._animations);
|
|
761
761
|
}
|
|
762
|
-
/**
|
|
763
|
-
* Advance and apply active animations.
|
|
764
|
-
*
|
|
765
|
-
* Responsibilities per call:
|
|
766
|
-
* - Update time cursor for each active clip (respecting speedRatio and looping).
|
|
767
|
-
* - Enforce repeat limits and apply fade-out termination if configured.
|
|
768
|
-
* - For each animated target, blend active tracks (weighted by clip weight × fade-in × fade-out)
|
|
769
|
-
* and apply the resulting state to the target.
|
|
770
|
-
* - Apply shared rig modifiers once, then update skin binding palettes.
|
|
771
|
-
*
|
|
772
|
-
* @param deltaInSeconds - Time step in seconds since last update.
|
|
762
|
+
/**
|
|
763
|
+
* Advance and apply active animations.
|
|
764
|
+
*
|
|
765
|
+
* Responsibilities per call:
|
|
766
|
+
* - Update time cursor for each active clip (respecting speedRatio and looping).
|
|
767
|
+
* - Enforce repeat limits and apply fade-out termination if configured.
|
|
768
|
+
* - For each animated target, blend active tracks (weighted by clip weight × fade-in × fade-out)
|
|
769
|
+
* and apply the resulting state to the target.
|
|
770
|
+
* - Apply shared rig modifiers once, then update skin binding palettes.
|
|
771
|
+
*
|
|
772
|
+
* @param deltaInSeconds - Time step in seconds since last update.
|
|
773
773
|
*/ update(deltaInSeconds) {
|
|
774
774
|
this._activeAnimations.forEach((v, k)=>{
|
|
775
775
|
if (!v.started) {
|
|
@@ -910,11 +910,11 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
910
910
|
this._timelineTickers.forEach((ticker)=>ticker(deltaInSeconds));
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
|
-
/**
|
|
914
|
-
* Check whether an animation is currently playing.
|
|
915
|
-
*
|
|
916
|
-
* @param name - Optional animation name. If omitted, returns true if any animation is playing.
|
|
917
|
-
* @returns True if playing; otherwise false.
|
|
913
|
+
/**
|
|
914
|
+
* Check whether an animation is currently playing.
|
|
915
|
+
*
|
|
916
|
+
* @param name - Optional animation name. If omitted, returns true if any animation is playing.
|
|
917
|
+
* @returns True if playing; otherwise false.
|
|
918
918
|
*/ isPlayingAnimation(name) {
|
|
919
919
|
if (name) {
|
|
920
920
|
const animation = this._animations[name];
|
|
@@ -922,23 +922,23 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
922
922
|
}
|
|
923
923
|
return this._activeAnimations.size > 0;
|
|
924
924
|
}
|
|
925
|
-
/**
|
|
926
|
-
* Get an animation clip by name.
|
|
927
|
-
*
|
|
928
|
-
* Alias of `get(name)` returning a nullable type.
|
|
929
|
-
*
|
|
930
|
-
* @param name - Name of the animation.
|
|
931
|
-
* @returns The clip if present; otherwise null.
|
|
925
|
+
/**
|
|
926
|
+
* Get an animation clip by name.
|
|
927
|
+
*
|
|
928
|
+
* Alias of `get(name)` returning a nullable type.
|
|
929
|
+
*
|
|
930
|
+
* @param name - Name of the animation.
|
|
931
|
+
* @returns The clip if present; otherwise null.
|
|
932
932
|
*/ getAnimationClip(name) {
|
|
933
933
|
return this._animations[name] ?? null;
|
|
934
934
|
}
|
|
935
|
-
/**
|
|
936
|
-
* Set the runtime blend weight for a currently playing animation.
|
|
937
|
-
*
|
|
938
|
-
* Has no effect if the clip is not active.
|
|
939
|
-
*
|
|
940
|
-
* @param name - Name of the playing animation.
|
|
941
|
-
* @param weight - New weight value used during blending.
|
|
935
|
+
/**
|
|
936
|
+
* Set the runtime blend weight for a currently playing animation.
|
|
937
|
+
*
|
|
938
|
+
* Has no effect if the clip is not active.
|
|
939
|
+
*
|
|
940
|
+
* @param name - Name of the playing animation.
|
|
941
|
+
* @param weight - New weight value used during blending.
|
|
942
942
|
*/ setAnimationWeight(name, weight) {
|
|
943
943
|
const ani = this._animations[name];
|
|
944
944
|
if (!ani) {
|
|
@@ -952,8 +952,8 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
952
952
|
info.playback._setWeight(weight);
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
|
-
/**
|
|
956
|
-
* Create a playback handle without starting it.
|
|
955
|
+
/**
|
|
956
|
+
* Create a playback handle without starting it.
|
|
957
957
|
*/ createPlayback(name, options) {
|
|
958
958
|
const ani = this._animations[name];
|
|
959
959
|
if (!ani) {
|
|
@@ -962,15 +962,15 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
962
962
|
}
|
|
963
963
|
return new AnimationPlayback(this, ani, options);
|
|
964
964
|
}
|
|
965
|
-
/**
|
|
966
|
-
* Start an animation and return its playback handle.
|
|
965
|
+
/**
|
|
966
|
+
* Start an animation and return its playback handle.
|
|
967
967
|
*/ play(name, options) {
|
|
968
968
|
const playback = this.createPlayback(name, options);
|
|
969
969
|
playback?.play();
|
|
970
970
|
return playback;
|
|
971
971
|
}
|
|
972
|
-
/**
|
|
973
|
-
* Get currently active playbacks.
|
|
972
|
+
/**
|
|
973
|
+
* Get currently active playbacks.
|
|
974
974
|
*/ getPlaybacks(name) {
|
|
975
975
|
const playbacks = [];
|
|
976
976
|
this._activeAnimations.forEach((info, clip)=>{
|
|
@@ -980,28 +980,28 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
980
980
|
});
|
|
981
981
|
return playbacks;
|
|
982
982
|
}
|
|
983
|
-
/**
|
|
984
|
-
* Get the currently active playback for a clip.
|
|
983
|
+
/**
|
|
984
|
+
* Get the currently active playback for a clip.
|
|
985
985
|
*/ getPlayback(name) {
|
|
986
986
|
const clip = this._animations[name];
|
|
987
987
|
return clip ? this._activeAnimations.get(clip)?.playback ?? null : null;
|
|
988
988
|
}
|
|
989
|
-
/**
|
|
990
|
-
* Start (or update) playback of an animation clip.
|
|
991
|
-
*
|
|
992
|
-
* Behavior:
|
|
993
|
-
* - If the clip is already playing, stops it first.
|
|
994
|
-
* - Otherwise initializes playback state (repeat counter, speed, weight, initial time).
|
|
995
|
-
* - Registers clip tracks and skeletons into the active sets for blending and application.
|
|
996
|
-
*
|
|
997
|
-
* @param name - Name of the animation to play.
|
|
998
|
-
* @param options - Playback options (repeat, speedRatio, fadeIn).
|
|
989
|
+
/**
|
|
990
|
+
* Start (or update) playback of an animation clip.
|
|
991
|
+
*
|
|
992
|
+
* Behavior:
|
|
993
|
+
* - If the clip is already playing, stops it first.
|
|
994
|
+
* - Otherwise initializes playback state (repeat counter, speed, weight, initial time).
|
|
995
|
+
* - Registers clip tracks and skeletons into the active sets for blending and application.
|
|
996
|
+
*
|
|
997
|
+
* @param name - Name of the animation to play.
|
|
998
|
+
* @param options - Playback options (repeat, speedRatio, fadeIn).
|
|
999
999
|
*/ playAnimation(name, options) {
|
|
1000
1000
|
this.play(name, options);
|
|
1001
1001
|
}
|
|
1002
|
-
/**
|
|
1003
|
-
* Start a previously created playback.
|
|
1004
|
-
* @internal
|
|
1002
|
+
/**
|
|
1003
|
+
* Start a previously created playback.
|
|
1004
|
+
* @internal
|
|
1005
1005
|
*/ startPlayback(playback) {
|
|
1006
1006
|
const ani = playback.clip;
|
|
1007
1007
|
if (!ani) {
|
|
@@ -1156,17 +1156,17 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1156
1156
|
const offset = ((time - range.start) % range.duration + range.duration) % range.duration;
|
|
1157
1157
|
return range.start + offset;
|
|
1158
1158
|
}
|
|
1159
|
-
/**
|
|
1160
|
-
* Stop a playback handle.
|
|
1161
|
-
* @internal
|
|
1159
|
+
/**
|
|
1160
|
+
* Stop a playback handle.
|
|
1161
|
+
* @internal
|
|
1162
1162
|
*/ stopPlayback(playback, options) {
|
|
1163
1163
|
if (this._activeAnimations.get(playback.clip)?.playback === playback) {
|
|
1164
1164
|
this.stopAnimation(playback.clip.name, options);
|
|
1165
1165
|
}
|
|
1166
1166
|
}
|
|
1167
|
-
/**
|
|
1168
|
-
* Pause a playback handle.
|
|
1169
|
-
* @internal
|
|
1167
|
+
/**
|
|
1168
|
+
* Pause a playback handle.
|
|
1169
|
+
* @internal
|
|
1170
1170
|
*/ pausePlayback(playback) {
|
|
1171
1171
|
const info = this._activeAnimations.get(playback.clip);
|
|
1172
1172
|
if (info?.playback === playback && !info.paused) {
|
|
@@ -1177,9 +1177,9 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1177
1177
|
this.dispatchEvent('playbackpause', event);
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
|
-
/**
|
|
1181
|
-
* Resume a playback handle.
|
|
1182
|
-
* @internal
|
|
1180
|
+
/**
|
|
1181
|
+
* Resume a playback handle.
|
|
1182
|
+
* @internal
|
|
1183
1183
|
*/ resumePlayback(playback) {
|
|
1184
1184
|
const info = this._activeAnimations.get(playback.clip);
|
|
1185
1185
|
if (info?.playback === playback && info.paused) {
|
|
@@ -1190,9 +1190,9 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1190
1190
|
this.dispatchEvent('playbackresume', event);
|
|
1191
1191
|
}
|
|
1192
1192
|
}
|
|
1193
|
-
/**
|
|
1194
|
-
* Seek a playback handle.
|
|
1195
|
-
* @internal
|
|
1193
|
+
/**
|
|
1194
|
+
* Seek a playback handle.
|
|
1195
|
+
* @internal
|
|
1196
1196
|
*/ seekPlayback(playback, time, options) {
|
|
1197
1197
|
const clip = playback.clip;
|
|
1198
1198
|
const info = this._activeAnimations.get(clip);
|
|
@@ -1212,9 +1212,9 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1212
1212
|
}
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
-
/**
|
|
1216
|
-
* Set playback weight.
|
|
1217
|
-
* @internal
|
|
1215
|
+
/**
|
|
1216
|
+
* Set playback weight.
|
|
1217
|
+
* @internal
|
|
1218
1218
|
*/ setPlaybackWeight(playback, weight) {
|
|
1219
1219
|
playback._setWeight(weight);
|
|
1220
1220
|
const info = this._activeAnimations.get(playback.clip);
|
|
@@ -1223,9 +1223,9 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1223
1223
|
info.targetWeight = weight;
|
|
1224
1224
|
}
|
|
1225
1225
|
}
|
|
1226
|
-
/**
|
|
1227
|
-
* Set playback speed ratio.
|
|
1228
|
-
* @internal
|
|
1226
|
+
/**
|
|
1227
|
+
* Set playback speed ratio.
|
|
1228
|
+
* @internal
|
|
1229
1229
|
*/ setPlaybackSpeedRatio(playback, speedRatio) {
|
|
1230
1230
|
playback._setSpeedRatio(speedRatio);
|
|
1231
1231
|
const info = this._activeAnimations.get(playback.clip);
|
|
@@ -1233,9 +1233,9 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1233
1233
|
info.speedRatio = speedRatio;
|
|
1234
1234
|
}
|
|
1235
1235
|
}
|
|
1236
|
-
/**
|
|
1237
|
-
* Fade playback weight to a target value.
|
|
1238
|
-
* @internal
|
|
1236
|
+
/**
|
|
1237
|
+
* Fade playback weight to a target value.
|
|
1238
|
+
* @internal
|
|
1239
1239
|
*/ fadePlaybackTo(playback, weight, duration) {
|
|
1240
1240
|
const info = this._activeAnimations.get(playback.clip);
|
|
1241
1241
|
if (info?.playback === playback) {
|
|
@@ -1321,18 +1321,18 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1321
1321
|
crossedBackward(fromTime, toTime, targetTime, duration) {
|
|
1322
1322
|
return toTime <= fromTime ? targetTime < fromTime && targetTime >= toTime : duration > 0 && targetTime < fromTime && targetTime >= 0 || targetTime >= toTime;
|
|
1323
1323
|
}
|
|
1324
|
-
/**
|
|
1325
|
-
* Stop playback of an animation clip.
|
|
1326
|
-
*
|
|
1327
|
-
* Behavior:
|
|
1328
|
-
* - If `options.fadeOut > 0`, marks the clip for fade-out; actual removal occurs after fade completes.
|
|
1329
|
-
* - If `fadeOut` is 0 or omitted, immediately:
|
|
1330
|
-
* - Removes the clip from active animations.
|
|
1331
|
-
* - Unregisters its tracks from active track maps.
|
|
1332
|
-
* - Decrements skeleton reference counts; resets and removes skeletons when refcount reaches 0.
|
|
1333
|
-
*
|
|
1334
|
-
* @param name - Name of the animation to stop.
|
|
1335
|
-
* @param options - Optional fade-out configuration.
|
|
1324
|
+
/**
|
|
1325
|
+
* Stop playback of an animation clip.
|
|
1326
|
+
*
|
|
1327
|
+
* Behavior:
|
|
1328
|
+
* - If `options.fadeOut > 0`, marks the clip for fade-out; actual removal occurs after fade completes.
|
|
1329
|
+
* - If `fadeOut` is 0 or omitted, immediately:
|
|
1330
|
+
* - Removes the clip from active animations.
|
|
1331
|
+
* - Unregisters its tracks from active track maps.
|
|
1332
|
+
* - Decrements skeleton reference counts; resets and removes skeletons when refcount reaches 0.
|
|
1333
|
+
*
|
|
1334
|
+
* @param name - Name of the animation to stop.
|
|
1335
|
+
* @param options - Optional fade-out configuration.
|
|
1336
1336
|
*/ stopAnimation(name, options) {
|
|
1337
1337
|
const ani = this._animations[name];
|
|
1338
1338
|
if (!ani) {
|
|
@@ -1397,17 +1397,17 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1397
1397
|
}
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
|
-
/**
|
|
1401
|
-
* Create a skeletal-only masked clip from an existing clip in this set.
|
|
1402
|
-
*
|
|
1403
|
-
* The generated clip is a regular `AnimationClip`: it contains cloned node transform tracks
|
|
1404
|
-
* for the selected rig joints and can be played/blended through the normal animation system.
|
|
1405
|
-
* Non-skeletal tracks are skipped by default.
|
|
1406
|
-
*
|
|
1407
|
-
* @param sourceName - Name of the source clip.
|
|
1408
|
-
* @param targetName - Name of the generated clip.
|
|
1409
|
-
* @param options - Humanoid semantic or joint-name based mask options.
|
|
1410
|
-
* @returns The generated clip, or null on failure.
|
|
1400
|
+
/**
|
|
1401
|
+
* Create a skeletal-only masked clip from an existing clip in this set.
|
|
1402
|
+
*
|
|
1403
|
+
* The generated clip is a regular `AnimationClip`: it contains cloned node transform tracks
|
|
1404
|
+
* for the selected rig joints and can be played/blended through the normal animation system.
|
|
1405
|
+
* Non-skeletal tracks are skipped by default.
|
|
1406
|
+
*
|
|
1407
|
+
* @param sourceName - Name of the source clip.
|
|
1408
|
+
* @param targetName - Name of the generated clip.
|
|
1409
|
+
* @param options - Humanoid semantic or joint-name based mask options.
|
|
1410
|
+
* @returns The generated clip, or null on failure.
|
|
1411
1411
|
*/ createSkeletalMaskedAnimation(sourceName, targetName, options) {
|
|
1412
1412
|
const sourceClip = this.get(sourceName);
|
|
1413
1413
|
if (!sourceClip) {
|
|
@@ -1614,21 +1614,21 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1614
1614
|
}
|
|
1615
1615
|
return dstClip;
|
|
1616
1616
|
}
|
|
1617
|
-
/**
|
|
1618
|
-
* Copy an animation clip from another AnimationSet into this one.
|
|
1619
|
-
*
|
|
1620
|
-
* Prerequisites:
|
|
1621
|
-
* - Both sets must reference skeletons with identical joint names and counts.
|
|
1622
|
-
* - The source clip must exist in `sourceSet`.
|
|
1623
|
-
*
|
|
1624
|
-
* @param sourceSet - The AnimationSet to copy from.
|
|
1625
|
-
* @param animationName - Name of the clip to copy.
|
|
1626
|
-
* @param targetName - Name for the new clip in this set. Defaults to `animationName`.
|
|
1627
|
-
* @param excludeJoint - Optional predicate; joints whose name returns true are excluded from
|
|
1628
|
-
* skeleton structure matching.
|
|
1629
|
-
* @returns The newly created AnimationClip, or null on failure.
|
|
1630
|
-
*
|
|
1631
|
-
* @deprecated Use AnimationSet.copyHumanoidAnimationFrom instead.
|
|
1617
|
+
/**
|
|
1618
|
+
* Copy an animation clip from another AnimationSet into this one.
|
|
1619
|
+
*
|
|
1620
|
+
* Prerequisites:
|
|
1621
|
+
* - Both sets must reference skeletons with identical joint names and counts.
|
|
1622
|
+
* - The source clip must exist in `sourceSet`.
|
|
1623
|
+
*
|
|
1624
|
+
* @param sourceSet - The AnimationSet to copy from.
|
|
1625
|
+
* @param animationName - Name of the clip to copy.
|
|
1626
|
+
* @param targetName - Name for the new clip in this set. Defaults to `animationName`.
|
|
1627
|
+
* @param excludeJoint - Optional predicate; joints whose name returns true are excluded from
|
|
1628
|
+
* skeleton structure matching.
|
|
1629
|
+
* @returns The newly created AnimationClip, or null on failure.
|
|
1630
|
+
*
|
|
1631
|
+
* @deprecated Use AnimationSet.copyHumanoidAnimationFrom instead.
|
|
1632
1632
|
*/ copyAnimationFrom(sourceSet, animationName, targetName, excludeJoint) {
|
|
1633
1633
|
const destName = targetName ?? animationName;
|
|
1634
1634
|
const sourceClip = sourceSet.get(animationName);
|
|
@@ -1774,8 +1774,8 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1774
1774
|
return ordered;
|
|
1775
1775
|
}
|
|
1776
1776
|
}
|
|
1777
|
-
/**
|
|
1778
|
-
* Reset all skeleton modifiers
|
|
1777
|
+
/**
|
|
1778
|
+
* Reset all skeleton modifiers
|
|
1779
1779
|
*/ resetSkeletonModifiers() {
|
|
1780
1780
|
for (const sk of this._skeletons){
|
|
1781
1781
|
for (const modifier of sk.get().modifiers){
|
|
@@ -1783,12 +1783,12 @@ function bakeHumanoidRotationTracks(sourceClip, srcSkeleton, dstSkeleton, srcRoo
|
|
|
1783
1783
|
}
|
|
1784
1784
|
}
|
|
1785
1785
|
}
|
|
1786
|
-
/**
|
|
1787
|
-
* Dispose the animation set and release owned resources.
|
|
1788
|
-
*
|
|
1789
|
-
* - Disposes the weak reference to the model.
|
|
1790
|
-
* - Disposes all registered animation clips.
|
|
1791
|
-
* - Clears active animations, tracks, and skeleton references.
|
|
1786
|
+
/**
|
|
1787
|
+
* Dispose the animation set and release owned resources.
|
|
1788
|
+
*
|
|
1789
|
+
* - Disposes the weak reference to the model.
|
|
1790
|
+
* - Disposes all registered animation clips.
|
|
1791
|
+
* - Clears active animations, tracks, and skeleton references.
|
|
1792
1792
|
*/ onDispose() {
|
|
1793
1793
|
super.onDispose();
|
|
1794
1794
|
for(const k in this._animations){
|