Эх сурвалжийг харах

[haxe] Fix parsing binary deform timelines, sequences.

Mario Zechner 2 жил өмнө
parent
commit
1aa727bf43

+ 5 - 4
spine-haxe/spine-haxe/spine/SkeletonBinary.hx

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

+ 0 - 22
spine-haxe/spine-haxe/spine/attachments/RegionAttachment.hx

@@ -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 {
 	public function computeWorldVertices(slot:Slot, worldVertices:Vector<Float>, offset:Int, stride:Int):Void {
 		if (sequence != null)
 		if (sequence != null)
 			sequence.apply(slot, this);
 			sequence.apply(slot, this);

+ 2 - 0
spine-haxe/spine-haxe/spine/starling/SkeletonSprite.hx

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