From dc16e5564713906476c130f4581d1ccf11ed433f Mon Sep 17 00:00:00 2001 From: badlogic Date: Wed, 11 Oct 2017 11:27:29 +0200 Subject: [PATCH] [c] Fixed DeformTimeline, see #1016. --- spine-c/spine-c/src/spine/Animation.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/spine-c/spine-c/src/spine/Animation.c b/spine-c/spine-c/src/spine/Animation.c index 0c2c7194f..ddaf3456e 100644 --- a/spine-c/spine-c/src/spine/Animation.c +++ b/spine-c/spine-c/src/spine/Animation.c @@ -851,7 +851,7 @@ void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, slot->attachmentVerticesCapacity = vertexCount; } } - slot->attachmentVerticesCount = vertexCount; + if (slot->attachmentVerticesCount == 0) alpha = 1; frameVertices = self->frameVertices; vertices = slot->attachmentVertices; @@ -860,15 +860,15 @@ void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, spVertexAttachment* vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment); switch (pose) { case SP_MIX_POSE_SETUP: - if (!vertexAttachment->bones) { - memcpy(vertices, vertexAttachment->vertices, vertexCount * sizeof(float)); - } else { - for (i = 0; i < vertexCount; i++) vertices[i] = 0; - } + slot->attachmentVerticesCount = 0; return; case SP_MIX_POSE_CURRENT: case SP_MIX_POSE_CURRENT_LAYERED: /* to appease compiler */ - if (alpha == 1) break; + if (alpha == 1) { + slot->attachmentVerticesCount = 0; + return; + } + slot->attachmentVerticesCount = vertexCount; if (!vertexAttachment->bones) { float* setupVertices = vertexAttachment->vertices; for (i = 0; i < vertexCount; i++) { @@ -884,6 +884,7 @@ void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, return; } + slot->attachmentVerticesCount = vertexCount; if (time >= frames[framesCount - 1]) { /* Time is after last frame. */ const float* lastVertices = self->frameVertices[framesCount - 1]; if (alpha == 1) {