diff --git a/spine-as3/spine-as3-example/lib/spine-as3.swc b/spine-as3/spine-as3-example/lib/spine-as3.swc index 0c7c68d08..873bc9063 100644 Binary files a/spine-as3/spine-as3-example/lib/spine-as3.swc and b/spine-as3/spine-as3-example/lib/spine-as3.swc differ diff --git a/spine-as3/spine-as3/src/spine/IkConstraint.as b/spine-as3/spine-as3/src/spine/IkConstraint.as index e3b0dac32..f0ad1dbc1 100644 --- a/spine-as3/spine-as3/src/spine/IkConstraint.as +++ b/spine-as3/spine-as3/src/spine/IkConstraint.as @@ -77,10 +77,11 @@ public class IkConstraint implements Updatable { /** Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified in the world * coordinate system. */ static public function apply1 (bone:Bone, targetX:Number, targetY:Number, alpha:Number) : void { - var parentRotation:Number = bone.parent == null ? 0 : bone.parent.worldRotationX; + var parentRotation:Number = bone._parent == null ? 0 : bone._parent.worldRotationX; var rotation:Number = bone.rotation; - var rotationIK:Number = Math.atan2(targetY - bone.worldY, targetX - bone.worldX) * MathUtils.radDeg - parentRotation; - if (bone.worldSignX != bone.worldSignY) rotationIK = 360 - rotationIK; + var rotationIK:Number = Math.atan2(targetY - bone._worldY, targetX - bone._worldX) * MathUtils.radDeg - parentRotation; + if ((bone._worldSignX != bone._worldSignY) != (bone._skeleton.flipX != (bone._skeleton.flipY != Bone.yDown))) + rotationIK = 360 - rotationIK; if (rotationIK > 180) rotationIK -= 360; else if (rotationIK < -180) rotationIK += 360; bone.updateWorldTransformWith(bone.x, bone.y, rotation + (rotationIK - rotation) * alpha, bone.scaleX, bone.scaleY); @@ -116,16 +117,16 @@ public class IkConstraint implements Updatable { if (!pp) { tx = targetX - px; ty = targetY - py; - dx = child.worldX - px; - dy = child.worldY - py; + dx = child._worldX - px; + dy = child._worldY - py; } else { var ppa:Number = pp.a, ppb:Number = pp.b, ppc:Number = pp.c, ppd:Number = pp.d; var invDet:Number = 1 / (ppa * ppd - ppb * ppc); - var wx:Number = pp.worldX, wy:Number = pp.worldY, twx:Number = targetX - wx, twy:Number = targetY - wy; + var wx:Number = pp._worldX, wy:Number = pp._worldY, twx:Number = targetX - wx, twy:Number = targetY - wy; tx = (twx * ppd - twy * ppb) * invDet - px; ty = (twy * ppa - twx * ppc) * invDet - py; - twx = child.worldX - wx; - twy = child.worldY - wy; + twx = child._worldX - wx; + twy = child._worldY - wy; dx = (twx * ppd - twy * ppb) * invDet - px; dy = (twy * ppa - twx * ppc) * invDet - py; } diff --git a/spine-starling/spine-starling-example/lib/spine-as3.swc b/spine-starling/spine-starling-example/lib/spine-as3.swc index 780c1b3ba..873bc9063 100644 Binary files a/spine-starling/spine-starling-example/lib/spine-as3.swc and b/spine-starling/spine-starling-example/lib/spine-as3.swc differ diff --git a/spine-starling/spine-starling-example/lib/spine-starling.swc b/spine-starling/spine-starling-example/lib/spine-starling.swc index b75cd5c99..8b592e3b1 100644 Binary files a/spine-starling/spine-starling-example/lib/spine-starling.swc and b/spine-starling/spine-starling-example/lib/spine-starling.swc differ diff --git a/spine-starling/spine-starling/lib/spine-as3.swc b/spine-starling/spine-starling/lib/spine-as3.swc index 780c1b3ba..873bc9063 100644 Binary files a/spine-starling/spine-starling/lib/spine-as3.swc and b/spine-starling/spine-starling/lib/spine-as3.swc differ diff --git a/spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as b/spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as index 1434e23ba..8b5553674 100644 --- a/spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as +++ b/spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as @@ -38,7 +38,7 @@ import spine.atlas.AtlasRegion; import spine.attachments.Attachment; import spine.attachments.MeshAttachment; import spine.attachments.RegionAttachment; -import spine.attachments.SkinnedMeshAttachment; +import spine.attachments.WeightedMeshAttachment; import starling.core.RenderSupport; import starling.display.BlendMode; @@ -146,19 +146,19 @@ public class SkeletonSprite extends DisplayObject { a = mesh.a; image = mesh.rendererObject as SkeletonImage; if (image == null) mesh.rendererObject = image = SkeletonImage(AtlasRegion(mesh.rendererObject).rendererObject); - } else if (attachment is SkinnedMeshAttachment) { - var skinnedMesh:SkinnedMeshAttachment = SkinnedMeshAttachment(attachment); - verticesLength = skinnedMesh.uvs.length; + } else if (attachment is WeightedMeshAttachment) { + var weightedMesh:WeightedMeshAttachment = WeightedMeshAttachment(attachment); + verticesLength = weightedMesh.uvs.length; if (worldVertices.length < verticesLength) worldVertices.length = verticesLength; - skinnedMesh.computeWorldVertices(x, y, slot, worldVertices); - uvs = skinnedMesh.uvs; - triangles = skinnedMesh.triangles; - r = skinnedMesh.r; - g = skinnedMesh.g; - b = skinnedMesh.b; - a = skinnedMesh.a; - image = skinnedMesh.rendererObject as SkeletonImage; - if (image == null) skinnedMesh.rendererObject = image = SkeletonImage(AtlasRegion(skinnedMesh.rendererObject).rendererObject); + weightedMesh.computeWorldVertices(x, y, slot, worldVertices); + uvs = weightedMesh.uvs; + triangles = weightedMesh.triangles; + r = weightedMesh.r; + g = weightedMesh.g; + b = weightedMesh.b; + a = weightedMesh.a; + image = weightedMesh.rendererObject as SkeletonImage; + if (image == null) weightedMesh.rendererObject = image = SkeletonImage(AtlasRegion(weightedMesh.rendererObject).rendererObject); } if (image) { a *= skeletonA * slot.a; @@ -234,11 +234,11 @@ public class SkeletonSprite extends DisplayObject { verticesLength = mesh.vertices.length; if (worldVertices.length < verticesLength) worldVertices.length = verticesLength; mesh.computeWorldVertices(0, 0, slot, worldVertices); - } else if (attachment is SkinnedMeshAttachment) { - var skinnedMesh:SkinnedMeshAttachment = SkinnedMeshAttachment(attachment); - verticesLength = skinnedMesh.uvs.length; + } else if (attachment is WeightedMeshAttachment) { + var weightedMesh:WeightedMeshAttachment = WeightedMeshAttachment(attachment); + verticesLength = weightedMesh.uvs.length; if (worldVertices.length < verticesLength) worldVertices.length = verticesLength; - skinnedMesh.computeWorldVertices(0, 0, slot, worldVertices); + weightedMesh.computeWorldVertices(0, 0, slot, worldVertices); } else continue; for (var ii:int = 0; ii < verticesLength; ii += 2) { diff --git a/spine-starling/spine-starling/src/spine/starling/StarlingAtlasAttachmentLoader.as b/spine-starling/spine-starling/src/spine/starling/StarlingAtlasAttachmentLoader.as index ca628aff1..3deae3290 100644 --- a/spine-starling/spine-starling/src/spine/starling/StarlingAtlasAttachmentLoader.as +++ b/spine-starling/spine-starling/src/spine/starling/StarlingAtlasAttachmentLoader.as @@ -36,7 +36,7 @@ import spine.attachments.AttachmentLoader; import spine.attachments.BoundingBoxAttachment; import spine.attachments.MeshAttachment; import spine.attachments.RegionAttachment; -import spine.attachments.SkinnedMeshAttachment; +import spine.attachments.WeightedMeshAttachment; import starling.textures.SubTexture; import starling.textures.Texture; @@ -88,7 +88,7 @@ public class StarlingAtlasAttachmentLoader implements AttachmentLoader { public function newMeshAttachment (skin:Skin, name:String, path:String) : MeshAttachment { var texture:Texture = atlas.getTexture(path); if (texture == null) - throw new Error("Region not found in Starling atlas: " + path + " (region attachment: " + name + ")"); + throw new Error("Region not found in Starling atlas: " + path + " (mesh attachment: " + name + ")"); var attachment:MeshAttachment = new MeshAttachment(name); attachment.rendererObject = new SkeletonImage(Texture.fromTexture(texture)); // Discard frame. var subTexture:SubTexture = texture as SubTexture; @@ -115,11 +115,11 @@ public class StarlingAtlasAttachmentLoader implements AttachmentLoader { return attachment; } - public function newSkinnedMeshAttachment (skin:Skin, name:String, path:String) : SkinnedMeshAttachment { + public function newWeightedMeshAttachment (skin:Skin, name:String, path:String) : WeightedMeshAttachment { var texture:Texture = atlas.getTexture(path); if (texture == null) - throw new Error("Region not found in Starling atlas: " + path + " (region attachment: " + name + ")"); - var attachment:SkinnedMeshAttachment = new SkinnedMeshAttachment(name); + throw new Error("Region not found in Starling atlas: " + path + " (weighted mesh attachment: " + name + ")"); + var attachment:WeightedMeshAttachment = new WeightedMeshAttachment(name); attachment.rendererObject = new SkeletonImage(Texture.fromTexture(texture)); // Discard frame. var subTexture:SubTexture = texture as SubTexture; if (subTexture) {