mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Fixed mixing from uninitialized slot vertices.
http://esotericsoftware.com/forum/viewtopic.php?f=9&t=2775
This commit is contained in:
parent
6b9d514ca7
commit
7f6abc8c00
@ -66,11 +66,8 @@ public class FfdTimeline extends CurveTimeline {
|
||||
var vertexCount:int = frameVertices[0].length;
|
||||
|
||||
var vertices:Vector.<Number> = slot.attachmentVertices;
|
||||
if (vertices.length < vertexCount) {
|
||||
vertices = new Vector.<Number>(vertexCount);
|
||||
slot.attachmentVertices = vertices;
|
||||
}
|
||||
slot.attachmentVertices.length = vertexCount;
|
||||
if (vertices.length != vertexCount) alpha = 1;
|
||||
vertices.length = vertexCount;
|
||||
|
||||
var i:int;
|
||||
if (time >= frames[frames.length - 1]) { // Time is after last frame.
|
||||
|
||||
@ -652,6 +652,7 @@ void _spFFDTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, flo
|
||||
return; /* Time is before first frame. */
|
||||
}
|
||||
|
||||
if (slot->attachmentVerticesCount == 0) alpha = 1;
|
||||
if (slot->attachmentVerticesCount < self->frameVerticesCount) {
|
||||
if (slot->attachmentVerticesCapacity < self->frameVerticesCount) {
|
||||
FREE(slot->attachmentVertices);
|
||||
|
||||
@ -565,6 +565,7 @@ namespace Spine {
|
||||
int vertexCount = frameVertices[0].Length;
|
||||
|
||||
float[] vertices = slot.attachmentVertices;
|
||||
if (vertices.Length != vertexCount) alpha = 1;
|
||||
if (vertices.Length < vertexCount) {
|
||||
vertices = new float[vertexCount];
|
||||
slot.attachmentVertices = vertices;
|
||||
|
||||
@ -631,12 +631,8 @@ spine.FfdTimeline.prototype = {
|
||||
var vertexCount = frameVertices[0].length;
|
||||
|
||||
var vertices = slot.attachmentVertices;
|
||||
if (vertices.length < vertexCount) {
|
||||
vertices = [];
|
||||
if (vertices.length != vertexCount) alpha = 1;
|
||||
vertices.length = vertexCount;
|
||||
slot.attachmentVertices = vertices;
|
||||
}
|
||||
slot.attachmentVertices.length = vertexCount;
|
||||
|
||||
if (time >= frames[frames.length - 1]) { // Time is after last frame.
|
||||
var lastVertices = frameVertices[frames.length - 1];
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
package com.esotericsoftware.spine;
|
||||
|
||||
import com.esotericsoftware.spine.attachments.Attachment;
|
||||
import com.esotericsoftware.spine.attachments.MeshAttachment;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
@ -655,14 +656,15 @@ public class Animation {
|
||||
Slot slot = skeleton.slots.get(slotIndex);
|
||||
if (slot.getAttachment() != attachment) return;
|
||||
|
||||
FloatArray verticesArray = slot.getAttachmentVertices();
|
||||
verticesArray.size = 0;
|
||||
|
||||
float[] frames = this.frames;
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
float[][] frameVertices = this.frameVertices;
|
||||
int vertexCount = frameVertices[0].length;
|
||||
|
||||
FloatArray verticesArray = slot.getAttachmentVertices();
|
||||
if (verticesArray.size != vertexCount) alpha = 1; // Don't mix from uninitialized slot vertices.
|
||||
verticesArray.size = 0;
|
||||
verticesArray.ensureCapacity(vertexCount);
|
||||
verticesArray.size = vertexCount;
|
||||
float[] vertices = verticesArray.items;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user