mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[c] Closes #2149, use timeline type instead property ids.ds
This commit is contained in:
parent
d9935741c2
commit
a64b79b498
@ -417,7 +417,7 @@ int spAnimationState_apply(spAnimationState *self, spSkeleton *skeleton) {
|
||||
if ((i == 0 && mix == 1) || blend == SP_MIX_BLEND_ADD) {
|
||||
for (ii = 0; ii < timelineCount; ii++) {
|
||||
timeline = timelines[ii];
|
||||
if (timeline->propertyIds[0] == SP_PROPERTY_ATTACHMENT) {
|
||||
if (timeline->type == SP_TIMELINE_ATTACHMENT) {
|
||||
_spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, blend, -1);
|
||||
} else {
|
||||
spTimeline_apply(timelines[ii], skeleton, animationLast, applyTime, applyEvents,
|
||||
@ -435,10 +435,10 @@ int spAnimationState_apply(spAnimationState *self, spSkeleton *skeleton) {
|
||||
for (ii = 0; ii < timelineCount; ii++) {
|
||||
timeline = timelines[ii];
|
||||
timelineBlend = timelineMode->items[ii] == SUBSEQUENT ? blend : SP_MIX_BLEND_SETUP;
|
||||
if (!shortestRotation && timeline->propertyIds[0] == SP_PROPERTY_ROTATE)
|
||||
if (!shortestRotation && timeline->type == SP_TIMELINE_ROTATE)
|
||||
_spAnimationState_applyRotateTimeline(self, timeline, skeleton, applyTime, mix, timelineBlend,
|
||||
timelinesRotation, ii << 1, firstFrame);
|
||||
else if (timeline->propertyIds[0] == SP_PROPERTY_ATTACHMENT)
|
||||
else if (timeline->type == SP_TIMELINE_ROTATE)
|
||||
_spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, timelineBlend, -1);
|
||||
else
|
||||
spTimeline_apply(timeline, skeleton, animationLast, applyTime, applyEvents, &internal->eventsCount,
|
||||
@ -538,7 +538,7 @@ float _spAnimationState_applyMixingFrom(spAnimationState *self, spTrackEntry *to
|
||||
|
||||
switch (timelineMode->items[i]) {
|
||||
case SUBSEQUENT:
|
||||
if (!drawOrder && timeline->propertyIds[0] == SP_PROPERTY_DRAWORDER) continue;
|
||||
if (!drawOrder && timeline->type == SP_TIMELINE_DRAWORDER) continue;
|
||||
timelineBlend = blend;
|
||||
alpha = alphaMix;
|
||||
break;
|
||||
@ -561,14 +561,14 @@ float _spAnimationState_applyMixingFrom(spAnimationState *self, spTrackEntry *to
|
||||
break;
|
||||
}
|
||||
from->totalAlpha += alpha;
|
||||
if (!shortestRotation && timeline->propertyIds[0] == SP_PROPERTY_ROTATE)
|
||||
if (!shortestRotation && timeline->type == SP_TIMELINE_ROTATE)
|
||||
_spAnimationState_applyRotateTimeline(self, timeline, skeleton, applyTime, alpha, timelineBlend,
|
||||
timelinesRotation, i << 1, firstFrame);
|
||||
else if (timeline->propertyIds[0] == SP_PROPERTY_ATTACHMENT)
|
||||
else if (timeline->type == SP_TIMELINE_ATTACHMENT)
|
||||
_spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, timelineBlend,
|
||||
attachments);
|
||||
else {
|
||||
if (drawOrder && timeline->propertyIds[0] == SP_PROPERTY_DRAWORDER &&
|
||||
if (drawOrder && timeline->type == SP_TIMELINE_DRAWORDER &&
|
||||
timelineBlend == SP_MIX_BLEND_SETUP)
|
||||
direction = SP_MIX_DIRECTION_IN;
|
||||
spTimeline_apply(timeline, skeleton, animationLast, applyTime, events, &internal->eventsCount,
|
||||
@ -595,19 +595,10 @@ _spAnimationState_setAttachment(spAnimationState *self, spSkeleton *skeleton, sp
|
||||
|
||||
/* @param target After the first and before the last entry. */
|
||||
static int binarySearch1(float *values, int valuesLength, float target) {
|
||||
int low = 0, current;
|
||||
int high = valuesLength - 2;
|
||||
if (high == 0) return 1;
|
||||
current = high >> 1;
|
||||
while (1) {
|
||||
if (values[(current + 1)] <= target)
|
||||
low = current + 1;
|
||||
else
|
||||
high = current;
|
||||
if (low == high) return low + 1;
|
||||
current = (low + high) >> 1;
|
||||
}
|
||||
return 0;
|
||||
for (int i = 1; i < valuesLength; i++) {
|
||||
if (values[i] > target) return (int) (i - 1);
|
||||
}
|
||||
return (int) valuesLength - 1;
|
||||
}
|
||||
|
||||
void _spAnimationState_applyAttachmentTimeline(spAnimationState *self, spTimeline *timeline, spSkeleton *skeleton,
|
||||
@ -1083,9 +1074,9 @@ continue_outer:
|
||||
int numIds = timeline->propertyIdsCount;
|
||||
if (!_spAnimationState_addPropertyIDs(state, ids, numIds))
|
||||
timelineMode[i] = SUBSEQUENT;
|
||||
else if (to == 0 || timeline->propertyIds[0] == SP_PROPERTY_ATTACHMENT ||
|
||||
timeline->propertyIds[0] == SP_PROPERTY_DRAWORDER ||
|
||||
timeline->propertyIds[0] == SP_PROPERTY_EVENT ||
|
||||
else if (to == 0 || timeline->type == SP_TIMELINE_ATTACHMENT ||
|
||||
timeline->type == SP_TIMELINE_DRAWORDER ||
|
||||
timeline->type == SP_TIMELINE_EVENT ||
|
||||
!spAnimation_hasTimeline(to->animation, ids, numIds)) {
|
||||
timelineMode[i] = FIRST;
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user