[haxe] Fix parsing binary deform timelines, sequences.

This commit is contained in:
Mario Zechner 2023-09-13 23:45:18 +02:00
parent a4000104c6
commit 322c2a24a5
3 changed files with 7 additions and 26 deletions

View File

@ -1005,7 +1005,7 @@ class SkeletonBinary {
slotIndex = input.readInt(true);
for (iii in 0...input.readInt(true)) {
var attachmentName:String = input.readStringRef();
var attachment:VertexAttachment = cast(skin.getAttachment(slotIndex, attachmentName), VertexAttachment);
var attachment = skin.getAttachment(slotIndex, attachmentName);
if (attachment == null)
throw new SpineException("Vertex attachment not found: " + attachmentName);
var timelineType = input.readByte();
@ -1014,12 +1014,13 @@ class SkeletonBinary {
switch (timelineType) {
case ATTACHMENT_DEFORM:
var weighted:Bool = attachment.bones != null;
var vertices:Vector<Float> = attachment.vertices;
var vertexAttachment = cast(attachment, VertexAttachment);
var weighted:Bool = vertexAttachment.bones != null;
var vertices:Vector<Float> = vertexAttachment.vertices;
var deformLength:Int = weighted ? Std.int(vertices.length / 3 * 2) : vertices.length;
bezierCount = input.readInt(true);
var deformTimeline:DeformTimeline = new DeformTimeline(frameCount, bezierCount, slotIndex, attachment);
var deformTimeline:DeformTimeline = new DeformTimeline(frameCount, bezierCount, slotIndex, vertexAttachment);
time = input.readFloat();
frame = 0;

View File

@ -99,28 +99,6 @@ class RegionAttachment extends Attachment implements HasTextureRegion {
}
}
public function setUVs(u:Float, v:Float, u2:Float, v2:Float, degrees:Int):Void {
if (degrees == 90) {
uvs[4] = u;
uvs[5] = v2;
uvs[6] = u;
uvs[7] = v;
uvs[0] = u2;
uvs[1] = v;
uvs[2] = u2;
uvs[3] = v2;
} else {
uvs[2] = u;
uvs[3] = v2;
uvs[4] = u;
uvs[5] = v;
uvs[6] = u2;
uvs[7] = v;
uvs[0] = u2;
uvs[1] = v2;
}
}
public function computeWorldVertices(slot:Slot, worldVertices:Vector<Float>, offset:Int, stride:Int):Void {
if (sequence != null)
sequence.apply(slot, this);

View File

@ -91,6 +91,7 @@ class SkeletonSprite extends DisplayObject implements IAnimatable {
mesh = null;
if (Std.isOfType(region.rendererObject, SkeletonMesh)) {
mesh = cast(region.rendererObject, SkeletonMesh);
mesh.texture = region.region.texture;
indices = QUAD_INDICES;
} else {
mesh = region.rendererObject = new SkeletonMesh(cast(region.region.texture, Texture));
@ -118,6 +119,7 @@ class SkeletonSprite extends DisplayObject implements IAnimatable {
mesh = null;
if (Std.isOfType(meshAttachment.rendererObject, SkeletonMesh)) {
mesh = cast(meshAttachment.rendererObject, SkeletonMesh);
mesh.texture = meshAttachment.region.texture;
indices = meshAttachment.triangles;
} else {
mesh = meshAttachment.rendererObject = new SkeletonMesh(cast(meshAttachment.region.texture, Texture));