mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +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 {
|
} else {
|
||||||
var timelineMode : Vector.<int> = current.timelineMode;
|
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;
|
if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
|
||||||
var timelinesRotation : Vector.<Number> = current.timelinesRotation;
|
|
||||||
|
|
||||||
for (ii = 0; ii < timelineCount; ii++) {
|
for (ii = 0; ii < timelineCount; ii++) {
|
||||||
timeline = timelines[ii];
|
timeline = timelines[ii];
|
||||||
var timelineBlend : MixBlend = timelineMode[ii] == SUBSEQUENT ? blend : MixBlend.setup;
|
var timelineBlend : MixBlend = timelineMode[ii] == SUBSEQUENT ? blend : MixBlend.setup;
|
||||||
if (timeline is RotateTimeline)
|
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)
|
else if (timeline is AttachmentTimeline)
|
||||||
applyAttachmentTimeline(AttachmentTimeline(timeline), skeleton, applyTime, timelineBlend, true);
|
applyAttachmentTimeline(AttachmentTimeline(timeline), skeleton, applyTime, timelineBlend, true);
|
||||||
else
|
else
|
||||||
@ -267,7 +266,7 @@ package spine.animation {
|
|||||||
var timelineMode : Vector.<int> = from.timelineMode;
|
var timelineMode : Vector.<int> = from.timelineMode;
|
||||||
var timelineHoldMix : Vector.<TrackEntry> = from.timelineHoldMix;
|
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;
|
if (firstFrame) from.timelinesRotation.length = timelineCount << 1;
|
||||||
var timelinesRotation : Vector.<Number> = from.timelinesRotation;
|
var timelinesRotation : Vector.<Number> = from.timelinesRotation;
|
||||||
|
|
||||||
|
|||||||
@ -404,7 +404,7 @@ int spAnimationState_apply (spAnimationState* self, spSkeleton* skeleton) {
|
|||||||
} else {
|
} else {
|
||||||
spIntArray* timelineMode = current->timelineMode;
|
spIntArray* timelineMode = current->timelineMode;
|
||||||
|
|
||||||
firstFrame = current->timelinesRotationCount == 0;
|
firstFrame = current->timelinesRotationCount != timelineCount << 1;
|
||||||
if (firstFrame) _spAnimationState_resizeTimelinesRotation(current, timelineCount << 1);
|
if (firstFrame) _spAnimationState_resizeTimelinesRotation(current, timelineCount << 1);
|
||||||
timelinesRotation = current->timelinesRotation;
|
timelinesRotation = current->timelinesRotation;
|
||||||
|
|
||||||
@ -498,7 +498,7 @@ float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* t
|
|||||||
timelineMode = from->timelineMode;
|
timelineMode = from->timelineMode;
|
||||||
timelineHoldMix = from->timelineHoldMix;
|
timelineHoldMix = from->timelineHoldMix;
|
||||||
|
|
||||||
firstFrame = from->timelinesRotationCount == 0;
|
firstFrame = from->timelinesRotationCount != timelineCount << 1;
|
||||||
if (firstFrame) _spAnimationState_resizeTimelinesRotation(from, timelineCount << 1);
|
if (firstFrame) _spAnimationState_resizeTimelinesRotation(from, timelineCount << 1);
|
||||||
timelinesRotation = from->timelinesRotation;
|
timelinesRotation = from->timelinesRotation;
|
||||||
|
|
||||||
|
|||||||
@ -447,7 +447,7 @@ bool AnimationState::apply(Skeleton &skeleton) {
|
|||||||
} else {
|
} else {
|
||||||
Vector<int> &timelineMode = current._timelineMode;
|
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);
|
if (firstFrame) current._timelinesRotation.setSize(timelines.size() << 1, 0);
|
||||||
Vector<float> &timelinesRotation = current._timelinesRotation;
|
Vector<float> &timelinesRotation = current._timelinesRotation;
|
||||||
|
|
||||||
@ -801,7 +801,7 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
|
|||||||
Vector<int> &timelineMode = from->_timelineMode;
|
Vector<int> &timelineMode = from->_timelineMode;
|
||||||
Vector<TrackEntry *> &timelineHoldMix = from->_timelineHoldMix;
|
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);
|
if (firstFrame) from->_timelinesRotation.setSize(timelines.size() << 1, 0);
|
||||||
|
|
||||||
Vector<float> &timelinesRotation = from->_timelinesRotation;
|
Vector<float> &timelinesRotation = from->_timelinesRotation;
|
||||||
@ -815,17 +815,17 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
|
|||||||
switch (timelineMode[i]) {
|
switch (timelineMode[i]) {
|
||||||
case Subsequent:
|
case Subsequent:
|
||||||
if (!drawOrder && (timeline->getRTTI().isExactly(DrawOrderTimeline::rtti))) continue;
|
if (!drawOrder && (timeline->getRTTI().isExactly(DrawOrderTimeline::rtti))) continue;
|
||||||
timelineBlend = blend;
|
timelineBlend = blend;
|
||||||
alpha = alphaMix;
|
alpha = alphaMix;
|
||||||
break;
|
break;
|
||||||
case First:
|
case First:
|
||||||
timelineBlend = MixBlend_Setup;
|
timelineBlend = MixBlend_Setup;
|
||||||
alpha = alphaMix;
|
alpha = alphaMix;
|
||||||
break;
|
break;
|
||||||
case HoldSubsequent:
|
case HoldSubsequent:
|
||||||
timelineBlend = blend;
|
timelineBlend = blend;
|
||||||
alpha = alphaHold;
|
alpha = alphaHold;
|
||||||
break;
|
break;
|
||||||
case HoldFirst:
|
case HoldFirst:
|
||||||
timelineBlend = MixBlend_Setup;
|
timelineBlend = MixBlend_Setup;
|
||||||
alpha = alphaHold;
|
alpha = alphaHold;
|
||||||
@ -840,11 +840,11 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
|
|||||||
if ((timeline->getRTTI().isExactly(RotateTimeline::rtti))) {
|
if ((timeline->getRTTI().isExactly(RotateTimeline::rtti))) {
|
||||||
applyRotateTimeline((RotateTimeline*)timeline, skeleton, applyTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
|
applyRotateTimeline((RotateTimeline*)timeline, skeleton, applyTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame);
|
||||||
} else if (timeline->getRTTI().isExactly(AttachmentTimeline::rtti)) {
|
} else if (timeline->getRTTI().isExactly(AttachmentTimeline::rtti)) {
|
||||||
applyAttachmentTimeline(static_cast<AttachmentTimeline*>(timeline), skeleton, applyTime, timelineBlend, attachments);
|
applyAttachmentTimeline(static_cast<AttachmentTimeline*>(timeline), skeleton, applyTime, timelineBlend, attachments);
|
||||||
} else {
|
} else {
|
||||||
if (drawOrder && timeline->getRTTI().isExactly(DrawOrderTimeline::rtti) && timelineBlend == MixBlend_Setup)
|
if (drawOrder && timeline->getRTTI().isExactly(DrawOrderTimeline::rtti) && timelineBlend == MixBlend_Setup)
|
||||||
direction = MixDirection_In;
|
direction = MixDirection_In;
|
||||||
timeline->apply(skeleton, animationLast, applyTime, events, alpha, timelineBlend, direction);
|
timeline->apply(skeleton, animationLast, applyTime, events, alpha, timelineBlend, direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -197,15 +197,14 @@ module spine {
|
|||||||
} else {
|
} else {
|
||||||
let timelineMode = current.timelineMode;
|
let timelineMode = current.timelineMode;
|
||||||
|
|
||||||
let firstFrame = current.timelinesRotation.length == 0;
|
let firstFrame = current.timelinesRotation.length != timelineCount << 1;
|
||||||
if (firstFrame) Utils.setArraySize(current.timelinesRotation, timelineCount << 1, null);
|
if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
|
||||||
let timelinesRotation = current.timelinesRotation;
|
|
||||||
|
|
||||||
for (let ii = 0; ii < timelineCount; ii++) {
|
for (let ii = 0; ii < timelineCount; ii++) {
|
||||||
let timeline = timelines[ii];
|
let timeline = timelines[ii];
|
||||||
let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : MixBlend.setup;
|
let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : MixBlend.setup;
|
||||||
if (timeline instanceof RotateTimeline) {
|
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) {
|
} else if (timeline instanceof AttachmentTimeline) {
|
||||||
this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, true);
|
this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, true);
|
||||||
} else {
|
} else {
|
||||||
@ -271,9 +270,8 @@ module spine {
|
|||||||
let timelineMode = from.timelineMode;
|
let timelineMode = from.timelineMode;
|
||||||
let timelineHoldMix = from.timelineHoldMix;
|
let timelineHoldMix = from.timelineHoldMix;
|
||||||
|
|
||||||
let firstFrame = from.timelinesRotation.length == 0;
|
let firstFrame = from.timelinesRotation.length != timelineCount << 1;
|
||||||
if (firstFrame) Utils.setArraySize(from.timelinesRotation, timelineCount << 1, null);
|
if (firstFrame) from.timelinesRotation.length = timelineCount << 1;
|
||||||
let timelinesRotation = from.timelinesRotation;
|
|
||||||
|
|
||||||
from.totalAlpha = 0;
|
from.totalAlpha = 0;
|
||||||
for (let i = 0; i < timelineCount; i++) {
|
for (let i = 0; i < timelineCount; i++) {
|
||||||
@ -308,7 +306,7 @@ module spine {
|
|||||||
from.totalAlpha += alpha;
|
from.totalAlpha += alpha;
|
||||||
|
|
||||||
if (timeline instanceof RotateTimeline)
|
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)
|
else if (timeline instanceof AttachmentTimeline)
|
||||||
this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments);
|
this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments);
|
||||||
else {
|
else {
|
||||||
@ -708,9 +706,10 @@ module spine {
|
|||||||
let to = entry.mixingTo;
|
let to = entry.mixingTo;
|
||||||
let timelines = entry.animation.timelines;
|
let timelines = entry.animation.timelines;
|
||||||
let timelinesCount = entry.animation.timelines.length;
|
let timelinesCount = entry.animation.timelines.length;
|
||||||
let timelineMode = Utils.setArraySize(entry.timelineMode, timelinesCount);
|
let timelineMode = entry.timelineMode;
|
||||||
entry.timelineHoldMix.length = 0;
|
timelineMode.length = timelinesCount;
|
||||||
let timelineHoldMix = Utils.setArraySize(entry.timelineHoldMix, timelinesCount);
|
let timelineHoldMix = entry.timelineHoldMix;
|
||||||
|
timelineHoldMix.length = 0;
|
||||||
let propertyIDs = this.propertyIDs;
|
let propertyIDs = this.propertyIDs;
|
||||||
|
|
||||||
if (to != null && to.holdPrevious) {
|
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
|
// 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 webkit602BugfixHelper (alpha: number, blend: MixBlend) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static contains<T> (array: Array<T>, element: T, identity = true) {
|
static contains<T> (array: Array<T>, element: T, identity = true) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user