|
@@ -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,
|
|
@@ -437,7 +437,7 @@ int spAnimationState_apply(spAnimationState *self, spSkeleton *skeleton) {
|
|
|
if (timeline->propertyIds[0] == SP_PROPERTY_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_ATTACHMENT)
|
|
|
_spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, timelineBlend, -1);
|
|
|
else
|
|
|
spTimeline_apply(timeline, skeleton, animationLast, applyTime, applyEvents, &internal->eventsCount,
|
|
@@ -536,7 +536,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;
|
|
@@ -559,14 +559,14 @@ float _spAnimationState_applyMixingFrom(spAnimationState *self, spTrackEntry *to
|
|
|
break;
|
|
|
}
|
|
|
from->totalAlpha += alpha;
|
|
|
- if (timeline->propertyIds[0] == SP_PROPERTY_ROTATE)
|
|
|
+ if (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,
|
|
@@ -593,19 +593,11 @@ _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;
|
|
|
+ int i;
|
|
|
+ for (i = 1; i < valuesLength; i++) {
|
|
|
+ if (values[i] > target) return (int) (i - 1);
|
|
|
}
|
|
|
- return 0;
|
|
|
+ return (int) valuesLength - 1;
|
|
|
}
|
|
|
|
|
|
void _spAnimationState_applyAttachmentTimeline(spAnimationState *self, spTimeline *timeline, spSkeleton *skeleton,
|
|
@@ -1079,9 +1071,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 {
|