mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +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) {
|
if ((i == 0 && mix == 1) || blend == SP_MIX_BLEND_ADD) {
|
||||||
for (ii = 0; ii < timelineCount; ii++) {
|
for (ii = 0; ii < timelineCount; ii++) {
|
||||||
timeline = timelines[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);
|
_spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, blend, -1);
|
||||||
} else {
|
} else {
|
||||||
spTimeline_apply(timelines[ii], skeleton, animationLast, applyTime, applyEvents,
|
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++) {
|
for (ii = 0; ii < timelineCount; ii++) {
|
||||||
timeline = timelines[ii];
|
timeline = timelines[ii];
|
||||||
timelineBlend = timelineMode->items[ii] == SUBSEQUENT ? blend : SP_MIX_BLEND_SETUP;
|
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,
|
_spAnimationState_applyRotateTimeline(self, timeline, skeleton, applyTime, mix, timelineBlend,
|
||||||
timelinesRotation, ii << 1, firstFrame);
|
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);
|
_spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, timelineBlend, -1);
|
||||||
else
|
else
|
||||||
spTimeline_apply(timeline, skeleton, animationLast, applyTime, applyEvents, &internal->eventsCount,
|
spTimeline_apply(timeline, skeleton, animationLast, applyTime, applyEvents, &internal->eventsCount,
|
||||||
@ -538,7 +538,7 @@ float _spAnimationState_applyMixingFrom(spAnimationState *self, spTrackEntry *to
|
|||||||
|
|
||||||
switch (timelineMode->items[i]) {
|
switch (timelineMode->items[i]) {
|
||||||
case SUBSEQUENT:
|
case SUBSEQUENT:
|
||||||
if (!drawOrder && timeline->propertyIds[0] == SP_PROPERTY_DRAWORDER) continue;
|
if (!drawOrder && timeline->type == SP_TIMELINE_DRAWORDER) continue;
|
||||||
timelineBlend = blend;
|
timelineBlend = blend;
|
||||||
alpha = alphaMix;
|
alpha = alphaMix;
|
||||||
break;
|
break;
|
||||||
@ -561,14 +561,14 @@ float _spAnimationState_applyMixingFrom(spAnimationState *self, spTrackEntry *to
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
from->totalAlpha += alpha;
|
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,
|
_spAnimationState_applyRotateTimeline(self, timeline, skeleton, applyTime, alpha, timelineBlend,
|
||||||
timelinesRotation, i << 1, firstFrame);
|
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,
|
_spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, timelineBlend,
|
||||||
attachments);
|
attachments);
|
||||||
else {
|
else {
|
||||||
if (drawOrder && timeline->propertyIds[0] == SP_PROPERTY_DRAWORDER &&
|
if (drawOrder && timeline->type == SP_TIMELINE_DRAWORDER &&
|
||||||
timelineBlend == SP_MIX_BLEND_SETUP)
|
timelineBlend == SP_MIX_BLEND_SETUP)
|
||||||
direction = SP_MIX_DIRECTION_IN;
|
direction = SP_MIX_DIRECTION_IN;
|
||||||
spTimeline_apply(timeline, skeleton, animationLast, applyTime, events, &internal->eventsCount,
|
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. */
|
/* @param target After the first and before the last entry. */
|
||||||
static int binarySearch1(float *values, int valuesLength, float target) {
|
static int binarySearch1(float *values, int valuesLength, float target) {
|
||||||
int low = 0, current;
|
for (int i = 1; i < valuesLength; i++) {
|
||||||
int high = valuesLength - 2;
|
if (values[i] > target) return (int) (i - 1);
|
||||||
if (high == 0) return 1;
|
}
|
||||||
current = high >> 1;
|
return (int) valuesLength - 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _spAnimationState_applyAttachmentTimeline(spAnimationState *self, spTimeline *timeline, spSkeleton *skeleton,
|
void _spAnimationState_applyAttachmentTimeline(spAnimationState *self, spTimeline *timeline, spSkeleton *skeleton,
|
||||||
@ -1083,9 +1074,9 @@ continue_outer:
|
|||||||
int numIds = timeline->propertyIdsCount;
|
int numIds = timeline->propertyIdsCount;
|
||||||
if (!_spAnimationState_addPropertyIDs(state, ids, numIds))
|
if (!_spAnimationState_addPropertyIDs(state, ids, numIds))
|
||||||
timelineMode[i] = SUBSEQUENT;
|
timelineMode[i] = SUBSEQUENT;
|
||||||
else if (to == 0 || timeline->propertyIds[0] == SP_PROPERTY_ATTACHMENT ||
|
else if (to == 0 || timeline->type == SP_TIMELINE_ATTACHMENT ||
|
||||||
timeline->propertyIds[0] == SP_PROPERTY_DRAWORDER ||
|
timeline->type == SP_TIMELINE_DRAWORDER ||
|
||||||
timeline->propertyIds[0] == SP_PROPERTY_EVENT ||
|
timeline->type == SP_TIMELINE_EVENT ||
|
||||||
!spAnimation_hasTimeline(to->animation, ids, numIds)) {
|
!spAnimation_hasTimeline(to->animation, ids, numIds)) {
|
||||||
timelineMode[i] = FIRST;
|
timelineMode[i] = FIRST;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user