mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
Missing port: Fixed AnimationState crash when the number of timelines changes during a mix.
Ref impl commit: b99df7286aa933411f90eda6dbdeffd936058ae4
This commit is contained in:
parent
963da7561e
commit
6dfae6df3c
@ -195,15 +195,14 @@ package spine.animation {
|
||||
} else {
|
||||
var timelineMode : Vector.<int> = current.timelineMode;
|
||||
|
||||
var firstFrame : Boolean = current.timelinesRotation.length == 0;
|
||||
var firstFrame : Boolean = current.timelinesRotation.length != timelineCount << 1;
|
||||
if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
|
||||
var timelinesRotation : Vector.<Number> = current.timelinesRotation;
|
||||
|
||||
for (ii = 0; ii < timelineCount; ii++) {
|
||||
timeline = timelines[ii];
|
||||
var timelineBlend : MixBlend = timelineMode[ii] == SUBSEQUENT ? blend : MixBlend.setup;
|
||||
if (timeline is RotateTimeline)
|
||||
applyRotateTimeline(timeline, skeleton, applyTime, mix, timelineBlend, timelinesRotation, ii << 1, firstFrame);
|
||||
applyRotateTimeline(timeline, skeleton, applyTime, mix, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
|
||||
else if (timeline is AttachmentTimeline)
|
||||
applyAttachmentTimeline(AttachmentTimeline(timeline), skeleton, applyTime, timelineBlend, true);
|
||||
else
|
||||
@ -267,7 +266,7 @@ package spine.animation {
|
||||
var timelineMode : Vector.<int> = from.timelineMode;
|
||||
var timelineHoldMix : Vector.<TrackEntry> = from.timelineHoldMix;
|
||||
|
||||
var firstFrame : Boolean = from.timelinesRotation.length == 0;
|
||||
var firstFrame : Boolean = from.timelinesRotation.length != timelineCount << 1;
|
||||
if (firstFrame) from.timelinesRotation.length = timelineCount << 1;
|
||||
var timelinesRotation : Vector.<Number> = from.timelinesRotation;
|
||||
|
||||
|
||||
@ -404,7 +404,7 @@ int spAnimationState_apply (spAnimationState* self, spSkeleton* skeleton) {
|
||||
} else {
|
||||
spIntArray* timelineMode = current->timelineMode;
|
||||
|
||||
firstFrame = current->timelinesRotationCount == 0;
|
||||
firstFrame = current->timelinesRotationCount != timelineCount << 1;
|
||||
if (firstFrame) _spAnimationState_resizeTimelinesRotation(current, timelineCount << 1);
|
||||
timelinesRotation = current->timelinesRotation;
|
||||
|
||||
@ -498,7 +498,7 @@ float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* t
|
||||
timelineMode = from->timelineMode;
|
||||
timelineHoldMix = from->timelineHoldMix;
|
||||
|
||||
firstFrame = from->timelinesRotationCount == 0;
|
||||
firstFrame = from->timelinesRotationCount != timelineCount << 1;
|
||||
if (firstFrame) _spAnimationState_resizeTimelinesRotation(from, timelineCount << 1);
|
||||
timelinesRotation = from->timelinesRotation;
|
||||
|
||||
|
||||
@ -447,7 +447,7 @@ bool AnimationState::apply(Skeleton &skeleton) {
|
||||
} else {
|
||||
Vector<int> &timelineMode = current._timelineMode;
|
||||
|
||||
bool firstFrame = current._timelinesRotation.size() == 0;
|
||||
bool firstFrame = current._timelinesRotation.size() != timelines.size() << 1;
|
||||
if (firstFrame) current._timelinesRotation.setSize(timelines.size() << 1, 0);
|
||||
Vector<float> &timelinesRotation = current._timelinesRotation;
|
||||
|
||||
@ -801,7 +801,7 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
|
||||
Vector<int> &timelineMode = from->_timelineMode;
|
||||
Vector<TrackEntry *> &timelineHoldMix = from->_timelineHoldMix;
|
||||
|
||||
bool firstFrame = from->_timelinesRotation.size() == 0;
|
||||
bool firstFrame = from->_timelinesRotation.size() != timelines.size() << 1;
|
||||
if (firstFrame) from->_timelinesRotation.setSize(timelines.size() << 1, 0);
|
||||
|
||||
Vector<float> &timelinesRotation = from->_timelinesRotation;
|
||||
@ -815,17 +815,17 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
|
||||
switch (timelineMode[i]) {
|
||||
case Subsequent:
|
||||
if (!drawOrder && (timeline->getRTTI().isExactly(DrawOrderTimeline::rtti))) continue;
|
||||
timelineBlend = blend;
|
||||
timelineBlend = blend;
|
||||
alpha = alphaMix;
|
||||
break;
|
||||
case First:
|
||||
timelineBlend = MixBlend_Setup;
|
||||
alpha = alphaMix;
|
||||
break;
|
||||
case HoldSubsequent:
|
||||
timelineBlend = blend;
|
||||
alpha = alphaHold;
|
||||
break;
|
||||
case HoldSubsequent:
|
||||
timelineBlend = blend;
|
||||
alpha = alphaHold;
|
||||
break;
|
||||
case HoldFirst:
|
||||
timelineBlend = MixBlend_Setup;
|
||||
alpha = alphaHold;
|
||||
@ -840,11 +840,11 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
|
||||
if ((timeline->getRTTI().isExactly(RotateTimeline::rtti))) {
|
||||
applyRotateTimeline((RotateTimeline*)timeline, skeleton, applyTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
|
||||
} else if (timeline->getRTTI().isExactly(AttachmentTimeline::rtti)) {
|
||||
applyAttachmentTimeline(static_cast<AttachmentTimeline*>(timeline), skeleton, applyTime, timelineBlend, attachments);
|
||||
} else {
|
||||
if (drawOrder && timeline->getRTTI().isExactly(DrawOrderTimeline::rtti) && timelineBlend == MixBlend_Setup)
|
||||
direction = MixDirection_In;
|
||||
timeline->apply(skeleton, animationLast, applyTime, events, alpha, timelineBlend, direction);
|
||||
applyAttachmentTimeline(static_cast<AttachmentTimeline*>(timeline), skeleton, applyTime, timelineBlend, attachments);
|
||||
} else {
|
||||
if (drawOrder && timeline->getRTTI().isExactly(DrawOrderTimeline::rtti) && timelineBlend == MixBlend_Setup)
|
||||
direction = MixDirection_In;
|
||||
timeline->apply(skeleton, animationLast, applyTime, events, alpha, timelineBlend, direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,15 +197,14 @@ module spine {
|
||||
} else {
|
||||
let timelineMode = current.timelineMode;
|
||||
|
||||
let firstFrame = current.timelinesRotation.length == 0;
|
||||
if (firstFrame) Utils.setArraySize(current.timelinesRotation, timelineCount << 1, null);
|
||||
let timelinesRotation = current.timelinesRotation;
|
||||
let firstFrame = current.timelinesRotation.length != timelineCount << 1;
|
||||
if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
|
||||
|
||||
for (let ii = 0; ii < timelineCount; ii++) {
|
||||
let timeline = timelines[ii];
|
||||
let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : MixBlend.setup;
|
||||
if (timeline instanceof RotateTimeline) {
|
||||
this.applyRotateTimeline(timeline, skeleton, applyTime, mix, timelineBlend, timelinesRotation, ii << 1, firstFrame);
|
||||
this.applyRotateTimeline(timeline, skeleton, applyTime, mix, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
|
||||
} else if (timeline instanceof AttachmentTimeline) {
|
||||
this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, true);
|
||||
} else {
|
||||
@ -271,9 +270,8 @@ module spine {
|
||||
let timelineMode = from.timelineMode;
|
||||
let timelineHoldMix = from.timelineHoldMix;
|
||||
|
||||
let firstFrame = from.timelinesRotation.length == 0;
|
||||
if (firstFrame) Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null);
|
||||
let timelinesRotation = from.timelinesRotation;
|
||||
let firstFrame = from.timelinesRotation.length != timelineCount << 1;
|
||||
if (firstFrame) from.timelinesRotation.length = timelineCount << 1;
|
||||
|
||||
from.totalAlpha = 0;
|
||||
for (let i = 0; i < timelineCount; i++) {
|
||||
@ -308,7 +306,7 @@ module spine {
|
||||
from.totalAlpha += alpha;
|
||||
|
||||
if (timeline instanceof RotateTimeline)
|
||||
this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
|
||||
this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, timelineBlend, from.timelinesRotation, i << 1, firstFrame);
|
||||
else if (timeline instanceof AttachmentTimeline)
|
||||
this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments);
|
||||
else {
|
||||
@ -708,9 +706,10 @@ module spine {
|
||||
let to = entry.mixingTo;
|
||||
let timelines = entry.animation.timelines;
|
||||
let timelinesCount = entry.animation.timelines.length;
|
||||
let timelineMode = Utils.setArraySize(entry.timelineMode, timelinesCount);
|
||||
entry.timelineHoldMix.length = 0;
|
||||
let timelineHoldMix = Utils.setArraySize(entry.timelineHoldMix, timelinesCount);
|
||||
let timelineMode = entry.timelineMode;
|
||||
timelineMode.length = timelinesCount;
|
||||
let timelineHoldMix = entry.timelineHoldMix;
|
||||
timelineHoldMix.length = 0;
|
||||
let propertyIDs = this.propertyIDs;
|
||||
|
||||
if (to != null && to.holdPrevious) {
|
||||
|
||||
@ -314,7 +314,6 @@ module spine {
|
||||
|
||||
// This function is used to fix WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109
|
||||
static webkit602BugfixHelper (alpha: number, blend: MixBlend) {
|
||||
|
||||
}
|
||||
|
||||
static contains<T> (array: Array<T>, element: T, identity = true) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user