|
@@ -248,12 +248,21 @@ void _spRotateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
|
|
|
|
|
|
bone = skeleton->bones[self->boneIndex];
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) bone->rotation = bone->data->rotation;
|
|
|
+ switch (pose) {
|
|
|
+ case SP_MIX_POSE_SETUP:
|
|
|
+ bone->rotation = bone->data->rotation;
|
|
|
+ return;
|
|
|
+ case SP_MIX_POSE_CURRENT:
|
|
|
+ case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
|
|
|
+ r = bone->data->rotation - bone->rotation;
|
|
|
+ r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360;
|
|
|
+ bone->rotation += r * alpha;
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (time >= self->frames[self->framesCount - ROTATE_ENTRIES]) { /* Time is after last frame. */
|
|
|
- if (setupPose)
|
|
|
+ if (pose == SP_MIX_POSE_SETUP)
|
|
|
bone->rotation = bone->data->rotation + self->frames[self->framesCount + ROTATE_PREV_ROTATION] * alpha;
|
|
|
else {
|
|
|
r = bone->data->rotation + self->frames[self->framesCount + ROTATE_PREV_ROTATION] - bone->rotation;
|
|
@@ -272,7 +281,7 @@ void _spRotateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
|
|
|
r = self->frames[frame + ROTATE_ROTATION] - prevRotation;
|
|
|
r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360;
|
|
|
r = prevRotation + r * percent;
|
|
|
- if (setupPose) {
|
|
|
+ if (pose == SP_MIX_POSE_SETUP) {
|
|
|
r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360;
|
|
|
bone->rotation = bone->data->rotation + r * alpha;
|
|
|
} else {
|
|
@@ -318,9 +327,15 @@ void _spTranslateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleto
|
|
|
|
|
|
bone = skeleton->bones[self->boneIndex];
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) {
|
|
|
- bone->x = bone->data->x;
|
|
|
- bone->y = bone->data->y;
|
|
|
+ switch (pose) {
|
|
|
+ case SP_MIX_POSE_SETUP:
|
|
|
+ bone->x = bone->data->x;
|
|
|
+ bone->y = bone->data->y;
|
|
|
+ return;
|
|
|
+ case SP_MIX_POSE_CURRENT:
|
|
|
+ case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
|
|
|
+ bone->x += (bone->data->x - bone->x) * alpha;
|
|
|
+ bone->y += (bone->data->y - bone->y) * alpha;
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -342,7 +357,7 @@ void _spTranslateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleto
|
|
|
x += (frames[frame + TRANSLATE_X] - x) * percent;
|
|
|
y += (frames[frame + TRANSLATE_Y] - y) * percent;
|
|
|
}
|
|
|
- if (setupPose) {
|
|
|
+ if (pose == SP_MIX_POSE_SETUP) {
|
|
|
bone->x = bone->data->x + x * alpha;
|
|
|
bone->y = bone->data->y + y * alpha;
|
|
|
} else {
|
|
@@ -384,9 +399,15 @@ void _spScaleTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
|
|
|
bone = skeleton->bones[self->boneIndex];
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) {
|
|
|
- bone->scaleX = bone->data->scaleX;
|
|
|
- bone->scaleY = bone->data->scaleY;
|
|
|
+ switch (pose) {
|
|
|
+ case SP_MIX_POSE_SETUP:
|
|
|
+ bone->scaleX = bone->data->scaleX;
|
|
|
+ bone->scaleY = bone->data->scaleY;
|
|
|
+ return;
|
|
|
+ case SP_MIX_POSE_CURRENT:
|
|
|
+ case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
|
|
|
+ bone->scaleX += (bone->data->scaleX - bone->scaleX) * alpha;
|
|
|
+ bone->scaleY += (bone->data->scaleY - bone->scaleY) * alpha;
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -413,7 +434,7 @@ void _spScaleTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
bone->scaleY = y;
|
|
|
} else {
|
|
|
float bx, by;
|
|
|
- if (setupPose) {
|
|
|
+ if (pose == SP_MIX_POSE_SETUP) {
|
|
|
bx = bone->data->scaleX;
|
|
|
by = bone->data->scaleY;
|
|
|
} else {
|
|
@@ -421,7 +442,7 @@ void _spScaleTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
by = bone->scaleY;
|
|
|
}
|
|
|
/* Mixing out uses sign of setup or current pose, else use sign of key. */
|
|
|
- if (mixingOut) {
|
|
|
+ if (direction == SP_MIX_DIRECTION_OUT) {
|
|
|
x = ABS(x) * SIGNUM(bx);
|
|
|
y = ABS(y) * SIGNUM(by);
|
|
|
} else {
|
|
@@ -465,9 +486,15 @@ void _spShearTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
frames = self->frames;
|
|
|
framesCount = self->framesCount;
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) {
|
|
|
- bone->shearX = bone->data->shearX;
|
|
|
- bone->shearY = bone->data->shearY;
|
|
|
+ switch (pose) {
|
|
|
+ case SP_MIX_POSE_SETUP:
|
|
|
+ bone->shearX = bone->data->shearX;
|
|
|
+ bone->shearY = bone->data->shearY;
|
|
|
+ return;
|
|
|
+ case SP_MIX_POSE_CURRENT:
|
|
|
+ case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
|
|
|
+ bone->shearX += (bone->data->shearX - bone->shearX) * alpha;
|
|
|
+ bone->shearY += (bone->data->shearY - bone->shearY) * alpha;
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -487,7 +514,7 @@ void _spShearTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
x = x + (frames[frame + TRANSLATE_X] - x) * percent;
|
|
|
y = y + (frames[frame + TRANSLATE_Y] - y) * percent;
|
|
|
}
|
|
|
- if (setupPose) {
|
|
|
+ if (pose == SP_MIX_POSE_SETUP) {
|
|
|
bone->shearX = bone->data->shearX + x * alpha;
|
|
|
bone->shearY = bone->data->shearY + y * alpha;
|
|
|
} else {
|
|
@@ -523,12 +550,22 @@ void _spColorTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
int frame;
|
|
|
float percent, frameTime;
|
|
|
float r, g, b, a;
|
|
|
+ spColor* color;
|
|
|
+ spColor* setup;
|
|
|
spColorTimeline* self = (spColorTimeline*)timeline;
|
|
|
slot = skeleton->slots[self->slotIndex];
|
|
|
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) {
|
|
|
- spColor_setFromColor(&slot->color, &slot->data->color);
|
|
|
+ switch (pose) {
|
|
|
+ case SP_MIX_POSE_SETUP:
|
|
|
+ spColor_setFromColor(&slot->color, &slot->data->color);
|
|
|
+ return;
|
|
|
+ case SP_MIX_POSE_CURRENT:
|
|
|
+ case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
|
|
|
+ color = &slot->color;
|
|
|
+ setup = &slot->data->color;
|
|
|
+ spColor_addFloats(color, (setup->r - color->r) * alpha, (setup->g - color->g) * alpha, (setup->b - color->b) * alpha,
|
|
|
+ (setup->a - color->a) * alpha);
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -560,7 +597,7 @@ void _spColorTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
if (alpha == 1) {
|
|
|
spColor_setFromFloats(&slot->color, r, g, b, a);
|
|
|
} else {
|
|
|
- if (setupPose) {
|
|
|
+ if (pose == SP_MIX_POSE_SETUP) {
|
|
|
spColor_setFromColor(&slot->color, &slot->data->color);
|
|
|
}
|
|
|
spColor_addFloats(&slot->color, (r - slot->color.r) * alpha, (g - slot->color.g) * alpha, (b - slot->color.b) * alpha, (a - slot->color.a) * alpha);
|
|
@@ -602,13 +639,26 @@ void _spTwoColorTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton
|
|
|
float r, g, b, a, r2, g2, b2;
|
|
|
spColor* light;
|
|
|
spColor* dark;
|
|
|
+ spColor* setupLight;
|
|
|
+ spColor* setupDark;
|
|
|
spColorTimeline* self = (spColorTimeline*)timeline;
|
|
|
slot = skeleton->slots[self->slotIndex];
|
|
|
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) {
|
|
|
- spColor_setFromColor(&slot->color, &slot->data->color);
|
|
|
- spColor_setFromColor(slot->darkColor, slot->data->darkColor);
|
|
|
+ switch (pose) {
|
|
|
+ case SP_MIX_POSE_SETUP:
|
|
|
+ spColor_setFromColor(&slot->color, &slot->data->color);
|
|
|
+ spColor_setFromColor(slot->darkColor, slot->data->darkColor);
|
|
|
+ return;
|
|
|
+ case SP_MIX_POSE_CURRENT:
|
|
|
+ case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
|
|
|
+ light = &slot->color;
|
|
|
+ dark = slot->darkColor;
|
|
|
+ setupLight = &slot->data->color;
|
|
|
+ setupDark = slot->data->darkColor;
|
|
|
+ spColor_addFloats(light, (setupLight->r - light->r) * alpha, (setupLight->g - light->g) * alpha, (setupLight->b - light->b) * alpha,
|
|
|
+ (setupLight->a - light->a) * alpha);
|
|
|
+ spColor_addFloats(dark, (setupDark->r - dark->r) * alpha, (setupDark->g - dark->g) * alpha, (setupDark->b - dark->b) * alpha, 0);
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -652,7 +702,7 @@ void _spTwoColorTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton
|
|
|
} else {
|
|
|
light = &slot->color;
|
|
|
dark = slot->darkColor;
|
|
|
- if (setupPose) {
|
|
|
+ if (pose == SP_MIX_POSE_SETUP) {
|
|
|
spColor_setFromColor(light, &slot->data->color);
|
|
|
spColor_setFromColor(dark, slot->data->darkColor);
|
|
|
}
|
|
@@ -694,14 +744,14 @@ void _spAttachmentTimeline_apply (const spTimeline* timeline, spSkeleton* skelet
|
|
|
int frameIndex;
|
|
|
spSlot* slot = skeleton->slots[self->slotIndex];
|
|
|
|
|
|
- if (mixingOut && setupPose) {
|
|
|
+ if (direction == SP_MIX_DIRECTION_OUT && pose == SP_MIX_POSE_SETUP) {
|
|
|
const char* attachmentName = slot->data->attachmentName;
|
|
|
spSlot_setAttachment(slot, attachmentName ? spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName) : 0);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) {
|
|
|
+ if (pose == SP_MIX_POSE_SETUP) {
|
|
|
attachmentName = slot->data->attachmentName;
|
|
|
spSlot_setAttachment(skeleton->slots[self->slotIndex],
|
|
|
attachmentName ? spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName) : 0);
|
|
@@ -793,11 +843,6 @@ void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
|
|
|
|
|
|
frames = self->frames;
|
|
|
framesCount = self->framesCount;
|
|
|
- if (time < frames[0]) { /* Time is before first frame. */
|
|
|
- if (setupPose) slot->attachmentVerticesCount = 0;
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
vertexCount = self->frameVerticesCount;
|
|
|
if (slot->attachmentVerticesCount < vertexCount) {
|
|
|
if (slot->attachmentVerticesCapacity < vertexCount) {
|
|
@@ -806,18 +851,32 @@ void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
|
|
|
slot->attachmentVerticesCapacity = vertexCount;
|
|
|
}
|
|
|
}
|
|
|
- if (slot->attachmentVerticesCount != vertexCount && !setupPose) alpha = 1; /* Don't mix from uninitialized slot vertices. */
|
|
|
+ if (slot->attachmentVerticesCount != vertexCount && pose != SP_MIX_POSE_SETUP) alpha = 1; /* Don't mix from uninitialized slot vertices. */
|
|
|
slot->attachmentVerticesCount = vertexCount;
|
|
|
|
|
|
frameVertices = self->frameVertices;
|
|
|
vertices = slot->attachmentVertices;
|
|
|
|
|
|
+ if (time < frames[0]) { /* Time is before first frame. */
|
|
|
+ switch (pose) {
|
|
|
+ case SP_MIX_POSE_SETUP:
|
|
|
+ slot->attachmentVerticesCount = 0;
|
|
|
+ return;
|
|
|
+ case SP_MIX_POSE_CURRENT:
|
|
|
+ case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
|
|
|
+ alpha = 1 - alpha;
|
|
|
+ for (i = 0; i < vertexCount; i++)
|
|
|
+ vertices[i] *= alpha;
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (time >= frames[framesCount - 1]) { /* Time is after last frame. */
|
|
|
const float* lastVertices = self->frameVertices[framesCount - 1];
|
|
|
if (alpha == 1) {
|
|
|
/* Vertex positions or deform offsets, no alpha. */
|
|
|
memcpy(vertices, lastVertices, vertexCount * sizeof(float));
|
|
|
- } else if (setupPose) {
|
|
|
+ } else if (pose == SP_MIX_POSE_SETUP) {
|
|
|
spVertexAttachment* vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment);
|
|
|
if (!vertexAttachment->bones) {
|
|
|
/* Unweighted vertex positions, with alpha. */
|
|
@@ -852,7 +911,7 @@ void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
|
|
|
float prev = prevVertices[i];
|
|
|
vertices[i] = prev + (nextVertices[i] - prev) * percent;
|
|
|
}
|
|
|
- } else if (setupPose) {
|
|
|
+ } else if (pose == SP_MIX_POSE_SETUP) {
|
|
|
spVertexAttachment* vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment);
|
|
|
if (!vertexAttachment->bones) {
|
|
|
/* Unweighted vertex positions, with alpha. */
|
|
@@ -882,7 +941,7 @@ void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
|
|
|
}
|
|
|
|
|
|
int _spDeformTimeline_getPropertyId (const spTimeline* timeline) {
|
|
|
- return (SP_TIMELINE_DEFORM << 24) + SUB_CAST(spDeformTimeline, timeline)->slotIndex;
|
|
|
+ return (SP_TIMELINE_DEFORM << 27) + SUB_CAST(spVertexAttachment, SUB_CAST(spDeformTimeline, timeline)->attachment)->id + SUB_CAST(spDeformTimeline, timeline)->slotIndex;
|
|
|
}
|
|
|
|
|
|
void _spDeformTimeline_dispose (spTimeline* timeline) {
|
|
@@ -931,7 +990,7 @@ void _spEventTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
if (!firedEvents) return;
|
|
|
|
|
|
if (lastTime > time) { /* Fire events after last time for looped animations. */
|
|
|
- _spEventTimeline_apply(timeline, skeleton, lastTime, (float)INT_MAX, firedEvents, eventsCount, alpha, setupPose, mixingOut);
|
|
|
+ _spEventTimeline_apply(timeline, skeleton, lastTime, (float)INT_MAX, firedEvents, eventsCount, alpha, pose, direction);
|
|
|
lastTime = -1;
|
|
|
} else if (lastTime >= self->frames[self->framesCount - 1]) /* Last time is after last frame. */
|
|
|
return;
|
|
@@ -998,13 +1057,13 @@ void _spDrawOrderTimeline_apply (const spTimeline* timeline, spSkeleton* skeleto
|
|
|
const int* drawOrderToSetupIndex;
|
|
|
spDrawOrderTimeline* self = (spDrawOrderTimeline*)timeline;
|
|
|
|
|
|
- if (mixingOut && setupPose) {
|
|
|
+ if (direction == SP_MIX_DIRECTION_OUT && pose == SP_MIX_POSE_SETUP) {
|
|
|
memcpy(skeleton->drawOrder, skeleton->slots, self->slotsCount * sizeof(spSlot*));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) memcpy(skeleton->drawOrder, skeleton->slots, self->slotsCount * sizeof(spSlot*));
|
|
|
+ if (pose == SP_MIX_POSE_SETUP) memcpy(skeleton->drawOrder, skeleton->slots, self->slotsCount * sizeof(spSlot*));
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -1085,9 +1144,15 @@ void _spIkConstraintTimeline_apply (const spTimeline* timeline, spSkeleton* skel
|
|
|
constraint = skeleton->ikConstraints[self->ikConstraintIndex];
|
|
|
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) {
|
|
|
- constraint->mix = constraint->data->mix;
|
|
|
- constraint->bendDirection = constraint->data->bendDirection;
|
|
|
+ switch (pose) {
|
|
|
+ case SP_MIX_POSE_SETUP:
|
|
|
+ constraint->mix = constraint->data->mix;
|
|
|
+ constraint->bendDirection = constraint->data->bendDirection;
|
|
|
+ return;
|
|
|
+ case SP_MIX_POSE_CURRENT:
|
|
|
+ case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
|
|
|
+ constraint->mix += (constraint->data->mix - constraint->mix) * alpha;
|
|
|
+ constraint->bendDirection = constraint->data->bendDirection;
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -1095,13 +1160,13 @@ void _spIkConstraintTimeline_apply (const spTimeline* timeline, spSkeleton* skel
|
|
|
frames = self->frames;
|
|
|
framesCount = self->framesCount;
|
|
|
if (time >= frames[framesCount - IKCONSTRAINT_ENTRIES]) { /* Time is after last frame. */
|
|
|
- if (setupPose) {
|
|
|
+ if (pose == SP_MIX_POSE_SETUP) {
|
|
|
constraint->mix = constraint->data->mix + (frames[framesCount + IKCONSTRAINT_PREV_MIX] - constraint->data->mix) * alpha;
|
|
|
- constraint->bendDirection = mixingOut ? constraint->data->bendDirection
|
|
|
+ constraint->bendDirection = direction == SP_MIX_DIRECTION_OUT ? constraint->data->bendDirection
|
|
|
: (int)frames[framesCount + IKCONSTRAINT_PREV_BEND_DIRECTION];
|
|
|
} else {
|
|
|
constraint->mix += (frames[framesCount + IKCONSTRAINT_PREV_MIX] - constraint->mix) * alpha;
|
|
|
- if (!mixingOut) constraint->bendDirection = (int)frames[framesCount + IKCONSTRAINT_PREV_BEND_DIRECTION];
|
|
|
+ if (direction == SP_MIX_DIRECTION_IN) constraint->bendDirection = (int)frames[framesCount + IKCONSTRAINT_PREV_BEND_DIRECTION];
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -1112,12 +1177,12 @@ void _spIkConstraintTimeline_apply (const spTimeline* timeline, spSkeleton* skel
|
|
|
frameTime = self->frames[frame];
|
|
|
percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / IKCONSTRAINT_ENTRIES - 1, 1 - (time - frameTime) / (self->frames[frame + IKCONSTRAINT_PREV_TIME] - frameTime));
|
|
|
|
|
|
- if (setupPose) {
|
|
|
+ if (pose == SP_MIX_POSE_SETUP) {
|
|
|
constraint->mix = constraint->data->mix + (mix + (frames[frame + IKCONSTRAINT_MIX] - mix) * percent - constraint->data->mix) * alpha;
|
|
|
- constraint->bendDirection = mixingOut ? constraint->data->bendDirection : (int)frames[frame + IKCONSTRAINT_PREV_BEND_DIRECTION];
|
|
|
+ constraint->bendDirection = direction == SP_MIX_DIRECTION_OUT ? constraint->data->bendDirection : (int)frames[frame + IKCONSTRAINT_PREV_BEND_DIRECTION];
|
|
|
} else {
|
|
|
constraint->mix += (mix + (frames[frame + IKCONSTRAINT_MIX] - mix) * percent - constraint->mix) * alpha;
|
|
|
- if (!mixingOut) constraint->bendDirection = (int)frames[frame + IKCONSTRAINT_PREV_BEND_DIRECTION];
|
|
|
+ if (direction == SP_MIX_DIRECTION_IN) constraint->bendDirection = (int)frames[frame + IKCONSTRAINT_PREV_BEND_DIRECTION];
|
|
|
}
|
|
|
|
|
|
UNUSED(lastTime);
|
|
@@ -1162,14 +1227,23 @@ void _spTransformConstraintTimeline_apply (const spTimeline* timeline, spSkeleto
|
|
|
|
|
|
constraint = skeleton->transformConstraints[self->transformConstraintIndex];
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) {
|
|
|
- spTransformConstraintData* data = constraint->data;
|
|
|
- constraint->rotateMix = data->rotateMix;
|
|
|
- constraint->translateMix = data->translateMix;
|
|
|
- constraint->scaleMix = data->scaleMix;
|
|
|
- constraint->shearMix = data->shearMix;
|
|
|
+ spTransformConstraintData* data = constraint->data;
|
|
|
+ switch (pose) {
|
|
|
+ case SP_MIX_POSE_SETUP:
|
|
|
+ constraint->rotateMix = data->rotateMix;
|
|
|
+ constraint->translateMix = data->translateMix;
|
|
|
+ constraint->scaleMix = data->scaleMix;
|
|
|
+ constraint->shearMix = data->shearMix;
|
|
|
+ return;
|
|
|
+ case SP_MIX_POSE_CURRENT:
|
|
|
+ case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
|
|
|
+ constraint->rotateMix += (data->rotateMix - constraint->rotateMix) * alpha;
|
|
|
+ constraint->translateMix += (data->translateMix - constraint->translateMix) * alpha;
|
|
|
+ constraint->scaleMix += (data->scaleMix - constraint->scaleMix) * alpha;
|
|
|
+ constraint->shearMix += (data->shearMix - constraint->shearMix) * alpha;
|
|
|
}
|
|
|
return;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
frames = self->frames;
|
|
@@ -1196,7 +1270,7 @@ void _spTransformConstraintTimeline_apply (const spTimeline* timeline, spSkeleto
|
|
|
scale += (frames[frame + TRANSFORMCONSTRAINT_SCALE] - scale) * percent;
|
|
|
shear += (frames[frame + TRANSFORMCONSTRAINT_SHEAR] - shear) * percent;
|
|
|
}
|
|
|
- if (setupPose) {
|
|
|
+ if (pose == SP_MIX_POSE_SETUP) {
|
|
|
spTransformConstraintData* data = constraint->data;
|
|
|
constraint->rotateMix = data->rotateMix + (rotate - data->rotateMix) * alpha;
|
|
|
constraint->translateMix = data->translateMix + (translate - data->translateMix) * alpha;
|
|
@@ -1248,8 +1322,13 @@ void _spPathConstraintPositionTimeline_apply(const spTimeline* timeline, spSkele
|
|
|
|
|
|
constraint = skeleton->pathConstraints[self->pathConstraintIndex];
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) {
|
|
|
- constraint->position = constraint->data->position;
|
|
|
+ switch (pose) {
|
|
|
+ case SP_MIX_POSE_SETUP:
|
|
|
+ constraint->position = constraint->data->position;
|
|
|
+ return;
|
|
|
+ case SP_MIX_POSE_CURRENT:
|
|
|
+ case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
|
|
|
+ constraint->position += (constraint->data->position - constraint->position) * alpha;
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -1268,7 +1347,7 @@ void _spPathConstraintPositionTimeline_apply(const spTimeline* timeline, spSkele
|
|
|
|
|
|
position += (frames[frame + PATHCONSTRAINTPOSITION_VALUE] - position) * percent;
|
|
|
}
|
|
|
- if (setupPose)
|
|
|
+ if (pose == SP_MIX_POSE_SETUP)
|
|
|
constraint->position = constraint->data->position + (position - constraint->data->position) * alpha;
|
|
|
else
|
|
|
constraint->position += (position - constraint->position) * alpha;
|
|
@@ -1308,8 +1387,13 @@ void _spPathConstraintSpacingTimeline_apply(const spTimeline* timeline, spSkelet
|
|
|
|
|
|
constraint = skeleton->pathConstraints[self->pathConstraintIndex];
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) {
|
|
|
- constraint->spacing = constraint->data->spacing;
|
|
|
+ switch (pose) {
|
|
|
+ case SP_MIX_POSE_SETUP:
|
|
|
+ constraint->spacing = constraint->data->spacing;
|
|
|
+ return;
|
|
|
+ case SP_MIX_POSE_CURRENT:
|
|
|
+ case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
|
|
|
+ constraint->spacing += (constraint->data->spacing - constraint->spacing) * alpha;
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -1329,7 +1413,7 @@ void _spPathConstraintSpacingTimeline_apply(const spTimeline* timeline, spSkelet
|
|
|
spacing += (frames[frame + PATHCONSTRAINTSPACING_VALUE] - spacing) * percent;
|
|
|
}
|
|
|
|
|
|
- if (setupPose)
|
|
|
+ if (pose == SP_MIX_POSE_SETUP)
|
|
|
constraint->spacing = constraint->data->spacing + (spacing - constraint->data->spacing) * alpha;
|
|
|
else
|
|
|
constraint->spacing += (spacing - constraint->spacing) * alpha;
|
|
@@ -1372,9 +1456,15 @@ void _spPathConstraintMixTimeline_apply(const spTimeline* timeline, spSkeleton*
|
|
|
|
|
|
constraint = skeleton->pathConstraints[self->pathConstraintIndex];
|
|
|
if (time < self->frames[0]) {
|
|
|
- if (setupPose) {
|
|
|
- constraint->rotateMix = constraint->data->rotateMix;
|
|
|
- constraint->translateMix = constraint->data->translateMix;
|
|
|
+ switch (pose) {
|
|
|
+ case SP_MIX_POSE_SETUP:
|
|
|
+ constraint->rotateMix = constraint->data->rotateMix;
|
|
|
+ constraint->translateMix = constraint->data->translateMix;
|
|
|
+ return;
|
|
|
+ case SP_MIX_POSE_CURRENT:
|
|
|
+ case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */
|
|
|
+ constraint->rotateMix += (constraint->data->rotateMix - constraint->rotateMix) * alpha;
|
|
|
+ constraint->translateMix += (constraint->data->translateMix - constraint->translateMix) * alpha;
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -1397,7 +1487,7 @@ void _spPathConstraintMixTimeline_apply(const spTimeline* timeline, spSkeleton*
|
|
|
translate += (frames[frame + PATHCONSTRAINTMIX_TRANSLATE] - translate) * percent;
|
|
|
}
|
|
|
|
|
|
- if (setupPose) {
|
|
|
+ if (pose == SP_MIX_POSE_SETUP) {
|
|
|
constraint->rotateMix = constraint->data->rotateMix + (rotate - constraint->data->rotateMix) * alpha;
|
|
|
constraint->translateMix = constraint->data->translateMix + (translate - constraint->data->translateMix) * alpha;
|
|
|
} else {
|