@quenty/animations 1.2.1-canary.405.6fa018e.0 → 1.3.1-canary.407.46d4d39.0
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
CHANGED
|
@@ -3,12 +3,32 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [1.
|
|
6
|
+
## [1.3.1-canary.407.46d4d39.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/animations@1.3.0...@quenty/animations@1.3.1-canary.407.46d4d39.0) (2023-09-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Add versions to package ([104323f](https://github.com/Quenty/NevermoreEngine/commit/104323fb7f53b866282b2cdef9bf8a849cfb308c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [1.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/animations@1.2.0...@quenty/animations@1.3.0) (2023-08-23)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* Add missing dependency ([42ac596](https://github.com/Quenty/NevermoreEngine/commit/42ac5964e2154311070278732bf61b2b6b6982ce))
|
|
23
|
+
* Rename HoarcekatRigAnimator ([87ff244](https://github.com/Quenty/NevermoreEngine/commit/87ff244c1ef964a496fd71c08e9a4f3fb195a2b7))
|
|
24
|
+
* Track weight will only adjust if we get a track ([e885fce](https://github.com/Quenty/NevermoreEngine/commit/e885fced59555520dce0ed0a21f95157ba45f14d))
|
|
7
25
|
|
|
8
26
|
|
|
9
27
|
### Features
|
|
10
28
|
|
|
11
29
|
* Add AnimationSlotPlayer.new(animationTarget) ([86f1e99](https://github.com/Quenty/NevermoreEngine/commit/86f1e9989d4c52b136078a9c4c34c205e2e88549))
|
|
30
|
+
* Add AnimationTrackPlayer.new(animationTarget, animationId) ([7b254c2](https://github.com/Quenty/NevermoreEngine/commit/7b254c2870b8ed930c33081df84944925702d10a))
|
|
31
|
+
* Add studio rig animator ([9a6578b](https://github.com/Quenty/NevermoreEngine/commit/9a6578bfd712728b179ce40096f1ee7c581c112f))
|
|
12
32
|
|
|
13
33
|
|
|
14
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/animations",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1-canary.407.46d4d39.0",
|
|
4
4
|
"description": "Utility methods for playing back animations on Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,17 +25,20 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/baseobject": "6.
|
|
28
|
+
"@quenty/baseobject": "6.3.0",
|
|
29
29
|
"@quenty/enumutils": "3.1.0",
|
|
30
30
|
"@quenty/humanoidanimatorutils": "2.2.0",
|
|
31
|
-
"@quenty/loader": "6.
|
|
32
|
-
"@quenty/maid": "2.
|
|
33
|
-
"@quenty/
|
|
34
|
-
"@quenty/
|
|
35
|
-
"@quenty/
|
|
31
|
+
"@quenty/loader": "6.3.0",
|
|
32
|
+
"@quenty/maid": "2.6.0",
|
|
33
|
+
"@quenty/promise": "6.8.0",
|
|
34
|
+
"@quenty/promisemaid": "1.3.0",
|
|
35
|
+
"@quenty/rbxasset": "1.2.0",
|
|
36
|
+
"@quenty/rx": "7.15.0",
|
|
37
|
+
"@quenty/signal": "2.4.0",
|
|
38
|
+
"@quenty/valueobject": "7.22.1-canary.407.46d4d39.0"
|
|
36
39
|
},
|
|
37
40
|
"publishConfig": {
|
|
38
41
|
"access": "public"
|
|
39
42
|
},
|
|
40
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "46d4d393561a0f2e77eaac99453d043bf6475b16"
|
|
41
44
|
}
|
|
@@ -65,9 +65,13 @@ function AnimationSlotPlayer:Play(id, fadeTime, weight, speed, priority)
|
|
|
65
65
|
local maid = brio:ToMaid()
|
|
66
66
|
|
|
67
67
|
local track = AnimationUtils.playAnimation(animationTarget, id, fadeTime, weight, speed, priority)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
if track then
|
|
69
|
+
maid:GiveTask(function()
|
|
70
|
+
track:AdjustWeight(0, fadeTime or self._defaultFadeTime.Value)
|
|
71
|
+
end)
|
|
72
|
+
else
|
|
73
|
+
warn("[AnimationSlotPlayer] - Failed to get animation to play")
|
|
74
|
+
end
|
|
71
75
|
end))
|
|
72
76
|
|
|
73
77
|
self._maid._current = topMaid
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class AnimationTrackPlayer
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local BaseObject = require("BaseObject")
|
|
8
|
+
local ValueObject = require("ValueObject")
|
|
9
|
+
local Rx = require("Rx")
|
|
10
|
+
local AnimationUtils = require("AnimationUtils")
|
|
11
|
+
local Signal = require("Signal")
|
|
12
|
+
|
|
13
|
+
local AnimationTrackPlayer = setmetatable({}, BaseObject)
|
|
14
|
+
AnimationTrackPlayer.ClassName = "AnimationTrackPlayer"
|
|
15
|
+
AnimationTrackPlayer.__index = AnimationTrackPlayer
|
|
16
|
+
|
|
17
|
+
function AnimationTrackPlayer.new(animationTarget, animationId)
|
|
18
|
+
local self = setmetatable(BaseObject.new(), AnimationTrackPlayer)
|
|
19
|
+
|
|
20
|
+
self._animationTarget = ValueObject.new(nil)
|
|
21
|
+
self._maid:GiveTask(self._animationTarget)
|
|
22
|
+
|
|
23
|
+
self._trackId = ValueObject.new(nil)
|
|
24
|
+
self._maid:GiveTask(self._trackId)
|
|
25
|
+
|
|
26
|
+
self._currentTrack = ValueObject.new(nil)
|
|
27
|
+
self._maid:GiveTask(self._currentTrack)
|
|
28
|
+
|
|
29
|
+
self.KeyframeReached = Signal.new()
|
|
30
|
+
self._maid:GiveTask(self.KeyframeReached)
|
|
31
|
+
|
|
32
|
+
self._animationPriority = ValueObject.new(nil)
|
|
33
|
+
self._maid:GiveTask(self._animationPriority)
|
|
34
|
+
|
|
35
|
+
if animationTarget then
|
|
36
|
+
self:SetAnimationTarget(animationTarget)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
if animationId then
|
|
40
|
+
self:SetAnimationId(animationId)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
self:_setupState()
|
|
44
|
+
|
|
45
|
+
return self
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
function AnimationTrackPlayer:_setupState()
|
|
49
|
+
self._maid:GiveTask(Rx.combineLatest({
|
|
50
|
+
animationTarget = self._animationTarget:Observe();
|
|
51
|
+
trackId = self._trackId:Observe();
|
|
52
|
+
animationPriority = self._animationPriority:Observe();
|
|
53
|
+
}):Pipe({
|
|
54
|
+
Rx.throttleDefer();
|
|
55
|
+
}):Subscribe(function(state)
|
|
56
|
+
if state.animationTarget and state.trackId then
|
|
57
|
+
self._currentTrack.Value = AnimationUtils.getOrCreateAnimationTrack(state.animationTarget, state.trackId, state.animationPriority)
|
|
58
|
+
else
|
|
59
|
+
self._currentTrack.Value = nil
|
|
60
|
+
end
|
|
61
|
+
end))
|
|
62
|
+
|
|
63
|
+
self._maid:GiveTask(self._currentTrack:ObserveBrio(function(track)
|
|
64
|
+
return track ~= nil
|
|
65
|
+
end):Subscribe(function(brio)
|
|
66
|
+
if brio:IsDead() then
|
|
67
|
+
return
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
local maid = brio:ToMaid()
|
|
71
|
+
local track = brio:GetValue()
|
|
72
|
+
|
|
73
|
+
maid:GiveTask(track.KeyframeReached:Connect(function(...)
|
|
74
|
+
self.KeyframeReached:Fire(...)
|
|
75
|
+
end))
|
|
76
|
+
end))
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
function AnimationTrackPlayer:SetAnimationId(animationId)
|
|
80
|
+
return self._trackId:Mount(animationId)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
function AnimationTrackPlayer:GetAnimationId()
|
|
84
|
+
return self._trackId.Value
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
function AnimationTrackPlayer:SetAnimationTarget(animationTarget)
|
|
88
|
+
return self._animationTarget:Mount(animationTarget)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
function AnimationTrackPlayer:SetWeightTargetIfNotSet(weight, fadeTime)
|
|
92
|
+
self._maid._adjustWeight = self:_onEachTrack(function(_maid, track)
|
|
93
|
+
if track.WeightTarget ~= weight then
|
|
94
|
+
track:AdjustWeight(weight, fadeTime)
|
|
95
|
+
end
|
|
96
|
+
end)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
function AnimationTrackPlayer:Play(fadeTime, weight, speed)
|
|
100
|
+
if weight then
|
|
101
|
+
self._maid._adjustWeight = nil
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if speed then
|
|
105
|
+
self._maid._adjustSpeed = nil
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
self._maid._stop = nil
|
|
109
|
+
self._maid._play = self:_onEachTrack(function(_maid, track)
|
|
110
|
+
track:Play(fadeTime, weight, speed)
|
|
111
|
+
end)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
function AnimationTrackPlayer:Stop(fadeTime)
|
|
115
|
+
self._maid._play = nil
|
|
116
|
+
self._maid._stop = self:_onEachTrack(function(_maid, track)
|
|
117
|
+
track:Stop(fadeTime)
|
|
118
|
+
end)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
function AnimationTrackPlayer:AdjustWeight(weight, fadeTime)
|
|
122
|
+
self._maid._adjustWeight = self:_onEachTrack(function(_maid, track)
|
|
123
|
+
track:AdjustWeight(weight, fadeTime)
|
|
124
|
+
end)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
function AnimationTrackPlayer:AdjustSpeed(speed, fadeTime)
|
|
128
|
+
self._maid._adjustSpeed = self:_onEachTrack(function(_maid, track)
|
|
129
|
+
track:AdjustSpeed(speed, fadeTime)
|
|
130
|
+
end)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
function AnimationTrackPlayer:IsPlaying()
|
|
134
|
+
local track = self._currentTrack.Value
|
|
135
|
+
if track then
|
|
136
|
+
return track.IsPlaying
|
|
137
|
+
else
|
|
138
|
+
return false
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
function AnimationTrackPlayer:_onEachTrack(callback)
|
|
143
|
+
return self._currentTrack:ObserveBrio(function(track)
|
|
144
|
+
return track ~= nil
|
|
145
|
+
end):Subscribe(function(brio)
|
|
146
|
+
if brio:IsDead() then
|
|
147
|
+
return
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
local track = brio:GetValue()
|
|
151
|
+
callback(brio:ToMaid(), track)
|
|
152
|
+
end)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
return AnimationTrackPlayer
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
Ship to run animations in hoarcekat
|
|
3
|
+
|
|
4
|
+
@class StudioRigAnimator
|
|
5
|
+
]=]
|
|
6
|
+
|
|
7
|
+
local require = require(script.Parent.loader).load(script)
|
|
8
|
+
|
|
9
|
+
local RunService = game:GetService("RunService")
|
|
10
|
+
|
|
11
|
+
local BaseObject = require("BaseObject")
|
|
12
|
+
local AnimationUtils = require("AnimationUtils")
|
|
13
|
+
|
|
14
|
+
local StudioRigAnimator = setmetatable({}, BaseObject)
|
|
15
|
+
StudioRigAnimator.ClassName = "StudioRigAnimator"
|
|
16
|
+
StudioRigAnimator.__index = StudioRigAnimator
|
|
17
|
+
|
|
18
|
+
function StudioRigAnimator.new(animatorOrHumanoid)
|
|
19
|
+
local self = setmetatable(BaseObject.new(animatorOrHumanoid), StudioRigAnimator)
|
|
20
|
+
|
|
21
|
+
if RunService:IsStudio() and not RunService:IsRunning() then
|
|
22
|
+
self:_setupStudio()
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
return self
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
function StudioRigAnimator:_setupStudio()
|
|
29
|
+
self._animator = AnimationUtils.getOrCreateAnimator(self._obj)
|
|
30
|
+
self._lastTime = os.clock()
|
|
31
|
+
|
|
32
|
+
self._maid:GiveTask(RunService.RenderStepped:Connect(function()
|
|
33
|
+
local now = os.clock()
|
|
34
|
+
local delta = now - self._lastTime
|
|
35
|
+
self._lastTime = now
|
|
36
|
+
|
|
37
|
+
self._animator:StepAnimations(delta)
|
|
38
|
+
end))
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
return StudioRigAnimator
|