mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[lua] Fixed AnimationState not respecting MixBlend.first for rotate timelines. See #1274.
This commit is contained in:
parent
fd51eee47f
commit
72094511e3
@ -475,12 +475,24 @@ function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, bl
|
||||
local rotateTimeline = timeline
|
||||
local frames = rotateTimeline.frames
|
||||
local bone = skeleton.bones[rotateTimeline.boneIndex]
|
||||
local r1 = 0
|
||||
local r2 = 0
|
||||
if time < frames[0] then
|
||||
if blend == MixBlend.setup then bone.rotation = bone.data.rotation end
|
||||
if blend == MixBlend.setup then
|
||||
bone.rotation = bone.data.rotation
|
||||
return
|
||||
elseif blend == MixBlend.first then
|
||||
r1 = bone.rotation
|
||||
r2 = bone.data.rotation
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
local r2 = 0
|
||||
else
|
||||
if blend == MixBlend.setup then
|
||||
r1 = bone.data.rotation
|
||||
else
|
||||
r1 = bone.rotation
|
||||
end
|
||||
if time >= frames[zlen(frames) - Animation.RotateTimeline.ENTRIES] then -- Time is after last frame.
|
||||
r2 = bone.data.rotation + frames[zlen(frames) + Animation.RotateTimeline.PREV_ROTATION]
|
||||
else
|
||||
@ -496,10 +508,9 @@ function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, bl
|
||||
r2 = prevRotation + r2 * percent + bone.data.rotation
|
||||
r2 = r2 - (16384 - math_floor(16384.499999999996 - r2 / 360)) * 360
|
||||
end
|
||||
end
|
||||
|
||||
-- Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
|
||||
local r1 = bone.rotation
|
||||
if blend == MixBlend.setup then r1 = bone.data.rotation end
|
||||
local total = 0
|
||||
local diff = r2 - r1
|
||||
diff = diff - (16384 - math_floor(16384.499999999996 - diff / 360)) * 360
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user