Skip to content

Commit

Permalink
[haxe] Fix parsing binary deform timelines, sequences.
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Sep 13, 2023
1 parent ed32699 commit 1aa727b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
9 changes: 5 additions & 4 deletions spine-haxe/spine-haxe/spine/SkeletonBinary.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand Down
22 changes: 0 additions & 22 deletions spine-haxe/spine-haxe/spine/attachments/RegionAttachment.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions spine-haxe/spine-haxe/spine/starling/SkeletonSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 1aa727b

Please sign in to comment.