diff --git a/spine-c/src/spine/Animation.c b/spine-c/src/spine/Animation.c index 6d7732863..65efdd419 100644 --- a/spine-c/src/spine/Animation.c +++ b/spine-c/src/spine/Animation.c @@ -664,14 +664,14 @@ void _spFFDTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, flo return; /* Time is before first frame. */ } - if (slot->attachmentVerticesCount != self->frameVerticesCount) alpha = 1; /* Don't mix from uninitialized slot vertices. */ if (slot->attachmentVerticesCount < self->frameVerticesCount) { if (slot->attachmentVerticesCapacity < self->frameVerticesCount) { FREE(slot->attachmentVertices); slot->attachmentVertices = MALLOC(float, self->frameVerticesCount); slot->attachmentVerticesCapacity = self->frameVerticesCount; } - } + } else if (slot->attachmentVerticesCount > self->frameVerticesCount) + alpha = 1; /* Don't mix from uninitialized slot vertices. */ slot->attachmentVerticesCount = self->frameVerticesCount; if (time >= self->frames[self->framesCount - 1]) { diff --git a/spine-csharp/src/Animation.cs b/spine-csharp/src/Animation.cs index 278b5d99d..8b4a08a81 100644 --- a/spine-csharp/src/Animation.cs +++ b/spine-csharp/src/Animation.cs @@ -580,18 +580,20 @@ namespace Spine { int vertexCount = frameVertices[0].Length; float[] vertices = slot.attachmentVertices; - if (vertices.Length != vertexCount) alpha = 1; // Don't mix from uninitialized slot vertices. if (vertices.Length < vertexCount) { vertices = new float[vertexCount]; slot.attachmentVertices = vertices; - } + } else if (vertices.Length > vertexCount) + alpha = 1; // Don't mix from uninitialized slot vertices. slot.attachmentVerticesCount = vertexCount; if (time >= frames[frames.Length - 1]) { // Time is after last frame. float[] lastVertices = frameVertices[frames.Length - 1]; if (alpha < 1) { - for (int i = 0; i < vertexCount; i++) - vertices[i] += (lastVertices[i] - vertices[i]) * alpha; + for (int i = 0; i < vertexCount; i++) { + float vertex = vertices[i]; + vertices[i] = vertex + (lastVertices[i] - vertex) * alpha; + } } else Array.Copy(lastVertices, 0, vertices, 0, vertexCount); return; @@ -609,7 +611,8 @@ namespace Spine { if (alpha < 1) { for (int i = 0; i < vertexCount; i++) { float prev = prevVertices[i]; - vertices[i] += (prev + (nextVertices[i] - prev) * percent - vertices[i]) * alpha; + float vertex = vertices[i]; + vertices[i] = vertex + (prev + (nextVertices[i] - prev) * percent - vertex) * alpha; } } else { for (int i = 0; i < vertexCount; i++) { diff --git a/spine-csharp/src/Bone.cs b/spine-csharp/src/Bone.cs index 1e1974cda..86546b2cd 100644 --- a/spine-csharp/src/Bone.cs +++ b/spine-csharp/src/Bone.cs @@ -85,7 +85,6 @@ namespace Spine { /// Computes the world SRT using the parent bone and the local SRT. public void UpdateWorldTransform () { Bone parent = this.parent; - Skeleton skeleton = this.skeleton; float x = this.x, y = this.y; if (parent != null) { worldX = x * parent.m00 + y * parent.m01 + parent.worldX; @@ -98,17 +97,18 @@ namespace Spine { worldScaleY = scaleY; } worldRotation = data.inheritRotation ? parent.worldRotation + rotationIK : rotationIK; - worldFlipX = parent.worldFlipX ^ flipX; - worldFlipY = parent.worldFlipY ^ flipY; + worldFlipX = parent.worldFlipX != flipX; + worldFlipY = parent.worldFlipY != flipY; } else { + Skeleton skeleton = this.skeleton; bool skeletonFlipX = skeleton.flipX, skeletonFlipY = skeleton.flipY; worldX = skeletonFlipX ? -x : x; worldY = skeletonFlipY != yDown ? -y : y; worldScaleX = scaleX; worldScaleY = scaleY; worldRotation = rotationIK; - worldFlipX = skeletonFlipX ^ flipX; - worldFlipY = skeletonFlipY ^ flipY; + worldFlipX = skeletonFlipX != flipX; + worldFlipY = skeletonFlipY != flipY; } float radians = worldRotation * (float)Math.PI / 180; float cos = (float)Math.Cos(radians);