diff --git a/spine-as3/spine-as3-example/src/Main.as b/spine-as3/spine-as3-example/src/Main.as index 201609764..7d16d92a5 100644 --- a/spine-as3/spine-as3-example/src/Main.as +++ b/spine-as3/spine-as3-example/src/Main.as @@ -70,9 +70,13 @@ public class Main extends Sprite { skeleton.setAnimationStateData(stateData); skeleton.x = 320; skeleton.y = 420; - skeleton.setAnimation("walk", true); - skeleton.addAnimation("jump", false, 3); - skeleton.addAnimation("walk", true); + if (true) { + skeleton.setAnimation("drawOrder", true); + } else { + skeleton.setAnimation("walk", true); + skeleton.addAnimation("jump", false, 3); + skeleton.addAnimation("walk", true); + } addChild(skeleton); } diff --git a/spine-as3/spine-as3-example/src/spineboy.json b/spine-as3/spine-as3-example/src/spineboy.json index 6a0587d9f..113e72c33 100644 --- a/spine-as3/spine-as3-example/src/spineboy.json +++ b/spine-as3/spine-as3-example/src/spineboy.json @@ -34,19 +34,42 @@ { "name": "neck", "bone": "neck", "attachment": "neck" }, { "name": "head", "bone": "head", "attachment": "head" }, { "name": "eyes", "bone": "head", "attachment": "eyes" }, - { "name": "right shoulder", "bone": "right shoulder", "attachment": "right-shoulder" }, + { "name": "right shoulder", "bone": "right shoulder", "attachment": "right-shoulder", "additive": true }, { "name": "right arm", "bone": "right arm", "attachment": "right-arm" }, - { "name": "right hand", "bone": "right hand", "attachment": "right-hand" } + { "name": "right hand", "bone": "right hand", "attachment": "right-hand" }, + { "name": "bb-head", "bone": "head", "attachment": "bb-head" } ], "skins": { "default": { + "bb-head": { + "bb-head": { + "type": "boundingbox", + "vertices": [ + 55.69696, + -44.60648, + 8.2226715, + -47.609646, + -11.244263, + -32.942703, + -0.05206299, + 35.835804, + 61.018433, + 43.227512, + 90.35846, + -16.054127, + 115.41275, + -32.817406, + 78.29431, + -56.05409 + ] + } + }, "eyes": { "eyes": { "x": 28.94, "y": -32.92, "rotation": -86.9, "width": 34, "height": 27 }, "eyes-closed": { "x": 28.77, "y": -32.86, "rotation": -86.9, "width": 34, "height": 27 } }, "head": { - "head": { "x": 53.94, "y": -5.75, "rotation": -86.9, "width": 121, "height": 132 }, - "left-foot": { "x": 53.94, "y": -5.75, "rotation": -86.9, "width": 65, "height": 30 } + "head": { "x": 53.94, "y": -5.75, "rotation": -86.9, "width": 121, "height": 132 } }, "left arm": { "left-arm": { "x": 15.11, "y": -0.44, "rotation": 33.84, "width": 35, "height": 29 } @@ -95,8 +118,198 @@ } } }, -"events": {}, +"events": { + "behind": {}, + "headAttach": {}, + "headPop": {} +}, "animations": { + "drawOrder": { + "bones": { + "head": { + "rotate": [ + { "time": 0, "angle": 0 }, + { "time": 0.4827, "angle": -23.11 }, + { "time": 0.8965, "angle": -56.45 }, + { "time": 1.3103, "angle": 1.38 }, + { "time": 1.7931, "angle": 36.12 }, + { "time": 2.1379, "angle": 1.24 }, + { "time": 2.6206, "angle": -37.12 }, + { "time": 2.9666, "angle": 2.07 }, + { "time": 3.4666, "angle": 34.72 }, + { "time": 3.9, "angle": 359.99 } + ], + "translate": [ + { + "time": 0, + "x": 0, + "y": 0, + "curve": [ 0.19, 0.4, 0.586, 0.75 ] + }, + { + "time": 0.2758, + "x": 57.88, + "y": -35.72, + "curve": [ 0.39, 0.54, 0.632, 0.72 ] + }, + { + "time": 0.4827, + "x": 87.26, + "y": -87.89, + "curve": [ 0.325, 0.23, 0.587, 0.36 ] + }, + { + "time": 0.6896, + "x": 28.89, + "y": -114.62, + "curve": [ 0.383, 0.23, 0.736, 0.55 ] + }, + { + "time": 0.8965, + "x": -76.58, + "y": -124.98, + "curve": [ 0.129, 0.21, 0.547, 0.64 ] + }, + { + "time": 1.1034, + "x": -154.37, + "y": -77.13, + "curve": [ 0.354, 0.48, 0.729, 0.9 ] + }, + { + "time": 1.3103, + "x": -181.02, + "y": 18.56, + "curve": [ 0.063, 0.15, 0.52, 0.62 ] + }, + { + "time": 1.5862, + "x": -150.38, + "y": 128.67, + "curve": [ 0.381, 0.54, 0.778, 1 ] + }, + { + "time": 1.7931, + "x": -112.08, + "y": 146.28, + "curve": [ 0.242, 0, 0.626, 0.45 ] + }, + { + "time": 1.931, + "x": -63.7, + "y": 111.22, + "curve": [ 0.398, 0.35, 0.786, 0.76 ] + }, + { + "time": 2.1379, + "x": -48.94, + "y": -1.55, + "curve": [ 0.188, 0.21, 0.575, 0.61 ] + }, + { + "time": 2.3448, + "x": -91.69, + "y": -91.93, + "curve": [ 0.362, 0.51, 0.766, 1 ] + }, + { + "time": 2.6206, + "x": -142.79, + "y": -126.83, + "curve": [ 0.227, 0.34, 0.593, 0.75 ] + }, + { + "time": 2.7586, + "x": -176.7, + "y": -98.32, + "curve": [ 0.26, 0.4, 0.612, 0.71 ] + }, + { + "time": 2.8965, + "x": -163.95, + "y": -24.04, + "curve": [ 0.338, 0.37, 0.676, 0.71 ] + }, + { + "time": 2.9655, + "x": -150.17, + "y": 10.71, + "curve": [ 0.387, 0.61, 0.741, 1 ] + }, + { + "time": 3.1034, + "x": -102.44, + "y": 45.92, + "curve": [ 0.31, 0.24, 0.648, 0.58 ] + }, + { + "time": 3.2413, + "x": -53.99, + "y": 70.39, + "curve": [ 0.325, 0.29, 0.663, 0.63 ] + }, + { + "time": 3.3793, + "x": 1.88, + "y": 55.54, + "curve": [ 0.387, 0.33, 0.769, 0.73 ] + }, + { + "time": 3.5862, + "x": 34.26, + "y": 36.13, + "curve": [ 0.206, 0.28, 0.596, 0.67 ] + }, + { + "time": 3.7931, + "x": 23.94, + "y": 1.01, + "curve": [ 0.373, 0.56, 0.759, 1 ] + }, + { "time": 4, "x": 0, "y": 0 } + ], + "scale": [ + { "time": 0.8275, "x": 1, "y": 1 }, + { "time": 1.3103, "x": 0.742, "y": 0.742 }, + { "time": 1.7931, "x": 1, "y": 1 }, + { "time": 2.1379, "x": 1.502, "y": 1.502 }, + { "time": 2.6206, "x": 1, "y": 1 }, + { "time": 2.9655, "x": 0.707, "y": 0.707 }, + { "time": 3.3793, "x": 1, "y": 1 } + ] + } + }, + "events": [ + { "time": 0, "name": "headPop", "string": "pop.wav" }, + { "time": 1.3103, "name": "behind" }, + { "time": 2.9655, "name": "behind" }, + { "time": 4, "name": "headAttach", "string": "attach.wav" } + ], + "draworder": [ + { + "time": 0.6206, + "offsets": [ + { "slot": "head", "offset": -12 }, + { "slot": "eyes", "offset": -12 } + ] + }, + { + "time": 1.7931, + "offsets": [ + { "slot": "head", "offset": 3 }, + { "slot": "eyes", "offset": 3 } + ] + }, + { + "time": 2.6206, + "offsets": [ + { "slot": "head", "offset": -12 }, + { "slot": "eyes", "offset": -12 } + ] + }, + { "time": 3.5862 } + ] + }, "jump": { "bones": { "hip": { @@ -508,21 +721,6 @@ } }, "walk": { - "slots": { - "head": { - "color": [ - { "time": 0, "color": "FFFFFFFF" }, - { "time": 0.5, "color": "FF0000FF" }, - { "time": 1.0666, "color": "FFFFFFFF" } - ] - }, - "eyes": { - "attachment": [ - { "time": 0.75, "name": "eyes-closed" }, - { "time": 0.9, "name": "eyes" } - ] - } - }, "bones": { "left upper leg": { "rotate": [ @@ -796,11 +994,6 @@ { "time": 0.8, "angle": 6.09 }, { "time": 0.9333, "angle": 2.28 }, { "time": 1.0666, "angle": 3.6 } - ], - "scale": [ - { "time": 0, "x": 1, "y": 1 }, - { "time": 0.5, "x": 2, "y": 1 }, - { "time": 1.0666, "x": 1, "y": 1 } ] } } diff --git a/spine-as3/spine-as3/src/spine/Bone.as b/spine-as3/spine-as3/src/spine/Bone.as index 34fa6f79c..fbca6a91c 100644 --- a/spine-as3/spine-as3/src/spine/Bone.as +++ b/spine-as3/spine-as3/src/spine/Bone.as @@ -68,9 +68,14 @@ public class Bone { if (_parent != null) { _worldX = x * _parent._m00 + y * _parent._m01 + _parent._worldX; _worldY = x * _parent._m10 + y * _parent._m11 + _parent._worldY; - _worldScaleX = _parent._worldScaleX * scaleX; - _worldScaleY = _parent._worldScaleY * scaleY; - _worldRotation = _parent._worldRotation + rotation; + if (_data.inheritScale) { + _worldScaleX = _parent._worldScaleX * scaleX; + _worldScaleY = _parent._worldScaleY * scaleY; + } else { + _worldScaleX = scaleX; + _worldScaleY = scaleY; + } + _worldRotation = _data.inheritRotation ? _parent._worldRotation + rotation : rotation; } else { _worldX = flipX ? -x : x; _worldY = flipY ? -y : y; diff --git a/spine-as3/spine-as3/src/spine/BoneData.as b/spine-as3/spine-as3/src/spine/BoneData.as index 5ad89e3c5..47fe6c595 100644 --- a/spine-as3/spine-as3/src/spine/BoneData.as +++ b/spine-as3/spine-as3/src/spine/BoneData.as @@ -42,6 +42,8 @@ public class BoneData { public var rotation:Number; public var scaleX:Number = 1; public var scaleY:Number = 1; + public var inheritScale:Boolean = true; + public var inheritRotation:Boolean = true; /** @param parent May be null. */ public function BoneData (name:String, parent:BoneData) { diff --git a/spine-as3/spine-as3/src/spine/SkeletonJson.as b/spine-as3/spine-as3/src/spine/SkeletonJson.as index 5402a8548..7083f9b38 100644 --- a/spine-as3/spine-as3/src/spine/SkeletonJson.as +++ b/spine-as3/spine-as3/src/spine/SkeletonJson.as @@ -96,6 +96,8 @@ public class SkeletonJson { boneData.rotation = (boneMap["rotation"] || 0); boneData.scaleX = boneMap["scaleX"] || 1; boneData.scaleY = boneMap["scaleY"] || 1; + boneData.inheritScale = boneMap["inheritScale"] || true; + boneData.inheritRotation = boneMap["inheritRotation"] || true; skeletonData.addBone(boneData); } @@ -116,6 +118,7 @@ public class SkeletonJson { } slotData.attachmentName = slotMap["attachment"]; + slotData.additiveBlending = slotMap["additive"]; skeletonData.addSlot(slotData); } diff --git a/spine-as3/spine-as3/src/spine/SlotData.as b/spine-as3/spine-as3/src/spine/SlotData.as index 5fc3008ee..4097a68a4 100644 --- a/spine-as3/spine-as3/src/spine/SlotData.as +++ b/spine-as3/spine-as3/src/spine/SlotData.as @@ -41,6 +41,7 @@ public class SlotData { public var b:Number = 1; public var a:Number = 1; public var attachmentName:String; + public var additiveBlending:Boolean; public function SlotData (name:String, boneData:BoneData) { if (name == null) diff --git a/spine-as3/spine-as3/src/spine/attachments/AtlasAttachmentLoader.as b/spine-as3/spine-as3/src/spine/attachments/AtlasAttachmentLoader.as index e57dd2f31..15c6bb6ca 100644 --- a/spine-as3/spine-as3/src/spine/attachments/AtlasAttachmentLoader.as +++ b/spine-as3/spine-as3/src/spine/attachments/AtlasAttachmentLoader.as @@ -61,6 +61,8 @@ public class AtlasAttachmentLoader implements AttachmentLoader { attachment.regionOriginalWidth = region.originalWidth; attachment.regionOriginalHeight = region.originalHeight; return attachment; + case AttachmentType.boundingbox: + return new BoundingBoxAttachment(name); } throw new Error("Unknown attachment type: " + type); } diff --git a/spine-as3/spine-as3/src/spine/attachments/AttachmentType.as b/spine-as3/spine-as3/src/spine/attachments/AttachmentType.as index e535c51fc..96a90fca7 100644 --- a/spine-as3/spine-as3/src/spine/attachments/AttachmentType.as +++ b/spine-as3/spine-as3/src/spine/attachments/AttachmentType.as @@ -35,7 +35,8 @@ package spine.attachments { public class AttachmentType { public static const region:AttachmentType = new AttachmentType(0, "region"); - public static const regionSequence:AttachmentType = new AttachmentType(1, "regionSequence"); + public static const regionsequence:AttachmentType = new AttachmentType(1, "regionsequence"); + public static const boundingbox:AttachmentType = new AttachmentType(1, "boundingbox"); public var ordinal:int; public var name:String; diff --git a/spine-as3/spine-as3/src/spine/attachments/BoundingBoxAttachment.as b/spine-as3/spine-as3/src/spine/attachments/BoundingBoxAttachment.as new file mode 100644 index 000000000..074a48585 --- /dev/null +++ b/spine-as3/spine-as3/src/spine/attachments/BoundingBoxAttachment.as @@ -0,0 +1,61 @@ +/****************************************************************************** + * Spine Runtime Software License - Version 1.0 + * + * Copyright (c) 2013, Esoteric Software + * All rights reserved. + * + * Redistribution and use in source and binary forms in whole or in part, with + * or without modification, are permitted provided that the following conditions + * are met: + * + * 1. A Spine Single User License or Spine Professional License must be + * purchased from Esoteric Software and the license must remain valid: + * http://esotericsoftware.com/ + * 2. Redistributions of source code must retain this license, which is the + * above copyright notice, this declaration of conditions and the following + * disclaimer. + * 3. Redistributions in binary form must reproduce this license, which is the + * above copyright notice, this declaration of conditions and the following + * disclaimer, in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +package spine.attachments { +import spine.Bone; + +public dynamic class BoundingBoxAttachment extends Attachment { + public var vertices:Vector. = new Vector.(); + + public function BoundingBoxAttachment (name:String) { + super(name); + } + + public function computeWorldVertices (x:Number, y:Number, bone:Bone, worldVertices:Vector.) : void { + x += bone.worldX; + y += bone.worldY; + var m00:Number = bone.m00; + var m01:Number = bone.m01; + var m10:Number = bone.m10; + var m11:Number = bone.m11; + var vertices:Vector. = this.vertices; + for (var i:int = 0, n:int = vertices.length; i < n; i += 2) { + var px:Number = vertices[i]; + var py:Number = vertices[i + 1]; + worldVertices[i] = px * m00 + py * m01 + x; + worldVertices[i + 1] = px * m10 + py * m11 + y; + } + } +} + +} diff --git a/spine-as3/spine-as3/src/spine/attachments/RegionAttachment.as b/spine-as3/spine-as3/src/spine/attachments/RegionAttachment.as index a2ba489d3..aec25b049 100644 --- a/spine-as3/spine-as3/src/spine/attachments/RegionAttachment.as +++ b/spine-as3/spine-as3/src/spine/attachments/RegionAttachment.as @@ -119,7 +119,7 @@ public dynamic class RegionAttachment extends Attachment { offset[Y4] = localYCos + localX2Sin; } - public function computeVertices (x:Number, y:Number, bone:Bone, vertices:Vector.) : void { + public function computeWorldVertices (x:Number, y:Number, bone:Bone, vertices:Vector.) : void { x += bone.worldX; y += bone.worldY; var m00:Number = bone.m00; diff --git a/spine-as3/spine-as3/src/spine/flash/SkeletonSprite.as b/spine-as3/spine-as3/src/spine/flash/SkeletonSprite.as index 5fbb370ca..947b7e57e 100644 --- a/spine-as3/spine-as3/src/spine/flash/SkeletonSprite.as +++ b/spine-as3/spine-as3/src/spine/flash/SkeletonSprite.as @@ -34,6 +34,7 @@ package spine.flash { import flash.display.Bitmap; import flash.display.BitmapData; +import flash.display.BlendMode; import flash.display.DisplayObject; import flash.display.DisplayObjectContainer; import flash.display.Sprite; @@ -128,6 +129,8 @@ public class SkeletonSprite extends Sprite { regionAttachment["wrapper"] = wrapper; } + wrapper.blendMode = slot.data.additiveBlending ? BlendMode.ADD : BlendMode.NORMAL; + var colorTransform:ColorTransform = wrapper.transform.colorTransform; colorTransform.redMultiplier = skeleton.r * slot.r; colorTransform.greenMultiplier = skeleton.g * slot.g; diff --git a/spine-starling/spine-starling-example/src/spineboy.json b/spine-starling/spine-starling-example/src/spineboy.json index 6a0587d9f..113e72c33 100644 --- a/spine-starling/spine-starling-example/src/spineboy.json +++ b/spine-starling/spine-starling-example/src/spineboy.json @@ -34,19 +34,42 @@ { "name": "neck", "bone": "neck", "attachment": "neck" }, { "name": "head", "bone": "head", "attachment": "head" }, { "name": "eyes", "bone": "head", "attachment": "eyes" }, - { "name": "right shoulder", "bone": "right shoulder", "attachment": "right-shoulder" }, + { "name": "right shoulder", "bone": "right shoulder", "attachment": "right-shoulder", "additive": true }, { "name": "right arm", "bone": "right arm", "attachment": "right-arm" }, - { "name": "right hand", "bone": "right hand", "attachment": "right-hand" } + { "name": "right hand", "bone": "right hand", "attachment": "right-hand" }, + { "name": "bb-head", "bone": "head", "attachment": "bb-head" } ], "skins": { "default": { + "bb-head": { + "bb-head": { + "type": "boundingbox", + "vertices": [ + 55.69696, + -44.60648, + 8.2226715, + -47.609646, + -11.244263, + -32.942703, + -0.05206299, + 35.835804, + 61.018433, + 43.227512, + 90.35846, + -16.054127, + 115.41275, + -32.817406, + 78.29431, + -56.05409 + ] + } + }, "eyes": { "eyes": { "x": 28.94, "y": -32.92, "rotation": -86.9, "width": 34, "height": 27 }, "eyes-closed": { "x": 28.77, "y": -32.86, "rotation": -86.9, "width": 34, "height": 27 } }, "head": { - "head": { "x": 53.94, "y": -5.75, "rotation": -86.9, "width": 121, "height": 132 }, - "left-foot": { "x": 53.94, "y": -5.75, "rotation": -86.9, "width": 65, "height": 30 } + "head": { "x": 53.94, "y": -5.75, "rotation": -86.9, "width": 121, "height": 132 } }, "left arm": { "left-arm": { "x": 15.11, "y": -0.44, "rotation": 33.84, "width": 35, "height": 29 } @@ -95,8 +118,198 @@ } } }, -"events": {}, +"events": { + "behind": {}, + "headAttach": {}, + "headPop": {} +}, "animations": { + "drawOrder": { + "bones": { + "head": { + "rotate": [ + { "time": 0, "angle": 0 }, + { "time": 0.4827, "angle": -23.11 }, + { "time": 0.8965, "angle": -56.45 }, + { "time": 1.3103, "angle": 1.38 }, + { "time": 1.7931, "angle": 36.12 }, + { "time": 2.1379, "angle": 1.24 }, + { "time": 2.6206, "angle": -37.12 }, + { "time": 2.9666, "angle": 2.07 }, + { "time": 3.4666, "angle": 34.72 }, + { "time": 3.9, "angle": 359.99 } + ], + "translate": [ + { + "time": 0, + "x": 0, + "y": 0, + "curve": [ 0.19, 0.4, 0.586, 0.75 ] + }, + { + "time": 0.2758, + "x": 57.88, + "y": -35.72, + "curve": [ 0.39, 0.54, 0.632, 0.72 ] + }, + { + "time": 0.4827, + "x": 87.26, + "y": -87.89, + "curve": [ 0.325, 0.23, 0.587, 0.36 ] + }, + { + "time": 0.6896, + "x": 28.89, + "y": -114.62, + "curve": [ 0.383, 0.23, 0.736, 0.55 ] + }, + { + "time": 0.8965, + "x": -76.58, + "y": -124.98, + "curve": [ 0.129, 0.21, 0.547, 0.64 ] + }, + { + "time": 1.1034, + "x": -154.37, + "y": -77.13, + "curve": [ 0.354, 0.48, 0.729, 0.9 ] + }, + { + "time": 1.3103, + "x": -181.02, + "y": 18.56, + "curve": [ 0.063, 0.15, 0.52, 0.62 ] + }, + { + "time": 1.5862, + "x": -150.38, + "y": 128.67, + "curve": [ 0.381, 0.54, 0.778, 1 ] + }, + { + "time": 1.7931, + "x": -112.08, + "y": 146.28, + "curve": [ 0.242, 0, 0.626, 0.45 ] + }, + { + "time": 1.931, + "x": -63.7, + "y": 111.22, + "curve": [ 0.398, 0.35, 0.786, 0.76 ] + }, + { + "time": 2.1379, + "x": -48.94, + "y": -1.55, + "curve": [ 0.188, 0.21, 0.575, 0.61 ] + }, + { + "time": 2.3448, + "x": -91.69, + "y": -91.93, + "curve": [ 0.362, 0.51, 0.766, 1 ] + }, + { + "time": 2.6206, + "x": -142.79, + "y": -126.83, + "curve": [ 0.227, 0.34, 0.593, 0.75 ] + }, + { + "time": 2.7586, + "x": -176.7, + "y": -98.32, + "curve": [ 0.26, 0.4, 0.612, 0.71 ] + }, + { + "time": 2.8965, + "x": -163.95, + "y": -24.04, + "curve": [ 0.338, 0.37, 0.676, 0.71 ] + }, + { + "time": 2.9655, + "x": -150.17, + "y": 10.71, + "curve": [ 0.387, 0.61, 0.741, 1 ] + }, + { + "time": 3.1034, + "x": -102.44, + "y": 45.92, + "curve": [ 0.31, 0.24, 0.648, 0.58 ] + }, + { + "time": 3.2413, + "x": -53.99, + "y": 70.39, + "curve": [ 0.325, 0.29, 0.663, 0.63 ] + }, + { + "time": 3.3793, + "x": 1.88, + "y": 55.54, + "curve": [ 0.387, 0.33, 0.769, 0.73 ] + }, + { + "time": 3.5862, + "x": 34.26, + "y": 36.13, + "curve": [ 0.206, 0.28, 0.596, 0.67 ] + }, + { + "time": 3.7931, + "x": 23.94, + "y": 1.01, + "curve": [ 0.373, 0.56, 0.759, 1 ] + }, + { "time": 4, "x": 0, "y": 0 } + ], + "scale": [ + { "time": 0.8275, "x": 1, "y": 1 }, + { "time": 1.3103, "x": 0.742, "y": 0.742 }, + { "time": 1.7931, "x": 1, "y": 1 }, + { "time": 2.1379, "x": 1.502, "y": 1.502 }, + { "time": 2.6206, "x": 1, "y": 1 }, + { "time": 2.9655, "x": 0.707, "y": 0.707 }, + { "time": 3.3793, "x": 1, "y": 1 } + ] + } + }, + "events": [ + { "time": 0, "name": "headPop", "string": "pop.wav" }, + { "time": 1.3103, "name": "behind" }, + { "time": 2.9655, "name": "behind" }, + { "time": 4, "name": "headAttach", "string": "attach.wav" } + ], + "draworder": [ + { + "time": 0.6206, + "offsets": [ + { "slot": "head", "offset": -12 }, + { "slot": "eyes", "offset": -12 } + ] + }, + { + "time": 1.7931, + "offsets": [ + { "slot": "head", "offset": 3 }, + { "slot": "eyes", "offset": 3 } + ] + }, + { + "time": 2.6206, + "offsets": [ + { "slot": "head", "offset": -12 }, + { "slot": "eyes", "offset": -12 } + ] + }, + { "time": 3.5862 } + ] + }, "jump": { "bones": { "hip": { @@ -508,21 +721,6 @@ } }, "walk": { - "slots": { - "head": { - "color": [ - { "time": 0, "color": "FFFFFFFF" }, - { "time": 0.5, "color": "FF0000FF" }, - { "time": 1.0666, "color": "FFFFFFFF" } - ] - }, - "eyes": { - "attachment": [ - { "time": 0.75, "name": "eyes-closed" }, - { "time": 0.9, "name": "eyes" } - ] - } - }, "bones": { "left upper leg": { "rotate": [ @@ -796,11 +994,6 @@ { "time": 0.8, "angle": 6.09 }, { "time": 0.9333, "angle": 2.28 }, { "time": 1.0666, "angle": 3.6 } - ], - "scale": [ - { "time": 0, "x": 1, "y": 1 }, - { "time": 0.5, "x": 2, "y": 1 }, - { "time": 1.0666, "x": 1, "y": 1 } ] } } diff --git a/spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as b/spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as index e916ba160..5928676c7 100644 --- a/spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as +++ b/spine-starling/spine-starling/src/spine/starling/SkeletonSprite.as @@ -36,16 +36,17 @@ import flash.geom.Matrix; import flash.geom.Point; import flash.geom.Rectangle; -import spine.attachments.RegionAttachment; - -import starling.animation.IAnimatable; -import starling.core.RenderSupport; -import starling.display.DisplayObject; -import starling.utils.MatrixUtil; import spine.Bone; import spine.Skeleton; import spine.SkeletonData; import spine.Slot; +import spine.attachments.RegionAttachment; + +import starling.animation.IAnimatable; +import starling.core.RenderSupport; +import starling.display.BlendMode; +import starling.display.DisplayObject; +import starling.utils.MatrixUtil; public class SkeletonSprite extends DisplayObject implements IAnimatable { static private var tempPoint:Point = new Point(); @@ -75,7 +76,7 @@ public class SkeletonSprite extends DisplayObject implements IAnimatable { var regionAttachment:RegionAttachment = slot.attachment as RegionAttachment; if (regionAttachment != null) { var vertices:Vector. = this.vertices; - regionAttachment.computeVertices(skeleton.x, skeleton.y, slot.bone, vertices); + regionAttachment.computeWorldVertices(skeleton.x, skeleton.y, slot.bone, vertices); var r:Number = skeleton.r * slot.r; var g:Number = skeleton.g * slot.g; var b:Number = skeleton.b * slot.b; @@ -113,6 +114,7 @@ public class SkeletonSprite extends DisplayObject implements IAnimatable { vertexData[29] = a; image.updateVertices(); + support.blendMode = slot.data.additiveBlending ? BlendMode.ADD : BlendMode.NORMAL; support.batchQuad(image, alpha, image.texture); } } @@ -133,7 +135,7 @@ public class SkeletonSprite extends DisplayObject implements IAnimatable { continue; var vertices:Vector. = this.vertices; - regionAttachment.computeVertices(skeleton.x, skeleton.y, slot.bone, vertices); + regionAttachment.computeWorldVertices(skeleton.x, skeleton.y, slot.bone, vertices); value = vertices[0]; if (value < minX) diff --git a/spine-starling/spine-starling/src/spine/starling/StarlingAtlasAttachmentLoader.as b/spine-starling/spine-starling/src/spine/starling/StarlingAtlasAttachmentLoader.as index 7cb93bbf9..2e457f67a 100644 --- a/spine-starling/spine-starling/src/spine/starling/StarlingAtlasAttachmentLoader.as +++ b/spine-starling/spine-starling/src/spine/starling/StarlingAtlasAttachmentLoader.as @@ -39,6 +39,7 @@ import spine.Skin; import spine.attachments.Attachment; import spine.attachments.AttachmentLoader; import spine.attachments.AttachmentType; +import spine.attachments.BoundingBoxAttachment; import spine.attachments.RegionAttachment; import starling.textures.Texture; @@ -54,7 +55,8 @@ public class StarlingAtlasAttachmentLoader implements AttachmentLoader { } public function newAttachment (skin:Skin, type:AttachmentType, name:String) : Attachment { - if (type == AttachmentType.region) { + switch (type) { + case AttachmentType.region: var regionAttachment:RegionAttachment = new RegionAttachment(name); var texture:Texture = atlas.getTexture(name); var frame:Rectangle = texture.frame; @@ -67,6 +69,8 @@ public class StarlingAtlasAttachmentLoader implements AttachmentLoader { regionAttachment.regionOriginalWidth = texture.width; regionAttachment.regionOriginalHeight = texture.height; return regionAttachment; + case AttachmentType.boundingbox: + return new BoundingBoxAttachment(name); } throw new Error("Unknown attachment type: " + type);