mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge branch '3.7-beta' into 3.7-beta-cpp
This commit is contained in:
commit
0fafe7d1a0
@ -1205,9 +1205,7 @@ namespace Spine {
|
|||||||
|
|
||||||
int[] drawOrderToSetupIndex = drawOrders[frame];
|
int[] drawOrderToSetupIndex = drawOrders[frame];
|
||||||
if (drawOrderToSetupIndex == null) {
|
if (drawOrderToSetupIndex == null) {
|
||||||
drawOrder.Clear();
|
Array.Copy(slots.Items, 0, drawOrder.Items, 0, slots.Count);
|
||||||
for (int i = 0, n = slots.Count; i < n; i++)
|
|
||||||
drawOrder.Add(slots.Items[i]);
|
|
||||||
} else {
|
} else {
|
||||||
var drawOrderItems = drawOrder.Items;
|
var drawOrderItems = drawOrder.Items;
|
||||||
var slotsItems = slots.Items;
|
var slotsItems = slots.Items;
|
||||||
|
|||||||
@ -254,6 +254,7 @@ namespace Spine {
|
|||||||
from.totalAlpha = 0;
|
from.totalAlpha = 0;
|
||||||
for (int i = 0; i < timelineCount; i++) {
|
for (int i = 0; i < timelineCount; i++) {
|
||||||
Timeline timeline = timelinesItems[i];
|
Timeline timeline = timelinesItems[i];
|
||||||
|
MixDirection direction = MixDirection.Out;
|
||||||
MixBlend timelineBlend;
|
MixBlend timelineBlend;
|
||||||
float alpha;
|
float alpha;
|
||||||
switch (timelineMode[i]) {
|
switch (timelineMode[i]) {
|
||||||
@ -283,7 +284,17 @@ namespace Spine {
|
|||||||
if (rotateTimeline != null) {
|
if (rotateTimeline != null) {
|
||||||
ApplyRotateTimeline(rotateTimeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
|
ApplyRotateTimeline(rotateTimeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
|
||||||
} else {
|
} else {
|
||||||
timeline.Apply(skeleton, animationLast, animationTime, eventBuffer, alpha, timelineBlend, MixDirection.Out);
|
if (timelineBlend == MixBlend.Setup) {
|
||||||
|
if (timeline is AttachmentTimeline) {
|
||||||
|
if (attachments) direction = MixDirection.In;
|
||||||
|
} else if (timeline is DrawOrderTimeline) {
|
||||||
|
if (drawOrder) {
|
||||||
|
direction = MixDirection.In;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
timeline.Apply(skeleton, animationLast, animationTime, eventBuffer, alpha, timelineBlend, direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -280,6 +280,7 @@ public class AnimationState {
|
|||||||
from.totalAlpha = 0;
|
from.totalAlpha = 0;
|
||||||
for (int i = 0; i < timelineCount; i++) {
|
for (int i = 0; i < timelineCount; i++) {
|
||||||
Timeline timeline = (Timeline)timelines[i];
|
Timeline timeline = (Timeline)timelines[i];
|
||||||
|
MixDirection direction = MixDirection.out;
|
||||||
MixBlend timelineBlend;
|
MixBlend timelineBlend;
|
||||||
float alpha;
|
float alpha;
|
||||||
switch (timelineMode[i]) {
|
switch (timelineMode[i]) {
|
||||||
@ -307,8 +308,16 @@ public class AnimationState {
|
|||||||
if (timeline instanceof RotateTimeline) {
|
if (timeline instanceof RotateTimeline) {
|
||||||
applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1,
|
applyRotateTimeline(timeline, skeleton, animationTime, alpha, timelineBlend, timelinesRotation, i << 1,
|
||||||
firstFrame);
|
firstFrame);
|
||||||
} else
|
} else {
|
||||||
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, MixDirection.out);
|
if (timelineBlend == MixBlend.setup) {
|
||||||
|
if (timeline instanceof AttachmentTimeline) {
|
||||||
|
if (attachments) direction = MixDirection.in;
|
||||||
|
} else if (timeline instanceof DrawOrderTimeline) {
|
||||||
|
if (drawOrder) direction = MixDirection.in;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
timeline.apply(skeleton, animationLast, animationTime, events, alpha, timelineBlend, direction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -340,7 +340,7 @@ public class SkeletonViewer extends ApplicationAdapter {
|
|||||||
if (state != null) {
|
if (state != null) {
|
||||||
// AnimationState status.
|
// AnimationState status.
|
||||||
status.setLength(0);
|
status.setLength(0);
|
||||||
for (int i = 0, n = state.getTracks().size; i < n; i++) {
|
for (int i = state.getTracks().size - 1; i >= 0; i--) {
|
||||||
TrackEntry entry = state.getTracks().get(i);
|
TrackEntry entry = state.getTracks().get(i);
|
||||||
if (entry == null) continue;
|
if (entry == null) continue;
|
||||||
status.append(i);
|
status.append(i);
|
||||||
|
|||||||
@ -151,7 +151,7 @@ namespace Spine.Unity {
|
|||||||
ClearClipInfosForLayers();
|
ClearClipInfosForLayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Apply(Skeleton skeleton) {
|
public void Apply (Skeleton skeleton) {
|
||||||
if (layerMixModes.Length < animator.layerCount)
|
if (layerMixModes.Length < animator.layerCount)
|
||||||
System.Array.Resize<MixMode>(ref layerMixModes, animator.layerCount);
|
System.Array.Resize<MixMode>(ref layerMixModes, animator.layerCount);
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static float AnimationTime(float normalizedTime, float clipLength, bool loop, bool reversed) {
|
static float AnimationTime (float normalizedTime, float clipLength, bool loop, bool reversed) {
|
||||||
if (reversed)
|
if (reversed)
|
||||||
normalizedTime = (1 - normalizedTime + (int)normalizedTime) + (int)normalizedTime;
|
normalizedTime = (1 - normalizedTime + (int)normalizedTime) + (int)normalizedTime;
|
||||||
float time = normalizedTime * clipLength;
|
float time = normalizedTime * clipLength;
|
||||||
@ -315,14 +315,14 @@ namespace Spine.Unity {
|
|||||||
return (clipLength - time < EndSnapEpsilon) ? clipLength : time; // return a time snapped to clipLength;
|
return (clipLength - time < EndSnapEpsilon) ? clipLength : time; // return a time snapped to clipLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float AnimationTime(float normalizedTime, float clipLength, bool reversed) {
|
static float AnimationTime (float normalizedTime, float clipLength, bool reversed) {
|
||||||
if (reversed)
|
if (reversed)
|
||||||
normalizedTime = (1 - normalizedTime + (int)normalizedTime) + (int)normalizedTime;
|
normalizedTime = (1 - normalizedTime + (int)normalizedTime) + (int)normalizedTime;
|
||||||
|
|
||||||
return normalizedTime * clipLength;
|
return normalizedTime * clipLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitClipInfosForLayers() {
|
void InitClipInfosForLayers () {
|
||||||
if (layerClipInfos.Length < animator.layerCount) {
|
if (layerClipInfos.Length < animator.layerCount) {
|
||||||
System.Array.Resize<ClipInfos>(ref layerClipInfos, animator.layerCount);
|
System.Array.Resize<ClipInfos>(ref layerClipInfos, animator.layerCount);
|
||||||
for (int layer = 0, n = animator.layerCount; layer < n; ++layer) {
|
for (int layer = 0, n = animator.layerCount; layer < n; ++layer) {
|
||||||
@ -332,7 +332,7 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearClipInfosForLayers() {
|
void ClearClipInfosForLayers () {
|
||||||
for (int layer = 0, n = layerClipInfos.Length; layer < n; ++layer) {
|
for (int layer = 0, n = layerClipInfos.Length; layer < n; ++layer) {
|
||||||
if (layerClipInfos[layer] == null)
|
if (layerClipInfos[layer] == null)
|
||||||
layerClipInfos[layer] = new ClipInfos();
|
layerClipInfos[layer] = new ClipInfos();
|
||||||
@ -346,7 +346,7 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetStateUpdatesFromAnimator(int layer) {
|
void GetStateUpdatesFromAnimator (int layer) {
|
||||||
|
|
||||||
var layerInfos = layerClipInfos[layer];
|
var layerInfos = layerClipInfos[layer];
|
||||||
int clipInfoCount = animator.GetCurrentAnimatorClipInfoCount(layer);
|
int clipInfoCount = animator.GetCurrentAnimatorClipInfoCount(layer);
|
||||||
@ -378,8 +378,7 @@ namespace Spine.Unity {
|
|||||||
layerInfos.interruptingClipTimeAddition = newTime - oldTime;
|
layerInfos.interruptingClipTimeAddition = newTime - oldTime;
|
||||||
layerInfos.interruptingStateInfo = interruptingStateInfo;
|
layerInfos.interruptingStateInfo = interruptingStateInfo;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
layerInfos.clipInfoCount = clipInfoCount;
|
layerInfos.clipInfoCount = clipInfoCount;
|
||||||
layerInfos.nextClipInfoCount = nextClipInfoCount;
|
layerInfos.nextClipInfoCount = nextClipInfoCount;
|
||||||
layerInfos.interruptingClipInfoCount = 0;
|
layerInfos.interruptingClipInfoCount = 0;
|
||||||
@ -420,7 +419,7 @@ namespace Spine.Unity {
|
|||||||
shallInterpolateWeightTo1 = layerInfos.isLastFrameOfInterruption;
|
shallInterpolateWeightTo1 = layerInfos.isLastFrameOfInterruption;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetAnimatorStateInfos(
|
void GetAnimatorStateInfos (
|
||||||
int layer,
|
int layer,
|
||||||
out bool isInterruptionActive,
|
out bool isInterruptionActive,
|
||||||
out AnimatorStateInfo stateInfo,
|
out AnimatorStateInfo stateInfo,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user