Skip to content

Commit

Permalink
[cpp] Port of commit 8290353. Fix for hold previous on 3+ animations …
Browse files Browse the repository at this point in the history
…causing dipping. See #1738.
  • Loading branch information
badlogic committed Aug 13, 2020
1 parent 6d833f3 commit 0405d23
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions spine-cpp/spine-cpp/src/spine/AnimationState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,9 @@ void EventQueue::drain() {

const int Subsequent = 0;
const int First = 1;
const int Hold = 2;
const int HoldMix = 3;
const int HoldSubsequent = 2;
const int HoldFirst = 3;
const int HoldMix = 4;

const int Setup = 1;
const int Current = 2;
Expand Down Expand Up @@ -836,7 +837,11 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
timelineBlend = MixBlend_Setup;
alpha = alphaMix;
break;
case Hold:
case HoldSubsequent:
timelineBlend = blend;
alpha = alphaHold;
break;
case HoldFirst:
timelineBlend = MixBlend_Setup;
alpha = alphaHold;
break;
Expand Down Expand Up @@ -1007,8 +1012,12 @@ void AnimationState::computeHold(TrackEntry *entry) {
if (to != NULL && to->_holdPrevious) {
for (size_t i = 0; i < timelinesCount; i++) {
int id = timelines[i]->getPropertyId();
if (!_propertyIDs.containsKey(id)) _propertyIDs.put(id, true);
timelineMode[i] = Hold;
if (!_propertyIDs.containsKey(id)) {
_propertyIDs.put(id, true);
timelineMode[i] = HoldFirst;
} else {
timelineMode[i] = HoldSubsequent;
}
}
return;
}
Expand Down Expand Up @@ -1039,7 +1048,7 @@ void AnimationState::computeHold(TrackEntry *entry) {
}
break;
}
timelineMode[i] = Hold;
timelineMode[i] = HoldFirst;
}
}
}
Expand Down

0 comments on commit 0405d23

Please sign in to comment.