From 9fcc5a8b8c814c848df1efd28d40f5b656ad7ad4 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 16 Jul 2025 01:34:53 +0200 Subject: [PATCH] [haxe] Formatting --- formatters/format-haxe.sh | 9 +- formatters/format.sh | 4 +- spine-haxe/example/src/Main.hx | 131 ++++--- spine-haxe/example/src/MainFlixel.hx | 8 +- spine-haxe/example/src/MainStarling.hx | 2 +- .../flixelExamples/AnimationBoundExample.hx | 3 +- .../src/flixelExamples/BasicExample.hx | 33 +- .../flixelExamples/CelestialCircusExample.hx | 30 +- .../src/flixelExamples/CloudPotExample.hx | 3 +- .../src/flixelExamples/ControlBonesExample.hx | 23 +- .../src/flixelExamples/EventsExample.hx | 8 +- .../example/src/flixelExamples/FlixelState.hx | 32 +- .../src/flixelExamples/MixAndMatchExample.hx | 10 +- .../example/src/flixelExamples/SackExample.hx | 3 +- .../src/flixelExamples/SequenceExample.hx | 5 +- .../src/flixelExamples/SnowglobeExample.hx | 3 +- .../example/src/flixelExamples/TankExample.hx | 3 +- .../example/src/flixelExamples/VineExample.hx | 3 +- .../starlingExamples/AnimationBoundExample.hx | 15 +- .../src/starlingExamples/BasicExample.hx | 2 +- .../CelestialCircusExample.hx | 13 +- .../src/starlingExamples/CloudPotExample.hx | 3 +- .../starlingExamples/ControlBonesExample.hx | 11 +- .../src/starlingExamples/EventsExample.hx | 6 +- .../starlingExamples/MixAndMatchExample.hx | 2 +- .../src/starlingExamples/SackExample.hx | 4 +- .../example/src/starlingExamples/Scene.hx | 2 +- .../src/starlingExamples/SequenceExample.hx | 2 +- .../src/starlingExamples/SnowglobeExample.hx | 5 +- .../src/starlingExamples/TankExample.hx | 2 +- .../example/src/starlingExamples/Test.hx | 2 +- .../src/starlingExamples/VineExample.hx | 2 +- spine-haxe/spine-haxe/spine/ArrayUtils.hx | 2 +- spine-haxe/spine-haxe/spine/BinaryInput.hx | 2 +- spine-haxe/spine-haxe/spine/BlendMode.hx | 2 +- spine-haxe/spine-haxe/spine/Bone.hx | 7 +- spine-haxe/spine-haxe/spine/BoneData.hx | 12 +- spine-haxe/spine-haxe/spine/BoneLocal.hx | 18 +- spine-haxe/spine-haxe/spine/BonePose.hx | 70 ++-- spine-haxe/spine-haxe/spine/Color.hx | 2 +- spine-haxe/spine-haxe/spine/Constraint.hx | 15 +- spine-haxe/spine-haxe/spine/ConstraintData.hx | 7 +- spine-haxe/spine-haxe/spine/Event.hx | 5 +- spine-haxe/spine-haxe/spine/EventData.hx | 2 +- .../spine-haxe/spine/HasTextureRegion.hx | 6 +- spine-haxe/spine-haxe/spine/IkConstraint.hx | 67 ++-- .../spine-haxe/spine/IkConstraintData.hx | 11 +- .../spine-haxe/spine/IkConstraintPose.hx | 23 +- spine-haxe/spine-haxe/spine/Inherit.hx | 2 +- spine-haxe/spine-haxe/spine/MathUtils.hx | 4 +- spine-haxe/spine-haxe/spine/PathConstraint.hx | 97 ++++-- .../spine-haxe/spine/PathConstraintData.hx | 26 +- .../spine-haxe/spine/PathConstraintPose.hx | 6 +- spine-haxe/spine-haxe/spine/Physics.hx | 5 +- .../spine-haxe/spine/PhysicsConstraint.hx | 61 ++-- .../spine-haxe/spine/PhysicsConstraintData.hx | 8 +- .../spine-haxe/spine/PhysicsConstraintPose.hx | 9 +- spine-haxe/spine-haxe/spine/Polygon.hx | 2 +- spine-haxe/spine-haxe/spine/Pool.hx | 2 +- spine-haxe/spine-haxe/spine/Poolable.hx | 2 +- spine-haxe/spine-haxe/spine/Pose.hx | 6 +- spine-haxe/spine-haxe/spine/Posed.hx | 25 +- spine-haxe/spine-haxe/spine/PosedActive.hx | 9 +- spine-haxe/spine-haxe/spine/PosedData.hx | 15 +- spine-haxe/spine-haxe/spine/PositionMode.hx | 2 +- spine-haxe/spine-haxe/spine/Rectangle.hx | 2 +- spine-haxe/spine-haxe/spine/RotateMode.hx | 3 +- spine-haxe/spine-haxe/spine/Sequence.hx | 3 +- spine-haxe/spine-haxe/spine/SequenceMode.hx | 2 +- spine-haxe/spine-haxe/spine/Skeleton.hx | 83 +++-- spine-haxe/spine-haxe/spine/SkeletonBinary.hx | 217 +++++++----- .../spine-haxe/spine/SkeletonClipping.hx | 14 +- spine-haxe/spine-haxe/spine/SkeletonData.hx | 39 ++- spine-haxe/spine-haxe/spine/SkeletonJson.hx | 327 +++++++++++------- spine-haxe/spine-haxe/spine/Skin.hx | 11 +- spine-haxe/spine-haxe/spine/SkinEntry.hx | 4 +- spine-haxe/spine-haxe/spine/Slider.hx | 38 +- spine-haxe/spine-haxe/spine/SliderData.hx | 14 +- spine-haxe/spine-haxe/spine/SliderPose.hx | 9 +- spine-haxe/spine-haxe/spine/Slot.hx | 17 +- spine-haxe/spine-haxe/spine/SlotData.hx | 10 +- spine-haxe/spine-haxe/spine/SlotPose.hx | 46 +-- spine-haxe/spine-haxe/spine/SpacingMode.hx | 2 +- spine-haxe/spine-haxe/spine/SpineException.hx | 2 +- spine-haxe/spine-haxe/spine/TextureRegion.hx | 2 +- .../spine-haxe/spine/TransformConstraint.hx | 24 +- .../spine/TransformConstraintData.hx | 155 +++++---- .../spine/TransformConstraintPose.hx | 21 +- spine-haxe/spine-haxe/spine/Triangulator.hx | 2 +- spine-haxe/spine-haxe/spine/Update.hx | 2 +- spine-haxe/spine-haxe/spine/Vertex.hx | 2 +- .../spine/animation/AlphaTimeline.hx | 10 +- .../spine-haxe/spine/animation/Animation.hx | 24 +- .../spine/animation/AnimationState.hx | 32 +- .../spine/animation/AnimationStateData.hx | 2 +- .../spine/animation/AttachmentTimeline.hx | 16 +- .../spine/animation/BoneTimeline.hx | 2 +- .../spine/animation/BoneTimeline1.hx | 18 +- .../spine/animation/BoneTimeline2.hx | 14 +- .../spine/animation/ConstraintTimeline.hx | 2 +- .../spine/animation/ConstraintTimeline1.hx | 6 +- .../spine/animation/CurveTimeline.hx | 2 +- .../spine/animation/CurveTimeline1.hx | 76 ++-- .../spine/animation/DeformTimeline.hx | 19 +- .../spine/animation/DrawOrderTimeline.hx | 7 +- .../spine-haxe/spine/animation/EventQueue.hx | 5 +- .../spine/animation/EventTimeline.hx | 12 +- .../spine-haxe/spine/animation/EventType.hx | 2 +- .../spine/animation/IkConstraintTimeline.hx | 19 +- .../spine/animation/InheritTimeline.hx | 20 +- .../spine-haxe/spine/animation/Listeners.hx | 2 +- .../spine-haxe/spine/animation/MixBlend.hx | 30 +- .../spine/animation/MixDirection.hx | 2 +- .../animation/PathConstraintMixTimeline.hx | 12 +- .../PathConstraintPositionTimeline.hx | 8 +- .../PathConstraintSpacingTimeline.hx | 7 +- .../PhysicsConstraintDampingTimeline.hx | 9 +- .../PhysicsConstraintGravityTimeline.hx | 9 +- .../PhysicsConstraintInertiaTimeline.hx | 9 +- .../PhysicsConstraintMassTimeline.hx | 9 +- .../animation/PhysicsConstraintMixTimeline.hx | 9 +- .../PhysicsConstraintResetTimeline.hx | 18 +- .../PhysicsConstraintStrengthTimeline.hx | 9 +- .../animation/PhysicsConstraintTimeline.hx | 13 +- .../PhysicsConstraintWindTimeline.hx | 9 +- .../spine-haxe/spine/animation/Property.hx | 4 +- .../spine/animation/RGB2Timeline.hx | 8 +- .../spine/animation/RGBA2Timeline.hx | 16 +- .../spine/animation/RGBATimeline.hx | 8 +- .../spine-haxe/spine/animation/RGBTimeline.hx | 4 +- .../spine/animation/RotateTimeline.hx | 4 +- .../spine/animation/ScaleTimeline.hx | 4 +- .../spine/animation/ScaleXTimeline.hx | 4 +- .../spine/animation/ScaleYTimeline.hx | 4 +- .../spine/animation/SequenceTimeline.hx | 19 +- .../spine/animation/ShearTimeline.hx | 4 +- .../spine/animation/ShearXTimeline.hx | 4 +- .../spine/animation/ShearYTimeline.hx | 4 +- .../spine/animation/SliderMixTimeline.hx | 9 +- .../spine/animation/SliderTimeline.hx | 9 +- .../spine/animation/SlotCurveTimeline.hx | 16 +- .../spine/animation/SlotTimeline.hx | 2 +- .../spine-haxe/spine/animation/Timeline.hx | 7 +- .../spine-haxe/spine/animation/TrackEntry.hx | 54 ++- .../animation/TransformConstraintTimeline.hx | 12 +- .../spine/animation/TranslateTimeline.hx | 4 +- .../spine/animation/TranslateXTimeline.hx | 4 +- .../spine/animation/TranslateYTimeline.hx | 4 +- spine-haxe/spine-haxe/spine/atlas/Format.hx | 2 +- .../spine-haxe/spine/atlas/TextureAtlas.hx | 2 +- .../spine/atlas/TextureAtlasPage.hx | 2 +- .../spine/atlas/TextureAtlasRegion.hx | 2 +- .../spine-haxe/spine/atlas/TextureFilter.hx | 2 +- .../spine-haxe/spine/atlas/TextureLoader.hx | 2 +- .../spine-haxe/spine/atlas/TextureWrap.hx | 2 +- .../attachments/AtlasAttachmentLoader.hx | 2 +- .../spine/attachments/Attachment.hx | 2 +- .../spine/attachments/AttachmentLoader.hx | 2 +- .../spine/attachments/AttachmentType.hx | 2 +- .../attachments/BoundingBoxAttachment.hx | 2 +- .../spine/attachments/ClippingAttachment.hx | 3 +- .../spine/attachments/MeshAttachment.hx | 14 +- .../spine/attachments/PathAttachment.hx | 5 +- .../spine/attachments/PointAttachment.hx | 7 +- .../spine/attachments/RegionAttachment.hx | 12 +- .../spine/attachments/VertexAttachment.hx | 13 +- .../spine/flixel/FlixelTextureLoader.hx | 11 +- .../spine-haxe/spine/flixel/SkeletonMesh.hx | 2 +- .../spine-haxe/spine/flixel/SkeletonSprite.hx | 78 ++--- .../spine-haxe/spine/flixel/SpineTexture.hx | 10 +- .../spine-haxe/spine/starling/SkeletonMesh.hx | 2 +- .../spine/starling/SkeletonSprite.hx | 28 +- .../spine/starling/StarlingTextureLoader.hx | 2 +- 173 files changed, 1591 insertions(+), 1238 deletions(-) diff --git a/formatters/format-haxe.sh b/formatters/format-haxe.sh index d034523d9..4830e938d 100755 --- a/formatters/format-haxe.sh +++ b/formatters/format-haxe.sh @@ -5,11 +5,10 @@ set -e echo "Formatting Haxe files..." if command -v haxelib &> /dev/null && haxelib list formatter &> /dev/null; then - find .. -name "*.hx" \ - -not -path "*/.*" \ - -not -path "*/node_modules/*" \ - -not -path "*/build/*" \ - | xargs haxelib run formatter -s + # Format spine-haxe directory + if [ -d ../spine-haxe ]; then + haxelib run formatter -s ../spine-haxe + fi else echo "Warning: haxe formatter not found. Install with: haxelib install formatter" fi \ No newline at end of file diff --git a/formatters/format.sh b/formatters/format.sh index f22b003c3..885e484b5 100755 --- a/formatters/format.sh +++ b/formatters/format.sh @@ -32,9 +32,9 @@ show_help() { echo "" echo "Tools used:" echo " Java: Spotless with Eclipse formatter" - echo " TypeScript: Biome" + echo " TypeScript: tsfmt (typescript-formatter)" echo " C/C++: clang-format" - echo " C#: dotnet-format" + echo " C#: dotnet format" echo " Haxe: haxe formatter" echo " Dart: dart format" echo " Swift: swift-format" diff --git a/spine-haxe/example/src/Main.hx b/spine-haxe/example/src/Main.hx index cfed97b92..9d05f1f17 100644 --- a/spine-haxe/example/src/Main.hx +++ b/spine-haxe/example/src/Main.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package; @@ -35,63 +35,61 @@ import starlingExamples.Scene.SceneManager; import starling.core.Starling; import flixel.FlxG; import flixel.FlxGame; - import openfl.display.Sprite; import openfl.text.TextField; import openfl.text.TextFormat; import openfl.events.MouseEvent; - import openfl.geom.Rectangle; import starling.events.Event; class Main extends Sprite { - private var background:Sprite; + private var background:Sprite; private var flixelButton:Sprite; - private var starlingButton:Sprite; + private var starlingButton:Sprite; private var uiContainer:Sprite; private static inline var ratio = 4; - private static inline var STAGE_WIDTH:Int = 100 * ratio; - private static inline var STAGE_HEIGHT:Int = 200 * ratio; - private static inline var BUTTON_WIDTH:Int = 80 * ratio; - private static inline var BUTTON_HEIGHT:Int = 40 * ratio; - private static inline var BUTTON_SPACING:Int = 20 * ratio; + private static inline var STAGE_WIDTH:Int = 100 * ratio; + private static inline var STAGE_HEIGHT:Int = 200 * ratio; + private static inline var BUTTON_WIDTH:Int = 80 * ratio; + private static inline var BUTTON_HEIGHT:Int = 40 * ratio; + private static inline var BUTTON_SPACING:Int = 20 * ratio; - public function new() { - super(); - addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); - } + public function new() { + super(); + addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); + } - private function onAddedToStage(e:Event):Void { - removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage); - createUI(); - centerUI(); - stage.addEventListener(Event.RESIZE, onResize); - } + private function onAddedToStage(e:Event):Void { + removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage); + createUI(); + centerUI(); + stage.addEventListener(Event.RESIZE, onResize); + } - private function createUI():Void { - uiContainer = new Sprite(); - addChild(uiContainer); + private function createUI():Void { + uiContainer = new Sprite(); + addChild(uiContainer); - background = new Sprite(); - background.graphics.beginFill(0xA2A2A2); - background.graphics.drawRect(0, 0, STAGE_WIDTH, STAGE_HEIGHT); - background.graphics.endFill(); - uiContainer.addChild(background); + background = new Sprite(); + background.graphics.beginFill(0xA2A2A2); + background.graphics.drawRect(0, 0, STAGE_WIDTH, STAGE_HEIGHT); + background.graphics.endFill(); + uiContainer.addChild(background); - flixelButton = createButton("Flixel", 0xFF0000); - uiContainer.addChild(flixelButton); + flixelButton = createButton("Flixel", 0xFF0000); + uiContainer.addChild(flixelButton); - starlingButton = createButton("Starling", 0x00FF00); - uiContainer.addChild(starlingButton); + starlingButton = createButton("Starling", 0x00FF00); + uiContainer.addChild(starlingButton); - positionButtons(); + positionButtons(); - flixelButton.addEventListener(MouseEvent.CLICK, onFlixelClick); - starlingButton.addEventListener(MouseEvent.CLICK, onStarlingClick); - } + flixelButton.addEventListener(MouseEvent.CLICK, onFlixelClick); + starlingButton.addEventListener(MouseEvent.CLICK, onStarlingClick); + } - private function createButton(label:String, color:Int):Sprite { + private function createButton(label:String, color:Int):Sprite { var button = new Sprite(); var g = button.graphics; @@ -116,53 +114,54 @@ class Main extends Sprite { return button; } - private function positionButtons():Void { - var totalHeight = (BUTTON_HEIGHT * 2) + BUTTON_SPACING; - var startY = (STAGE_HEIGHT - totalHeight) / 2; + private function positionButtons():Void { + var totalHeight = (BUTTON_HEIGHT * 2) + BUTTON_SPACING; + var startY = (STAGE_HEIGHT - totalHeight) / 2; - flixelButton.x = (STAGE_WIDTH - BUTTON_WIDTH) / 2; - flixelButton.y = startY + BUTTON_HEIGHT + BUTTON_SPACING; + flixelButton.x = (STAGE_WIDTH - BUTTON_WIDTH) / 2; + flixelButton.y = startY + BUTTON_HEIGHT + BUTTON_SPACING; - starlingButton.x = (STAGE_WIDTH - BUTTON_WIDTH) / 2; - starlingButton.y = startY; - } + starlingButton.x = (STAGE_WIDTH - BUTTON_WIDTH) / 2; + starlingButton.y = startY; + } private function centerUI():Void { - uiContainer.x = (stage.stageWidth - STAGE_WIDTH) / 2; - uiContainer.y = (stage.stageHeight - STAGE_HEIGHT) / 2; - } + uiContainer.x = (stage.stageWidth - STAGE_WIDTH) / 2; + uiContainer.y = (stage.stageHeight - STAGE_HEIGHT) / 2; + } - private function onResize(e:Event):Void { - centerUI(); - } + private function onResize(e:Event):Void { + centerUI(); + } - private function onFlixelClick(e:MouseEvent):Void { - trace("Launching Flixel game"); + private function onFlixelClick(e:MouseEvent):Void { + trace("Launching Flixel game"); destroyUI(); addChild(new FlxGame(640, 480, FlixelState)); FlxG.autoPause = false; - } + } private function destroyUI():Void { - flixelButton.removeEventListener(MouseEvent.CLICK, onFlixelClick); - starlingButton.removeEventListener(MouseEvent.CLICK, onStarlingClick); - stage.removeEventListener(Event.RESIZE, onResize); + flixelButton.removeEventListener(MouseEvent.CLICK, onFlixelClick); + starlingButton.removeEventListener(MouseEvent.CLICK, onStarlingClick); + stage.removeEventListener(Event.RESIZE, onResize); - removeChild(uiContainer); + removeChild(uiContainer); - background = null; - flixelButton = null; - starlingButton = null; - uiContainer = null; - } + background = null; + flixelButton = null; + starlingButton = null; + uiContainer = null; + } private var starlingSingleton:Starling; - private function onStarlingClick(e:MouseEvent):Void { - trace("Launching Starling game"); + + private function onStarlingClick(e:MouseEvent):Void { + trace("Launching Starling game"); starlingSingleton = new Starling(starling.display.Sprite, stage, new Rectangle(0, 0, 800, 600)); starlingSingleton.supportHighResolutions = true; starlingSingleton.addEventListener(Event.ROOT_CREATED, onStarlingRootCreated); - } + } private function onStarlingRootCreated(event:Event):Void { destroyUI(); diff --git a/spine-haxe/example/src/MainFlixel.hx b/spine-haxe/example/src/MainFlixel.hx index 024283217..24634cf2c 100644 --- a/spine-haxe/example/src/MainFlixel.hx +++ b/spine-haxe/example/src/MainFlixel.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package; @@ -34,10 +34,8 @@ import flixel.FlxG; import flixel.FlxGame; import openfl.display.Sprite; -class MainFlixel extends Sprite -{ - public function new() - { +class MainFlixel extends Sprite { + public function new() { super(); addChild(new FlxGame(640, 480, FlixelState)); FlxG.autoPause = false; diff --git a/spine-haxe/example/src/MainStarling.hx b/spine-haxe/example/src/MainStarling.hx index 10bb7620d..f6d83b89c 100644 --- a/spine-haxe/example/src/MainStarling.hx +++ b/spine-haxe/example/src/MainStarling.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package; diff --git a/spine-haxe/example/src/flixelExamples/AnimationBoundExample.hx b/spine-haxe/example/src/flixelExamples/AnimationBoundExample.hx index 385e888c0..3a8991e46 100644 --- a/spine-haxe/example/src/flixelExamples/AnimationBoundExample.hx +++ b/spine-haxe/example/src/flixelExamples/AnimationBoundExample.hx @@ -25,11 +25,10 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; - import flixel.util.FlxColor; import flixel.text.FlxText; import spine.Skin; diff --git a/spine-haxe/example/src/flixelExamples/BasicExample.hx b/spine-haxe/example/src/flixelExamples/BasicExample.hx index 779e28b9e..5620f59aa 100644 --- a/spine-haxe/example/src/flixelExamples/BasicExample.hx +++ b/spine-haxe/example/src/flixelExamples/BasicExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; @@ -43,6 +43,7 @@ class BasicExample extends FlxState { var loadBinary = true; var skeletonSprite:SkeletonSprite; + override public function create():Void { FlxG.cameras.bgColor = 0xffa1b2b0; @@ -66,22 +67,20 @@ class BasicExample extends FlxState { trace("loaded"); } - override public function update(elapsed:Float):Void - { - if (FlxG.keys.anyPressed([RIGHT])) { - skeletonSprite.x += 15; - } - if (FlxG.keys.anyPressed([LEFT])) { - skeletonSprite.x -= 15; - } - if (FlxG.keys.anyPressed([DOWN])) { - skeletonSprite.y += 15; - } - if (FlxG.keys.anyPressed([UP])) { - skeletonSprite.y -= 15; - } - - super.update(elapsed); + override public function update(elapsed:Float):Void { + if (FlxG.keys.anyPressed([RIGHT])) { + skeletonSprite.x += 15; + } + if (FlxG.keys.anyPressed([LEFT])) { + skeletonSprite.x -= 15; + } + if (FlxG.keys.anyPressed([DOWN])) { + skeletonSprite.y += 15; + } + if (FlxG.keys.anyPressed([UP])) { + skeletonSprite.y -= 15; } + super.update(elapsed); + } } diff --git a/spine-haxe/example/src/flixelExamples/CelestialCircusExample.hx b/spine-haxe/example/src/flixelExamples/CelestialCircusExample.hx index fcf5f179d..c9eb219ef 100644 --- a/spine-haxe/example/src/flixelExamples/CelestialCircusExample.hx +++ b/spine-haxe/example/src/flixelExamples/CelestialCircusExample.hx @@ -25,11 +25,10 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; - import flixel.text.FlxText; import flixel.math.FlxPoint; import spine.Skin; @@ -47,6 +46,7 @@ class CelestialCircusExample extends FlxState { var loadBinary = true; var skeletonSprite:SkeletonSprite; + override public function create():Void { FlxG.cameras.bgColor = 0xffa1b2b0; @@ -55,7 +55,8 @@ class CelestialCircusExample extends FlxState { add(button); var atlas = new TextureAtlas(Assets.getText("assets/celestial-circus.atlas"), new FlixelTextureLoader("assets/celestial-circus.atlas")); - var data = SkeletonData.from(loadBinary ? Assets.getBytes("assets/celestial-circus-pro.skel") : Assets.getText("assets/celestial-circus-pro.json"), atlas, .15); + var data = SkeletonData.from(loadBinary ? Assets.getBytes("assets/celestial-circus-pro.skel") : Assets.getText("assets/celestial-circus-pro.json"), + atlas, .15); var animationStateData = new AnimationStateData(data); animationStateData.defaultMix = 0.25; @@ -73,32 +74,27 @@ class CelestialCircusExample extends FlxState { var dragging:Bool = false; var lastX:Float = 0; var lastY:Float = 0; - override public function update(elapsed:Float):Void - { + + override public function update(elapsed:Float):Void { super.update(elapsed); mousePosition = FlxG.mouse.getPosition(); - if (FlxG.mouse.justPressed && skeletonSprite.overlapsPoint(mousePosition)) - { + if (FlxG.mouse.justPressed && skeletonSprite.overlapsPoint(mousePosition)) { dragging = true; lastX = mousePosition.x; - lastY = mousePosition.y; + lastY = mousePosition.y; } - if (FlxG.mouse.justReleased) dragging = false; + if (FlxG.mouse.justReleased) + dragging = false; - if (dragging) - { + if (dragging) { skeletonSprite.x += mousePosition.x - lastX; skeletonSprite.y += mousePosition.y - lastY; - skeletonSprite.skeleton.physicsTranslate( - mousePosition.x - lastX, - mousePosition.y - lastY, - ); + skeletonSprite.skeleton.physicsTranslate(mousePosition.x - lastX, mousePosition.y - lastY,); lastX = mousePosition.x; - lastY = mousePosition.y; + lastY = mousePosition.y; } - } } diff --git a/spine-haxe/example/src/flixelExamples/CloudPotExample.hx b/spine-haxe/example/src/flixelExamples/CloudPotExample.hx index 092e4f4ee..10e261185 100644 --- a/spine-haxe/example/src/flixelExamples/CloudPotExample.hx +++ b/spine-haxe/example/src/flixelExamples/CloudPotExample.hx @@ -25,11 +25,10 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; - import spine.Skin; import flixel.ui.FlxButton; import flixel.FlxG; diff --git a/spine-haxe/example/src/flixelExamples/ControlBonesExample.hx b/spine-haxe/example/src/flixelExamples/ControlBonesExample.hx index 19a5a1171..49c7c13d8 100644 --- a/spine-haxe/example/src/flixelExamples/ControlBonesExample.hx +++ b/spine-haxe/example/src/flixelExamples/ControlBonesExample.hx @@ -25,11 +25,10 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; - import flixel.util.FlxSave; import flixel.math.FlxPoint; import flixel.util.FlxColor; @@ -49,7 +48,8 @@ class ControlBonesExample extends FlxState { var loadBinary = true; private var controlBones = []; - private var controls:Array = []; + private var controls:Array = []; + override public function create():Void { FlxG.cameras.bgColor = 0xffa1b2b0; @@ -92,7 +92,7 @@ class ControlBonesExample extends FlxState { } var point = [.0, .0]; - skeletonSprite.beforeUpdateWorldTransforms = function (go) { + skeletonSprite.beforeUpdateWorldTransforms = function(go) { for (i in 0...controls.length) { var bone = controlBones[i]; var control = controls[i]; @@ -101,7 +101,7 @@ class ControlBonesExample extends FlxState { go.haxeWorldCoordinatesToBone(point, bone); bone.pose.x = point[0]; bone.pose.y = point[1]; - } + } }; super.create(); @@ -111,25 +111,24 @@ class ControlBonesExample extends FlxState { var offsetX:Float = 0; var offsetY:Float = 0; var sprite:FlxSprite; - override public function update(elapsed:Float):Void - { + + override public function update(elapsed:Float):Void { super.update(elapsed); mousePosition = FlxG.mouse.getPosition(); for (control in controls) { - if (FlxG.mouse.justPressed && control.overlapsPoint(mousePosition)) - { + if (FlxG.mouse.justPressed && control.overlapsPoint(mousePosition)) { sprite = control; offsetX = mousePosition.x - sprite.x; offsetY = mousePosition.y - sprite.y; } } - if (FlxG.mouse.justReleased) sprite = null; + if (FlxG.mouse.justReleased) + sprite = null; - if (sprite != null) - { + if (sprite != null) { sprite.x = mousePosition.x - offsetX; sprite.y = mousePosition.y - offsetY; } diff --git a/spine-haxe/example/src/flixelExamples/EventsExample.hx b/spine-haxe/example/src/flixelExamples/EventsExample.hx index 9d57e0cad..861ca315c 100644 --- a/spine-haxe/example/src/flixelExamples/EventsExample.hx +++ b/spine-haxe/example/src/flixelExamples/EventsExample.hx @@ -25,11 +25,10 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; - import flixel.text.FlxText; import flixel.ui.FlxButton; import flixel.FlxG; @@ -76,9 +75,7 @@ class EventsExample extends FlxState { skeletonSprite.skeleton.setupPoseBones(); add(skeletonSprite); - trackEntry.onEvent.add( - (entry, event) -> log('Custom event for ${entry.animation.name}: ${event.data.name}')); - + trackEntry.onEvent.add((entry, event) -> log('Custom event for ${entry.animation.name}: ${event.data.name}')); add(textContainer); super.create(); @@ -88,6 +85,7 @@ class EventsExample extends FlxState { private var logs = new Array(); private var logsNumber = 0; private var yOffset = 12; + private function log(text:String) { var length = logs.length; var newLog = new FlxText(250, 30, text); diff --git a/spine-haxe/example/src/flixelExamples/FlixelState.hx b/spine-haxe/example/src/flixelExamples/FlixelState.hx index 9d0215c94..eb3efe8ad 100644 --- a/spine-haxe/example/src/flixelExamples/FlixelState.hx +++ b/spine-haxe/example/src/flixelExamples/FlixelState.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; @@ -43,8 +43,7 @@ import flixel.FlxG; import flixel.FlxState; import flixel.text.FlxText; -class FlixelState extends FlxState -{ +class FlixelState extends FlxState { var spineSprite:SkeletonSprite; var sprite:FlxSprite; var sprite2:FlxSprite; @@ -57,8 +56,7 @@ class FlixelState extends FlxState var scale = 4; var speed:Float; - override public function create():Void - { + override public function create():Void { FlxG.cameras.bgColor = 0xffa1b2b0; // setting speed of spineboy (450 is the speed to not let him slide) @@ -76,8 +74,8 @@ class FlixelState extends FlxState // creating the text to display overlapping state myText = new FlxText(0, 25, 150, "", 16); - myText.alignment = CENTER; - group.add(myText); + myText.alignment = CENTER; + group.add(myText); var button = new FlxButton(0, 0, "Next scene", () -> FlxG.switchState(() -> new BasicExample())); button.setPosition(FlxG.width * .75, FlxG.height / 10); @@ -92,14 +90,14 @@ class FlixelState extends FlxState // instructions var groupInstructions = new FlxSpriteGroup(); groupInstructions.setPosition(50, 405); - groupInstructions.add(new FlxText(0, 0, 200, "Left/Right - Move", 16)); - groupInstructions.add(new FlxText(0, 25, 150, "Space - Jump", 16)); - groupInstructions.add(new FlxText(200, 25, 400, "Click the button for the next example", 16)); + groupInstructions.add(new FlxText(0, 0, 200, "Left/Right - Move", 16)); + groupInstructions.add(new FlxText(0, 25, 150, "Space - Jump", 16)); + groupInstructions.add(new FlxText(200, 25, 400, "Click the button for the next example", 16)); add(groupInstructions); // loading spineboy var atlas = new TextureAtlas(Assets.getText("assets/spineboy.atlas"), new FlixelTextureLoader("assets/spineboy.atlas")); - var skeletondata = SkeletonData.from(Assets.getText("assets/spineboy-pro.json"), atlas, 1/scale); + var skeletondata = SkeletonData.from(Assets.getText("assets/spineboy-pro.json"), atlas, 1 / scale); var animationStateData = new AnimationStateData(skeletondata); spineSprite = new SkeletonSprite(skeletondata, animationStateData); @@ -166,8 +164,8 @@ class FlixelState extends FlxState } var justSetIdle = true; - override public function update(elapsed:Float):Void - { + + override public function update(elapsed:Float):Void { if (FlxG.overlap(spineSprite, group)) { myText.text = "Overlapping"; } else { @@ -191,11 +189,13 @@ class FlixelState extends FlxState var flipped = false; var deltaX; if (FlxG.keys.anyPressed([RIGHT])) { - if (spineSprite.flipX == true) flipped = true; + if (spineSprite.flipX == true) + flipped = true; spineSprite.flipX = false; } if (FlxG.keys.anyPressed([LEFT])) { - if (spineSprite.flipX == false) flipped = true; + if (spineSprite.flipX == false) + flipped = true; spineSprite.flipX = true; } @@ -211,14 +211,12 @@ class FlixelState extends FlxState spineSprite.state.setAnimationByName(0, "walk", true); } } - } else if (!jumping && !justSetIdle) { justSetWalking = false; justSetIdle = true; spineSprite.state.setAnimationByName(0, "idle", true); } - super.update(elapsed); } } diff --git a/spine-haxe/example/src/flixelExamples/MixAndMatchExample.hx b/spine-haxe/example/src/flixelExamples/MixAndMatchExample.hx index 5478faa93..6024ef0a2 100644 --- a/spine-haxe/example/src/flixelExamples/MixAndMatchExample.hx +++ b/spine-haxe/example/src/flixelExamples/MixAndMatchExample.hx @@ -25,11 +25,10 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; - import spine.Skin; import flixel.ui.FlxButton; import flixel.FlxG; @@ -43,9 +42,10 @@ import spine.atlas.TextureAtlas; class MixAndMatchExample extends FlxState { var loadBinary = false; - // var loadBinary = true; + // var loadBinary = true; var skeletonSprite:SkeletonSprite; + override public function create():Void { FlxG.cameras.bgColor = 0xffa1b2b0; @@ -54,7 +54,8 @@ class MixAndMatchExample extends FlxState { add(button); var atlas = new TextureAtlas(Assets.getText("assets/mix-and-match.atlas"), new FlixelTextureLoader("assets/mix-and-match.atlas")); - var data = SkeletonData.from(loadBinary ? Assets.getBytes("assets/mix-and-match-pro.skel") : Assets.getText("assets/mix-and-match-pro.json"), atlas, .5); + var data = SkeletonData.from(loadBinary ? Assets.getBytes("assets/mix-and-match-pro.skel") : Assets.getText("assets/mix-and-match-pro.json"), atlas, + .5); var animationStateData = new AnimationStateData(data); animationStateData.defaultMix = 0.25; @@ -80,5 +81,4 @@ class MixAndMatchExample extends FlxState { super.create(); } - } diff --git a/spine-haxe/example/src/flixelExamples/SackExample.hx b/spine-haxe/example/src/flixelExamples/SackExample.hx index f0fccbe2c..d4b8be6b1 100644 --- a/spine-haxe/example/src/flixelExamples/SackExample.hx +++ b/spine-haxe/example/src/flixelExamples/SackExample.hx @@ -25,11 +25,10 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; - import spine.Skin; import flixel.ui.FlxButton; import flixel.FlxG; diff --git a/spine-haxe/example/src/flixelExamples/SequenceExample.hx b/spine-haxe/example/src/flixelExamples/SequenceExample.hx index 839a20527..63b22766c 100644 --- a/spine-haxe/example/src/flixelExamples/SequenceExample.hx +++ b/spine-haxe/example/src/flixelExamples/SequenceExample.hx @@ -25,11 +25,10 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; - import flixel.ui.FlxButton; import flixel.FlxG; import spine.flixel.SkeletonSprite; @@ -44,6 +43,7 @@ class SequenceExample extends FlxState { var loadBinary = true; var skeletonSprite:SkeletonSprite; + override public function create():Void { FlxG.cameras.bgColor = 0xffa1b2b0; @@ -64,5 +64,4 @@ class SequenceExample extends FlxState { add(skeletonSprite); super.create(); } - } diff --git a/spine-haxe/example/src/flixelExamples/SnowglobeExample.hx b/spine-haxe/example/src/flixelExamples/SnowglobeExample.hx index 185474ab8..4bde6bdaf 100644 --- a/spine-haxe/example/src/flixelExamples/SnowglobeExample.hx +++ b/spine-haxe/example/src/flixelExamples/SnowglobeExample.hx @@ -25,11 +25,10 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; - import spine.Skin; import flixel.ui.FlxButton; import flixel.FlxG; diff --git a/spine-haxe/example/src/flixelExamples/TankExample.hx b/spine-haxe/example/src/flixelExamples/TankExample.hx index 7de108181..39c57890a 100644 --- a/spine-haxe/example/src/flixelExamples/TankExample.hx +++ b/spine-haxe/example/src/flixelExamples/TankExample.hx @@ -25,11 +25,10 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; - import spine.Skin; import flixel.ui.FlxButton; import flixel.FlxG; diff --git a/spine-haxe/example/src/flixelExamples/VineExample.hx b/spine-haxe/example/src/flixelExamples/VineExample.hx index fa4091d6e..1c7431397 100644 --- a/spine-haxe/example/src/flixelExamples/VineExample.hx +++ b/spine-haxe/example/src/flixelExamples/VineExample.hx @@ -25,11 +25,10 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package flixelExamples; - import spine.Skin; import flixel.ui.FlxButton; import flixel.FlxG; diff --git a/spine-haxe/example/src/starlingExamples/AnimationBoundExample.hx b/spine-haxe/example/src/starlingExamples/AnimationBoundExample.hx index eac57cb4b..43a043187 100644 --- a/spine-haxe/example/src/starlingExamples/AnimationBoundExample.hx +++ b/spine-haxe/example/src/starlingExamples/AnimationBoundExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; @@ -44,8 +44,9 @@ import starling.display.Quad; class AnimationBoundExample extends Scene { var loadBinary = false; - var skeletonSpriteClipping: SkeletonSprite; - var skeletonSpriteNoClipping: SkeletonSprite; + var skeletonSpriteClipping:SkeletonSprite; + var skeletonSpriteNoClipping:SkeletonSprite; + public function load():Void { background.color = 0x333333; var scale = .2; @@ -66,8 +67,8 @@ class AnimationBoundExample extends Scene { var animationClipping = skeletonSpriteClipping.state.setAnimationByName(0, "portal", true).animation; var animationBoundClipping = skeletonSpriteClipping.getAnimationBounds(animationClipping, true); var quad:Quad = new Quad(animationBoundClipping.width * scale, animationBoundClipping.height * scale, 0xc70000); - quad.x = skeletonSpriteClipping.x + animationBoundClipping.x * scale; - quad.y = skeletonSpriteClipping.y + animationBoundClipping.y * scale; + quad.x = skeletonSpriteClipping.x + animationBoundClipping.x * scale; + quad.y = skeletonSpriteClipping.y + animationBoundClipping.y * scale; var animationStateDataNoClipping = new AnimationStateData(skeletondata); animationStateDataNoClipping.defaultMix = 0.25; @@ -80,8 +81,8 @@ class AnimationBoundExample extends Scene { var animationNoClipping = skeletonSpriteNoClipping.state.setAnimationByName(0, "portal", true).animation; var animationBoundNoClipping = skeletonSpriteNoClipping.getAnimationBounds(animationNoClipping, false); var quadNoClipping:Quad = new Quad(animationBoundNoClipping.width * scale, animationBoundNoClipping.height * scale, 0xc70000); - quadNoClipping.x = skeletonSpriteNoClipping.x + animationBoundNoClipping.x * scale; - quadNoClipping.y = skeletonSpriteNoClipping.y + animationBoundNoClipping.y * scale; + quadNoClipping.x = skeletonSpriteNoClipping.x + animationBoundNoClipping.x * scale; + quadNoClipping.y = skeletonSpriteNoClipping.y + animationBoundNoClipping.y * scale; addChild(quad); addChild(quadNoClipping); diff --git a/spine-haxe/example/src/starlingExamples/BasicExample.hx b/spine-haxe/example/src/starlingExamples/BasicExample.hx index 51b7a370f..538fb3bde 100644 --- a/spine-haxe/example/src/starlingExamples/BasicExample.hx +++ b/spine-haxe/example/src/starlingExamples/BasicExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; diff --git a/spine-haxe/example/src/starlingExamples/CelestialCircusExample.hx b/spine-haxe/example/src/starlingExamples/CelestialCircusExample.hx index e5886d5eb..5e7b24187 100644 --- a/spine-haxe/example/src/starlingExamples/CelestialCircusExample.hx +++ b/spine-haxe/example/src/starlingExamples/CelestialCircusExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; @@ -52,7 +52,8 @@ class CelestialCircusExample extends Scene { background.color = 0x333333; var atlas = new TextureAtlas(Assets.getText("assets/celestial-circus.atlas"), new StarlingTextureLoader("assets/celestial-circus.atlas")); - var skeletondata = SkeletonData.from(loadBinary ? Assets.getBytes("assets/celestial-circus-pro.skel") : Assets.getText("assets/celestial-circus-pro.json"), atlas); + var skeletondata = SkeletonData.from(loadBinary ? Assets.getBytes("assets/celestial-circus-pro.skel") : Assets.getText("assets/celestial-circus-pro.json"), + atlas); var animationStateData = new AnimationStateData(skeletondata); animationStateData.defaultMix = 0.25; @@ -83,10 +84,7 @@ class CelestialCircusExample extends Scene { skeletonTouch.getMovement(this, movement); skeletonSprite.x += movement.x; skeletonSprite.y += movement.y; - skeletonSprite.skeleton.physicsTranslate( - movement.x / skeletonSprite.scale, - movement.y / skeletonSprite.scale, - ); + skeletonSprite.skeleton.physicsTranslate(movement.x / skeletonSprite.scale, movement.y / skeletonSprite.scale,); } } else { var sceneTouch = e.getTouch(this); @@ -94,8 +92,5 @@ class CelestialCircusExample extends Scene { SceneManager.getInstance().switchScene(new SnowglobeExample()); } } - - } - } diff --git a/spine-haxe/example/src/starlingExamples/CloudPotExample.hx b/spine-haxe/example/src/starlingExamples/CloudPotExample.hx index 6c9cb6a06..5d5fdb2e5 100644 --- a/spine-haxe/example/src/starlingExamples/CloudPotExample.hx +++ b/spine-haxe/example/src/starlingExamples/CloudPotExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; @@ -58,7 +58,6 @@ class CloudPotExample extends Scene { skeletonSprite.skeleton.updateWorldTransform(Physics.update); var bounds = skeletonSprite.skeleton.getBounds(); - skeletonSprite.scale = 0.2; skeletonSprite.x = Starling.current.stage.stageWidth / 2; skeletonSprite.y = Starling.current.stage.stageHeight / 2; diff --git a/spine-haxe/example/src/starlingExamples/ControlBonesExample.hx b/spine-haxe/example/src/starlingExamples/ControlBonesExample.hx index a1539b799..26a95ae32 100644 --- a/spine-haxe/example/src/starlingExamples/ControlBonesExample.hx +++ b/spine-haxe/example/src/starlingExamples/ControlBonesExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; @@ -48,11 +48,12 @@ class ControlBonesExample extends Scene { var skeletonSprite:SkeletonSprite; private var movement = new openfl.geom.Point(); private var controlBones = []; - private var controls = []; + private var controls = []; public function load():Void { var atlas = new TextureAtlas(Assets.getText("assets/stretchyman.atlas"), new StarlingTextureLoader("assets/stretchyman.atlas")); - var skeletondata = SkeletonData.from(loadBinary ? Assets.getBytes("assets/stretchyman-pro.skel") : Assets.getText("assets/stretchyman-pro.json"), atlas); + var skeletondata = SkeletonData.from(loadBinary ? Assets.getBytes("assets/stretchyman-pro.skel") : Assets.getText("assets/stretchyman-pro.json"), + atlas); var animationStateData = new AnimationStateData(skeletondata); animationStateData.defaultMix = 0.25; @@ -97,7 +98,7 @@ class ControlBonesExample extends Scene { } var point = [.0, .0]; - skeletonSprite.beforeUpdateWorldTransforms = function (go) { + skeletonSprite.beforeUpdateWorldTransforms = function(go) { for (i in 0...controls.length) { var bone = controlBones[i]; var control = controls[i]; @@ -106,7 +107,7 @@ class ControlBonesExample extends Scene { go.haxeWorldCoordinatesToBone(point, bone); bone.pose.x = point[0]; bone.pose.y = point[1]; - } + } }; addEventListener(TouchEvent.TOUCH, onTouch); diff --git a/spine-haxe/example/src/starlingExamples/EventsExample.hx b/spine-haxe/example/src/starlingExamples/EventsExample.hx index 5262acc7f..ee62155b3 100644 --- a/spine-haxe/example/src/starlingExamples/EventsExample.hx +++ b/spine-haxe/example/src/starlingExamples/EventsExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; @@ -66,8 +66,7 @@ class EventsExample extends Scene { // add callback to the TrackEntry skeletonSprite.state.setAnimationByName(0, "walk", true); var trackEntry = skeletonSprite.state.addAnimationByName(0, "run", true, 3); - trackEntry.onEvent.add( - (entry, event) -> log('Custom event for ${entry.animation.name}: ${event.data.name}')); + trackEntry.onEvent.add((entry, event) -> log('Custom event for ${entry.animation.name}: ${event.data.name}')); addChild(skeletonSprite); juggler.add(skeletonSprite); @@ -83,6 +82,7 @@ class EventsExample extends Scene { private var logs = new Array(); private var logsNumber = 0; private var yOffset = 12; + private function log(text:String) { var length = logs.length; var newLog = new TextField(250, 30, text); diff --git a/spine-haxe/example/src/starlingExamples/MixAndMatchExample.hx b/spine-haxe/example/src/starlingExamples/MixAndMatchExample.hx index 454f74d19..749fc4c66 100644 --- a/spine-haxe/example/src/starlingExamples/MixAndMatchExample.hx +++ b/spine-haxe/example/src/starlingExamples/MixAndMatchExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; diff --git a/spine-haxe/example/src/starlingExamples/SackExample.hx b/spine-haxe/example/src/starlingExamples/SackExample.hx index d14909260..99eb9196e 100644 --- a/spine-haxe/example/src/starlingExamples/SackExample.hx +++ b/spine-haxe/example/src/starlingExamples/SackExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; @@ -58,7 +58,7 @@ class SackExample extends Scene { skeletonSprite.scale = 0.2; skeletonSprite.x = Starling.current.stage.stageWidth / 2; - skeletonSprite.y = Starling.current.stage.stageHeight/ 2; + skeletonSprite.y = Starling.current.stage.stageHeight / 2; skeletonSprite.state.setAnimationByName(0, "cape-follow-example", true); diff --git a/spine-haxe/example/src/starlingExamples/Scene.hx b/spine-haxe/example/src/starlingExamples/Scene.hx index 41ff43a2f..f5f09b725 100644 --- a/spine-haxe/example/src/starlingExamples/Scene.hx +++ b/spine-haxe/example/src/starlingExamples/Scene.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; diff --git a/spine-haxe/example/src/starlingExamples/SequenceExample.hx b/spine-haxe/example/src/starlingExamples/SequenceExample.hx index a16b0cec2..2aa64d57e 100644 --- a/spine-haxe/example/src/starlingExamples/SequenceExample.hx +++ b/spine-haxe/example/src/starlingExamples/SequenceExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; diff --git a/spine-haxe/example/src/starlingExamples/SnowglobeExample.hx b/spine-haxe/example/src/starlingExamples/SnowglobeExample.hx index 846cd5d48..47bd3fccb 100644 --- a/spine-haxe/example/src/starlingExamples/SnowglobeExample.hx +++ b/spine-haxe/example/src/starlingExamples/SnowglobeExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; @@ -57,10 +57,9 @@ class SnowglobeExample extends Scene { skeletonSprite.skeleton.updateWorldTransform(Physics.update); var bounds = skeletonSprite.skeleton.getBounds(); - skeletonSprite.scale = 0.15; skeletonSprite.x = Starling.current.stage.stageWidth / 2; - skeletonSprite.y = Starling.current.stage.stageHeight/ 1.5; + skeletonSprite.y = Starling.current.stage.stageHeight / 1.5; skeletonSprite.state.setAnimationByName(0, "shake", true); diff --git a/spine-haxe/example/src/starlingExamples/TankExample.hx b/spine-haxe/example/src/starlingExamples/TankExample.hx index 9b09778db..708c51de2 100644 --- a/spine-haxe/example/src/starlingExamples/TankExample.hx +++ b/spine-haxe/example/src/starlingExamples/TankExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; diff --git a/spine-haxe/example/src/starlingExamples/Test.hx b/spine-haxe/example/src/starlingExamples/Test.hx index 4d78b4e23..5a5e91a88 100644 --- a/spine-haxe/example/src/starlingExamples/Test.hx +++ b/spine-haxe/example/src/starlingExamples/Test.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; diff --git a/spine-haxe/example/src/starlingExamples/VineExample.hx b/spine-haxe/example/src/starlingExamples/VineExample.hx index 41f1908ed..dd4ff1a6b 100644 --- a/spine-haxe/example/src/starlingExamples/VineExample.hx +++ b/spine-haxe/example/src/starlingExamples/VineExample.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package starlingExamples; diff --git a/spine-haxe/spine-haxe/spine/ArrayUtils.hx b/spine-haxe/spine-haxe/spine/ArrayUtils.hx index 3f127e56c..f0b040ffb 100644 --- a/spine-haxe/spine-haxe/spine/ArrayUtils.hx +++ b/spine-haxe/spine-haxe/spine/ArrayUtils.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/BinaryInput.hx b/spine-haxe/spine-haxe/spine/BinaryInput.hx index 218d5dc78..f1d703fbc 100644 --- a/spine-haxe/spine-haxe/spine/BinaryInput.hx +++ b/spine-haxe/spine-haxe/spine/BinaryInput.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/BlendMode.hx b/spine-haxe/spine-haxe/spine/BlendMode.hx index 1e230da35..35aea80df 100644 --- a/spine-haxe/spine-haxe/spine/BlendMode.hx +++ b/spine-haxe/spine-haxe/spine/BlendMode.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/Bone.hx b/spine-haxe/spine-haxe/spine/Bone.hx index d4213caa7..ac46a3482 100644 --- a/spine-haxe/spine-haxe/spine/Bone.hx +++ b/spine-haxe/spine-haxe/spine/Bone.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -37,7 +37,8 @@ package spine; class Bone extends PosedActive { static public var yDown:Bool = false; static public var yDir(get, never):Int; - static private function get_yDir(): Int { + + static private function get_yDir():Int { return Bone.yDown ? -1 : 1; } @@ -49,7 +50,7 @@ class Bone extends PosedActive { public var sorted = false; - public function new (data:BoneData, parent:Bone) { + public function new(data:BoneData, parent:Bone) { super(data, new BonePose(), new BonePose()); this.parent = parent; applied.bone = this; diff --git a/spine-haxe/spine-haxe/spine/BoneData.hx b/spine-haxe/spine-haxe/spine/BoneData.hx index 5aed0ece7..51af260fa 100644 --- a/spine-haxe/spine-haxe/spine/BoneData.hx +++ b/spine-haxe/spine-haxe/spine/BoneData.hx @@ -25,13 +25,12 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; /** The setup pose for a bone. */ class BoneData extends PosedData { - /** The index of the bone in spine.Skeleton.getBones(). */ public final index:Int; @@ -41,6 +40,7 @@ class BoneData extends PosedData { public var length = 0.; // Nonessential. + /** The color of the bone as it was in Spine, or a default color if nonessential data was not exported. Bones are not usually * rendered at runtime. */ public var color = new Color(0, 0, 0, 0); @@ -51,10 +51,12 @@ class BoneData extends PosedData { /** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */ public var visible = false; - public function new (index:Int, name:String, parent:BoneData) { + public function new(index:Int, name:String, parent:BoneData) { super(name, new BoneLocal()); - if (index < 0) throw new SpineException("index must be >= 0."); - if (name == null) throw new SpineException("name cannot be null."); + if (index < 0) + throw new SpineException("index must be >= 0."); + if (name == null) + throw new SpineException("name cannot be null."); this.index = index; this.parent = parent; } diff --git a/spine-haxe/spine-haxe/spine/BoneLocal.hx b/spine-haxe/spine-haxe/spine/BoneLocal.hx index 4dabef224..887be4f45 100644 --- a/spine-haxe/spine-haxe/spine/BoneLocal.hx +++ b/spine-haxe/spine-haxe/spine/BoneLocal.hx @@ -25,13 +25,12 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; /** Stores a bone's local pose. */ class BoneLocal implements Pose { - /** The local x translation. */ public var x:Float = 0; @@ -55,17 +54,19 @@ class BoneLocal implements Pose { /** Determines how parent world transforms affect this bone. */ public var inherit(default, set):Inherit; - function set_inherit (value:Inherit):Inherit { - if (value == null) throw new SpineException("inherit cannot be null."); + + function set_inherit(value:Inherit):Inherit { + if (value == null) + throw new SpineException("inherit cannot be null."); inherit = value; return value; } - public function new () { - } + public function new() {} - public function set (pose:BoneLocal):Void { - if (pose == null) throw new SpineException("pose cannot be null."); + public function set(pose:BoneLocal):Void { + if (pose == null) + throw new SpineException("pose cannot be null."); x = pose.x; y = pose.y; rotation = pose.rotation; @@ -75,5 +76,4 @@ class BoneLocal implements Pose { shearY = pose.shearY; inherit = pose.inherit; } - } diff --git a/spine-haxe/spine-haxe/spine/BonePose.hx b/spine-haxe/spine-haxe/spine/BonePose.hx index 8bde03c36..dbed6bb9e 100644 --- a/spine-haxe/spine-haxe/spine/BonePose.hx +++ b/spine-haxe/spine-haxe/spine/BonePose.hx @@ -25,14 +25,13 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; /** The applied pose for a bone. This is the {@link Bone} pose with constraints applied and the world transform computed by * Skeleton.updateWorldTransform(Physics). */ class BonePose extends BoneLocal implements Update { - public var bone:Bone; /** Part of the world transform matrix for the X axis. If changed, updateAppliedTransform() should be called. */ @@ -61,14 +60,15 @@ class BonePose extends BoneLocal implements Update { // } /** Called by Skeleton.updateCache() to compute the world transform, if needed. */ - public function update (skeleton:Skeleton, physics:Physics):Void { - if (world != skeleton._update) updateWorldTransform(skeleton); + public function update(skeleton:Skeleton, physics:Physics):Void { + if (world != skeleton._update) + updateWorldTransform(skeleton); } /** Computes the world transform using the parent bone's applied pose and this pose. Child bones are not updated. - * - * @see https://esotericsoftware.com/spine-runtime-skeletons#World-transforms World transforms in the Spine Runtimes Guide - */ + * + * @see https://esotericsoftware.com/spine-runtime-skeletons#World-transforms World transforms in the Spine Runtimes Guide + */ public function updateWorldTransform(skeleton:Skeleton):Void { if (local == skeleton._update) updateLocalTransform(skeleton); @@ -139,15 +139,19 @@ class BonePose extends BoneLocal implements Update { c = pc * la + pd * lc; d = pc * lb + pd * ld; case Inherit.noScale, Inherit.noScaleOrReflection: - var r = rotation * MathUtils.degRad, cos = Math.cos(r), sin = Math.sin(r); + var r = rotation * MathUtils.degRad, + cos = Math.cos(r), + sin = Math.sin(r); var za = (pa * cos + pb * sin) / skeleton.scaleX; var zc = (pc * cos + pd * sin) / skeleton.scaleY; var s = Math.sqrt(za * za + zc * zc); - if (s > 0.00001) s = 1 / s; + if (s > 0.00001) + s = 1 / s; za *= s; zc *= s; s = Math.sqrt(za * za + zc * zc); - if (inherit == Inherit.noScale && ((pa * pd - pb * pc < 0) != ((skeleton.scaleX < 0) != (skeleton.scaleY < 0)))) s = -s; + if (inherit == Inherit.noScale && ((pa * pd - pb * pc < 0) != ((skeleton.scaleX < 0) != (skeleton.scaleY < 0)))) + s = -s; r = Math.PI / 2 + Math.atan2(zc, za); var zb:Float = Math.cos(r) * s; var zd:Float = Math.sin(r) * s; @@ -169,13 +173,13 @@ class BonePose extends BoneLocal implements Update { } /** Computes the applied transform values from the world transform. - * - * If the world transform is modified (by a constraint, rotateWorld(), etc) then this method should be called so - * the applied transform matches the world transform. The applied transform may be needed by other code (eg to apply another - * constraint). - * - * Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after - * calling this method is equivalent to the local transform used to compute the world transform, but may not be identical. */ + * + * If the world transform is modified (by a constraint, rotateWorld(), etc) then this method should be called so + * the applied transform matches the world transform. The applied transform may be needed by other code (eg to apply another + * constraint). + * + * Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after + * calling this method is equivalent to the local transform used to compute the world transform, but may not be identical. */ public function updateLocalTransform(skeleton:Skeleton):Void { local = 0; world = skeleton._update; @@ -215,15 +219,19 @@ class BonePose extends BoneLocal implements Update { ia = pd * pid; ib = pb * pid; case Inherit.noScale, Inherit.noScaleOrReflection: - var r = rotation * MathUtils.degRad, cos = Math.cos(rotation), sin = Math.sin(rotation); + var r = rotation * MathUtils.degRad, + cos = Math.cos(rotation), + sin = Math.sin(rotation); pa = (pa * cos + pb * sin) / skeleton.scaleX; pc = (pc * cos + pd * sin) / skeleton.scaleY; var s = Math.sqrt(pa * pa + pc * pc); - if (s > 0.00001) s = 1 / s; + if (s > 0.00001) + s = 1 / s; pa *= s; pc *= s; s = Math.sqrt(pa * pa + pc * pc); - if (inherit == Inherit.noScale && (pid < 0 != ((skeleton.scaleX < 0) != (skeleton.scaleY < 0)))) s = -s; + if (inherit == Inherit.noScale && (pid < 0 != ((skeleton.scaleX < 0) != (skeleton.scaleY < 0)))) + s = -s; r = MathUtils.PI / 2 + Math.atan2(pc, pa); pb = Math.cos(r) * s; pd = Math.sin(r) * s; @@ -255,24 +263,26 @@ class BonePose extends BoneLocal implements Update { } /** If the world transform has been modified and the local transform no longer matches, {@link #updateLocalTransform(Skeleton)} - * is called. */ - public function validateLocalTransform (skeleton: Skeleton) { - if (local == skeleton._update) updateLocalTransform(skeleton); + * is called. */ + public function validateLocalTransform(skeleton:Skeleton) { + if (local == skeleton._update) + updateLocalTransform(skeleton); } - public function modifyLocal (skeleton: Skeleton) { - if (local == skeleton._update) updateLocalTransform(skeleton); + public function modifyLocal(skeleton:Skeleton) { + if (local == skeleton._update) + updateLocalTransform(skeleton); world = 0; resetWorld(skeleton._update); } - public function modifyWorld (update:Int) { + public function modifyWorld(update:Int) { local = update; world = update; resetWorld(update); } - public function resetWorld (update:Int) { + public function resetWorld(update:Int) { var children = bone.children; for (i in 0...bone.children.length) { var child = children[i].applied; @@ -331,14 +341,14 @@ class BonePose extends BoneLocal implements Update { } /** Transforms a point from world coordinates to the parent bone's local coordinates. */ - public function worldToParent(world: Array):Array { + public function worldToParent(world:Array):Array { if (world == null) throw new SpineException("world cannot be null."); return bone.parent == null ? world : bone.parent.applied.worldToLocal(world); } /** Transforms a point from the parent bone's coordinates to world coordinates. */ - public function parentToWorld(world: Array):Array { + public function parentToWorld(world:Array):Array { if (world == null) throw new SpineException("world cannot be null."); return bone.parent == null ? world : bone.parent.applied.localToWorld(world); @@ -373,7 +383,7 @@ class BonePose extends BoneLocal implements Update { d = sin * rb + cos * d; } - public function toString ():String { + public function toString():String { return bone.data.name; } } diff --git a/spine-haxe/spine-haxe/spine/Color.hx b/spine-haxe/spine-haxe/spine/Color.hx index dc8d47683..511460e2d 100644 --- a/spine-haxe/spine-haxe/spine/Color.hx +++ b/spine-haxe/spine-haxe/spine/Color.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/Constraint.hx b/spine-haxe/spine-haxe/spine/Constraint.hx index d79a66215..394630cd0 100644 --- a/spine-haxe/spine-haxe/spine/Constraint.hx +++ b/spine-haxe/spine-haxe/spine/Constraint.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -33,17 +33,16 @@ abstract class Constraint< // T:Constraint, // D:ConstraintData, // P:Pose> // - extends PosedActive implements Update { - - public function new (data:D, pose:P, constrained:P) { +extends PosedActive implements Update { + public function new(data:D, pose:P, constrained:P) { super(data, pose, constrained); } - public abstract function copy (skeleton:Skeleton):T; + public abstract function copy(skeleton:Skeleton):T; - public abstract function sort (skeleton:Skeleton):Void; + public abstract function sort(skeleton:Skeleton):Void; - public function isSourceActive ():Bool { + public function isSourceActive():Bool { return true; } -} \ No newline at end of file +} diff --git a/spine-haxe/spine-haxe/spine/ConstraintData.hx b/spine-haxe/spine-haxe/spine/ConstraintData.hx index ac7081da3..93dc080fe 100644 --- a/spine-haxe/spine-haxe/spine/ConstraintData.hx +++ b/spine-haxe/spine-haxe/spine/ConstraintData.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -33,11 +33,10 @@ package spine; abstract class ConstraintData< // T:Constraint, // P:Pose> // - extends PosedData

{ - +extends PosedData

{ function new(name:String, setup:P) { super(name, setup); } - public abstract function create (skeleton:Skeleton):T; + public abstract function create(skeleton:Skeleton):T; } diff --git a/spine-haxe/spine-haxe/spine/Event.hx b/spine-haxe/spine-haxe/spine/Event.hx index 48a8ee7a1..3cc3d0318 100644 --- a/spine-haxe/spine-haxe/spine/Event.hx +++ b/spine-haxe/spine-haxe/spine/Event.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -50,7 +50,8 @@ class Event { public var balance = 0.; public function new(time:Float, data:EventData) { - if (data == null) throw new SpineException("data cannot be null."); + if (data == null) + throw new SpineException("data cannot be null."); this.time = time; this.data = data; } diff --git a/spine-haxe/spine-haxe/spine/EventData.hx b/spine-haxe/spine-haxe/spine/EventData.hx index 1117cd492..017380e59 100644 --- a/spine-haxe/spine-haxe/spine/EventData.hx +++ b/spine-haxe/spine-haxe/spine/EventData.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/HasTextureRegion.hx b/spine-haxe/spine-haxe/spine/HasTextureRegion.hx index cb289d14e..9a714de48 100644 --- a/spine-haxe/spine-haxe/spine/HasTextureRegion.hx +++ b/spine-haxe/spine-haxe/spine/HasTextureRegion.hx @@ -25,19 +25,23 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; interface HasTextureRegion { /** The name used to find the region. */ public var path:String; + /** Sets the region used to draw the attachment. After setting the region or if the region's properties are changed, * updateRegion() must be called. */ public var region:TextureRegion; + /** The color to tint the attachment. */ public var color:Color; + public var sequence:Sequence; + /** Updates any values the attachment calculates using the region. Must be called after setting the * region or if the region's properties are changed. */ public function updateRegion():Void; diff --git a/spine-haxe/spine-haxe/spine/IkConstraint.hx b/spine-haxe/spine-haxe/spine/IkConstraint.hx index 7dae6da21..c76364311 100644 --- a/spine-haxe/spine-haxe/spine/IkConstraint.hx +++ b/spine-haxe/spine-haxe/spine/IkConstraint.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -34,7 +34,6 @@ package spine; * * @see https://esotericsoftware.com/spine-ik-constraints IK constraints in the Spine User Guide */ class IkConstraint extends Constraint { - /** The 1 or 2 bones that will be modified by this IK constraint. */ public final bones:Array; @@ -43,7 +42,8 @@ class IkConstraint extends Constraint(); for (boneData in data.bones) @@ -51,24 +51,27 @@ class IkConstraint extends Constraint 1) skeleton.constrained(bones[1].bone); + if (bones.length > 1) + skeleton.constrained(bones[1].bone); } - override public function isSourceActive () { + override public function isSourceActive() { return target.active; } - public function set_target (target:Bone):Bone { - if (target == null) throw new SpineException("target cannot be null."); + public function set_target(target:Bone):Bone { + if (target == null) + throw new SpineException("target cannot be null."); this.target = target; return target; } /** Applies 1 bone IK. The target is specified in the world coordinate system. */ - static public function apply1(skeleton:Skeleton, bone:BonePose, targetX:Float, targetY:Float, compress:Bool, stretch:Bool, - uniform:Bool, mix:Float) { - - if (bone == null) throw new SpineException("bone cannot be null."); + static public function apply1(skeleton:Skeleton, bone:BonePose, targetX:Float, targetY:Float, compress:Bool, stretch:Bool, uniform:Bool, mix:Float) { + if (bone == null) + throw new SpineException("bone cannot be null."); bone.modifyLocal(skeleton); var p = bone.bone.parent.applied; var pa = p.a, pb = p.b, pc = p.c, pd = p.d; @@ -127,7 +131,8 @@ class IkConstraint extends Constraint 180) rotationIK -= 360; else if (rotationIK < -180) // @@ -139,13 +144,14 @@ class IkConstraint extends Constraint 0.0001) { - var dd = tx * tx + ty * ty; + var dd = tx * tx + ty * ty; if ((compress && dd < b * b) || (stretch && dd > b * b)) { var s = (Math.sqrt(dd) / b - 1) * mix + 1; bone.scaleX *= s; - if (uniform) bone.scaleY *= s; + if (uniform) + bone.scaleY *= s; } } } @@ -153,12 +159,14 @@ class IkConstraint extends Constraint { - /** The bones that are constrained by this IK constraint. */ public final bones:Array = new Array(); @@ -44,17 +43,17 @@ class IkConstraintData extends ConstraintData { * on both the X and Y axes. */ public var uniform = false; - public function new(name:String) { super(name, new IkConstraintPose()); } - public function create (skeleton:Skeleton):IkConstraint { + public function create(skeleton:Skeleton):IkConstraint { return new IkConstraint(this, skeleton); } - public function set_target (target:BoneData) { - if (target == null) throw new SpineException("target cannot be null."); + public function set_target(target:BoneData) { + if (target == null) + throw new SpineException("target cannot be null."); this.target = target; return target; } diff --git a/spine-haxe/spine-haxe/spine/IkConstraintPose.hx b/spine-haxe/spine-haxe/spine/IkConstraintPose.hx index ca3d74e77..cacfb0867 100644 --- a/spine-haxe/spine-haxe/spine/IkConstraintPose.hx +++ b/spine-haxe/spine-haxe/spine/IkConstraintPose.hx @@ -25,13 +25,12 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; /** Stores the current pose for an IK constraint. */ class IkConstraintPose implements Pose { - /** For two bone IK, controls the bend direction of the IK bones, either 1 or -1. */ public var bendDirection = 0; @@ -39,29 +38,27 @@ class IkConstraintPose implements Pose { public var compress:Bool = false; /** When true and the target is out of range, the parent bone is scaled to reach it. - * - * For two bone IK: 1) the child bone's local Y translation is set to 0, 2) stretch is not applied if softness is - * > 0, and 3) if the parent bone has local nonuniform scale, stretch is not applied. */ + * + * For two bone IK: 1) the child bone's local Y translation is set to 0, 2) stretch is not applied if softness is + * > 0, and 3) if the parent bone has local nonuniform scale, stretch is not applied. */ public var stretch:Bool = false; /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotation. - * - * For two bone IK: if the parent bone has local nonuniform scale, the child bone's local Y translation is set to 0. */ + * + * For two bone IK: if the parent bone has local nonuniform scale, the child bone's local Y translation is set to 0. */ public var mix = 0.; /** For two bone IK, the target bone's distance from the maximum reach of the bones where rotation begins to slow. The bones - * will not straighten completely until the target is this far out of range. */ + * will not straighten completely until the target is this far out of range. */ public var softness = 0.; - public function new () { - } + public function new() {} - public function set (pose:IkConstraintPose) { + public function set(pose:IkConstraintPose) { mix = pose.mix; softness = pose.softness; bendDirection = pose.bendDirection; compress = pose.compress; stretch = pose.stretch; } - -} \ No newline at end of file +} diff --git a/spine-haxe/spine-haxe/spine/Inherit.hx b/spine-haxe/spine-haxe/spine/Inherit.hx index 90654c914..42f54f8dd 100644 --- a/spine-haxe/spine-haxe/spine/Inherit.hx +++ b/spine-haxe/spine-haxe/spine/Inherit.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/MathUtils.hx b/spine-haxe/spine-haxe/spine/MathUtils.hx index bb116337f..e7b86260f 100644 --- a/spine-haxe/spine-haxe/spine/MathUtils.hx +++ b/spine-haxe/spine-haxe/spine/MathUtils.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -63,7 +63,7 @@ class MathUtils { * @param x The x-coordinate. * @return The arc tangent in degrees. */ - static public function atan2Deg (y:Float, x:Float):Float { + static public function atan2Deg(y:Float, x:Float):Float { return Math.atan2(y, x) * MathUtils.radDeg; } diff --git a/spine-haxe/spine-haxe/spine/PathConstraint.hx b/spine-haxe/spine-haxe/spine/PathConstraint.hx index 92868fc24..131b7793d 100644 --- a/spine-haxe/spine-haxe/spine/PathConstraint.hx +++ b/spine-haxe/spine-haxe/spine/PathConstraint.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -56,9 +56,10 @@ class PathConstraint extends Constraint(); private final segments = new Array(); - public function new (data:PathConstraintData, skeleton:Skeleton) { + public function new(data:PathConstraintData, skeleton:Skeleton) { super(data, new PathConstraintPose(), new PathConstraintPose()); - if (skeleton == null) throw new SpineException("skeleton cannot be null."); + if (skeleton == null) + throw new SpineException("skeleton cannot be null."); bones = new Array(); for (boneData in data.bones) @@ -76,18 +77,23 @@ class PathConstraint extends Constraint = positions, world = new Array(); var closed = path.closed; - var verticesLength = path.worldVerticesLength, curveCount = Std.int(verticesLength / 6), prevCurve = NONE; + var verticesLength = path.worldVerticesLength, + curveCount = Std.int(verticesLength / 6), + prevCurve = NONE; if (!path.constantSpeed) { var lengths = path.lengths; curveCount -= closed ? 1 : 2; var pathLength = lengths[curveCount]; - if (data.positionMode == PositionMode.percent) position *= pathLength; + if (data.positionMode == PositionMode.percent) + position *= pathLength; - var multiplier: Float; + var multiplier:Float; switch (data.spacingMode) { - case SpacingMode.percent: multiplier = pathLength; - case SpacingMode.proportional: multiplier = pathLength / spacesCount; - default: multiplier = 1; + case SpacingMode.percent: + multiplier = pathLength; + case SpacingMode.proportional: + multiplier = pathLength / spacesCount; + default: + multiplier = 1; } ArrayUtils.resize(world, 8, 0); @@ -234,7 +253,8 @@ class PathConstraint extends Constraint 0 && space == 0)); + addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o, tangents || (i > 0 && space == 0)); i++; o += 3; } @@ -341,13 +360,17 @@ class PathConstraint extends Constraint { - /** The position along the path. */ public var position = 0.; @@ -46,8 +45,7 @@ class PathConstraintPose implements Pose { /** A percentage (0-1) that controls the mix between the constrained and unconstrained translation Y. */ public var mixY = 0.; - public function new () { - } + public function new() {} public function set(pose:PathConstraintPose) { position = pose.position; diff --git a/spine-haxe/spine-haxe/spine/Physics.hx b/spine-haxe/spine-haxe/spine/Physics.hx index b179b0ae8..2a6607ef0 100644 --- a/spine-haxe/spine-haxe/spine/Physics.hx +++ b/spine-haxe/spine-haxe/spine/Physics.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -33,10 +33,13 @@ package spine; class Physics { /** Physics are not updated or applied. */ public static var none(default, never):Physics = new Physics("none"); + /** Physics are reset to the current pose. */ public static var reset(default, never):Physics = new Physics("reset"); + /** Physics are updated and the pose from physics is applied. */ public static var update(default, never):Physics = new Physics("update"); + /** Physics are not updated but the pose from physics is applied. */ public static var pose(default, never):Physics = new Physics("pose"); diff --git a/spine-haxe/spine-haxe/spine/PhysicsConstraint.hx b/spine-haxe/spine-haxe/spine/PhysicsConstraint.hx index f22fe56ac..58b5317a2 100644 --- a/spine-haxe/spine-haxe/spine/PhysicsConstraint.hx +++ b/spine-haxe/spine-haxe/spine/PhysicsConstraint.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -35,7 +35,6 @@ package spine; * @see https://esotericsoftware.com/spine-physics-constraints Physics constraints in the Spine User Guide */ class PhysicsConstraint extends Constraint { - /** The bone constrained by this physics constraint. */ public var bone:BonePose = null; @@ -62,9 +61,10 @@ class PhysicsConstraint extends Constraint 0, y = data.y > 0, rotateOrShearX = data.rotate > 0 || data.shearX > 0, scaleX = data.scaleX > 0; + var x = data.x > 0, + y = data.y > 0, + rotateOrShearX = data.rotate > 0 || data.shearX > 0, + scaleX = data.scaleX > 0; var l = bone.bone.data.length, t = data.step, z = 0.; switch (physics) { case Physics.none: return; case Physics.reset, Physics.update: - if (physics == Physics.reset) reset(skeleton); + if (physics == Physics.reset) + reset(skeleton); var delta = Math.max(skeleton.time - lastTime, 0), aa = remaining; remaining += delta; @@ -135,8 +142,8 @@ class PhysicsConstraint extends Constraint 0) scaleOffset += (dx * c + dy * s) * i / r; + if (r > 0) + scaleOffset += (dx * c + dy * s) * i / r; } } else { c = Math.cos(ca); s = Math.sin(ca); var r = l * bone.worldScaleX - scaleLag * Math.max(0, 1 - aa / t); - if (r > 0) scaleOffset += (dx * c + dy * s) * i / r; + if (r > 0) + scaleOffset += (dx * c + dy * s) * i / r; } if (a >= t) { if (d == -1) { d = Math.pow(p.damping, 60 * t); m = t * p.massInverse; e = p.strength; - var w = f * p.wind, g = f * p.gravity * Bone.yDir; + var w = f * p.wind, + g = f * p.gravity * Bone.yDir; ax = (w * skeleton.windX + g * skeleton.gravityX) * skeleton.scaleX; ay = (w * skeleton.windY + g * skeleton.gravityY) * skeleton.scaleY; } @@ -227,7 +239,8 @@ class PhysicsConstraint extends Constraint { - /** The bone constrained by this physics constraint. */ public var bone:BoneData; @@ -44,8 +43,10 @@ class PhysicsConstraintData extends ConstraintData { - public var inertia = 0.; public var strength = 0.; public var damping = 0.; public var massInverse = 0.; public var wind = 0.; public var gravity = 0.; + /** A percentage (0-1) that controls the mix between the constrained and unconstrained poses. */ public var mix = 0.; - public function new () { - } + public function new() {} - public function set (pose:PhysicsConstraintPose) { + public function set(pose:PhysicsConstraintPose) { inertia = pose.inertia; strength = pose.strength; damping = pose.damping; diff --git a/spine-haxe/spine-haxe/spine/Polygon.hx b/spine-haxe/spine-haxe/spine/Polygon.hx index 950b0ab22..6ce4becec 100644 --- a/spine-haxe/spine-haxe/spine/Polygon.hx +++ b/spine-haxe/spine-haxe/spine/Polygon.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/Pool.hx b/spine-haxe/spine-haxe/spine/Pool.hx index 351155f6a..25c2feac0 100644 --- a/spine-haxe/spine-haxe/spine/Pool.hx +++ b/spine-haxe/spine-haxe/spine/Pool.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/Poolable.hx b/spine-haxe/spine-haxe/spine/Poolable.hx index e087bc5a1..4c7e308a1 100644 --- a/spine-haxe/spine-haxe/spine/Poolable.hx +++ b/spine-haxe/spine-haxe/spine/Poolable.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/Pose.hx b/spine-haxe/spine-haxe/spine/Pose.hx index 88da2ad71..6729a1f96 100644 --- a/spine-haxe/spine-haxe/spine/Pose.hx +++ b/spine-haxe/spine-haxe/spine/Pose.hx @@ -25,10 +25,10 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; interface Pose

{ - public function set (pose:P):Void; -} \ No newline at end of file + public function set(pose:P):Void; +} diff --git a/spine-haxe/spine-haxe/spine/Posed.hx b/spine-haxe/spine-haxe/spine/Posed.hx index 4bdad9cfb..3ba13d8d6 100644 --- a/spine-haxe/spine-haxe/spine/Posed.hx +++ b/spine-haxe/spine-haxe/spine/Posed.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -33,15 +33,16 @@ abstract class Posed< // D:PosedData

, // P:Pose, // A:P> { - /** The constraint's setup pose data. */ public final data:D; + public final pose:A; public final constrained:A; public var applied:A; - public function new (data:D, pose:A, constrained:A) { - if (data == null) throw new SpineException("data cannot be null."); + public function new(data:D, pose:A, constrained:A) { + if (data == null) + throw new SpineException("data cannot be null."); this.data = data; this.pose = pose; this.constrained = constrained; @@ -49,35 +50,35 @@ abstract class Posed< // } /** The constraint's setup pose data. */ - public function getData ():D { + public function getData():D { return data; } - public function getPose ():P { + public function getPose():P { return pose; } - public function getAppliedPose ():A { + public function getAppliedPose():A { return applied; } - public function setupPose ():Void { + public function setupPose():Void { pose.set(data.setup); } - public function usePose ():Void { // Port: usePose - reference runtime: pose() + public function usePose():Void { // Port: usePose - reference runtime: pose() applied = pose; } - public function useConstrained ():Void { // Port: useConstrained - reference runtime: constrained() + public function useConstrained():Void { // Port: useConstrained - reference runtime: constrained() applied = constrained; } - public function resetConstrained ():Void { // Port: resetConstrained - reference runtime: reset() + public function resetConstrained():Void { // Port: resetConstrained - reference runtime: reset() constrained.set(pose); } - public function toString ():String { + public function toString():String { return data.name; } } diff --git a/spine-haxe/spine-haxe/spine/PosedActive.hx b/spine-haxe/spine-haxe/spine/PosedActive.hx index 8c092d979..93a2d98d6 100644 --- a/spine-haxe/spine-haxe/spine/PosedActive.hx +++ b/spine-haxe/spine-haxe/spine/PosedActive.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -33,11 +33,10 @@ abstract class PosedActive< // D:PosedData

, // P:Pose, // A:P> // - extends Posed { - +extends Posed { public var active:Bool; - public function new (data:D, pose:A, constrained:A) { + public function new(data:D, pose:A, constrained:A) { super(data, pose, constrained); setupPose(); } @@ -49,7 +48,7 @@ abstract class PosedActive< // * @see Skin.getConstraints() * @see PosedData.getSkinRequired() * @see Skeleton.updateCache() */ - public function isActive ():Bool { + public function isActive():Bool { return active; } } diff --git a/spine-haxe/spine-haxe/spine/PosedData.hx b/spine-haxe/spine-haxe/spine/PosedData.hx index d42878b41..aaf69b10c 100644 --- a/spine-haxe/spine-haxe/spine/PosedData.hx +++ b/spine-haxe/spine-haxe/spine/PosedData.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -37,18 +37,19 @@ abstract class PosedData> { public final setup:P; /** When true, `Skeleton.updateWorldTransform(Physics)` only updates this constraint if the `Skeleton.getSkin()` - * contains this constraint. - * - * See `Skin.getConstraints()`. */ + * contains this constraint. + * + * See `Skin.getConstraints()`. */ public var skinRequired:Bool; - public function new (name:String, setup:P) { - if (name == null) throw new SpineException("name cannot be null."); + public function new(name:String, setup:P) { + if (name == null) + throw new SpineException("name cannot be null."); this.name = name; this.setup = setup; } - public function toString ():String { + public function toString():String { return name; } } diff --git a/spine-haxe/spine-haxe/spine/PositionMode.hx b/spine-haxe/spine-haxe/spine/PositionMode.hx index 4206cbbc3..dd8ac40c6 100644 --- a/spine-haxe/spine-haxe/spine/PositionMode.hx +++ b/spine-haxe/spine-haxe/spine/PositionMode.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/Rectangle.hx b/spine-haxe/spine-haxe/spine/Rectangle.hx index 64b5ea95d..d85e70c1d 100644 --- a/spine-haxe/spine-haxe/spine/Rectangle.hx +++ b/spine-haxe/spine-haxe/spine/Rectangle.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/RotateMode.hx b/spine-haxe/spine-haxe/spine/RotateMode.hx index 6bc2aae42..a679a25b9 100644 --- a/spine-haxe/spine-haxe/spine/RotateMode.hx +++ b/spine-haxe/spine-haxe/spine/RotateMode.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -35,6 +35,7 @@ package spine; class RotateMode { public static var tangent(default, never):RotateMode = new RotateMode("tangent"); public static var chain(default, never):RotateMode = new RotateMode("chain"); + /** When chain scale, constrained bones should all have the same parent. That way when the path constraint scales a bone, it * doesn't affect other constrained bones. */ public static var chainScale(default, never):RotateMode = new RotateMode("chainScale"); diff --git a/spine-haxe/spine-haxe/spine/Sequence.hx b/spine-haxe/spine-haxe/spine/Sequence.hx index 3974d00fc..d31d9037c 100644 --- a/spine-haxe/spine-haxe/spine/Sequence.hx +++ b/spine-haxe/spine-haxe/spine/Sequence.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -35,6 +35,7 @@ class Sequence { /** Returns a unique ID for this attachment. */ public var id = _nextID++; + public var regions:Array; public var start = 0; public var digits = 0; diff --git a/spine-haxe/spine-haxe/spine/SequenceMode.hx b/spine-haxe/spine-haxe/spine/SequenceMode.hx index 8ea02336d..134adefef 100644 --- a/spine-haxe/spine-haxe/spine/SequenceMode.hx +++ b/spine-haxe/spine-haxe/spine/SequenceMode.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/Skeleton.hx b/spine-haxe/spine-haxe/spine/Skeleton.hx index 183033539..8e4a4a93c 100644 --- a/spine-haxe/spine-haxe/spine/Skeleton.hx +++ b/spine-haxe/spine-haxe/spine/Skeleton.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -65,7 +65,7 @@ class Skeleton { /** The list of bones and constraints, sorted in the order they should be updated, as computed by Skeleton.updateCache(). */ public final _updateCache = new Array(); - private final resetCache = new Array> (); + private final resetCache = new Array>(); /** The skeleton's current skin. */ public var skin(default, set):Skin = null; @@ -84,14 +84,15 @@ class Skeleton { public var y:Float = 0; /** Scales the entire skeleton on the X axis. - * - * Bones that do not inherit scale are still affected by this property. */ + * + * Bones that do not inherit scale are still affected by this property. */ public var scaleX:Float = 1; /** Scales the entire skeleton on the Y axis. - * - * Bones that do not inherit scale are still affected by this property. */ + * + * Bones that do not inherit scale are still affected by this property. */ public var scaleY(get, default):Float = 1; + function get_scaleY() { return scaleY * Bone.yDir; } @@ -110,7 +111,8 @@ class Skeleton { /** Creates a new skeleton with the specified skeleton data. */ public function new(data:SkeletonData) { - if (data == null) throw new SpineException("data cannot be null."); + if (data == null) + throw new SpineException("data cannot be null."); this.data = data; bones = new Array(); @@ -138,7 +140,8 @@ class Skeleton { constraints = new Array>(); for (constraintData in data.constraints) { var constraint = constraintData.create(this); - if (Std.isOfType(constraint, PhysicsConstraint)) physics.push(cast(constraint, PhysicsConstraint)); + if (Std.isOfType(constraint, PhysicsConstraint)) + physics.push(cast(constraint, PhysicsConstraint)); constraints.push(constraint); } @@ -180,7 +183,8 @@ class Skeleton { var constraint:Constraint = c; constraint.active = constraint.isSourceActive() && (!constraint.data.skinRequired || (skin != null && contains(skin.constraints, constraint.data))); - if (constraint.active) constraint.sort(this); + if (constraint.active) + constraint.sort(this); } for (bone in bones) @@ -201,7 +205,7 @@ class Skeleton { return list.indexOf(element) != -1; } - public function constrained (object:Posed) { + public function constrained(object:Posed) { if (object.pose == object.applied) { object.useConstrained(); resetCache.push(object); @@ -209,9 +213,11 @@ class Skeleton { } public function sortBone(bone:Bone):Void { - if (bone.sorted || !bone.active) return; + if (bone.sorted || !bone.active) + return; var parent = bone.parent; - if (parent != null) sortBone(parent); + if (parent != null) + sortBone(parent); bone.sorted = true; _updateCache.push(bone); } @@ -219,7 +225,8 @@ class Skeleton { public function sortReset(bones:Array):Void { for (bone in bones) { if (bone.active) { - if (bone.sorted) sortReset(bone.children); + if (bone.sorted) + sortReset(bone.children); bone.sorted = false; } } @@ -247,8 +254,10 @@ class Skeleton { /** Sets the bones and constraints to their setup pose values. */ public function setupPoseBones():Void { - for (bone in this.bones) bone.setupPose(); - for (constraint in this.constraints) constraint.setupPose(); + for (bone in this.bones) + bone.setupPose(); + for (constraint in this.constraints) + constraint.setupPose(); } /** Sets the slots and draw order to their setup pose values. */ @@ -270,18 +279,22 @@ class Skeleton { /** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it * repeatedly. */ public function findBone(boneName:String):Bone { - if (boneName == null) throw new SpineException("boneName cannot be null."); + if (boneName == null) + throw new SpineException("boneName cannot be null."); for (bone in bones) - if (bone.data.name == boneName) return bone; + if (bone.data.name == boneName) + return bone; return null; } /** @return -1 if the bone was not found. */ public function findBoneIndex(boneName:String):Int { - if (boneName == null) throw new SpineException("boneName cannot be null."); + if (boneName == null) + throw new SpineException("boneName cannot be null."); var i:Int = 0; for (bone in bones) { - if (bone.data.name == boneName) return i; + if (bone.data.name == boneName) + return i; i++; } return -1; @@ -290,9 +303,11 @@ class Skeleton { /** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it * repeatedly. */ public function findSlot(slotName:String):Slot { - if (slotName == null) throw new SpineException("slotName cannot be null."); + if (slotName == null) + throw new SpineException("slotName cannot be null."); for (slot in slots) - if (slot.data.name == slotName) return slot; + if (slot.data.name == slotName) + return slot; return null; } @@ -337,7 +352,8 @@ class Skeleton { var name:String = slot.data.attachmentName; if (name != null) { var attachment:Attachment = newSkin.getAttachment(i, name); - if (attachment != null) slot.pose.attachment = attachment; + if (attachment != null) + slot.pose.attachment = attachment; } i++; } @@ -399,10 +415,13 @@ class Skeleton { } public function findConstraint>(constraintName:String, type:Class):Null { - if (constraintName == null) throw new SpineException("constraintName cannot be null."); - if (type == null) throw new SpineException("type cannot be null."); + if (constraintName == null) + throw new SpineException("constraintName cannot be null."); + if (type == null) + throw new SpineException("type cannot be null."); for (constraint in constraints) - if (Std.isOfType(constraint, type) && constraint.data.name == constraintName) return Std.downcast(constraint, type); + if (Std.isOfType(constraint, type) && constraint.data.name == constraintName) + return Std.downcast(constraint, type); return null; } @@ -411,7 +430,7 @@ class Skeleton { /** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose. Optionally applies * clipping. */ - public function getBounds(clipper: SkeletonClipping = null):Rectangle { + public function getBounds(clipper:SkeletonClipping = null):Rectangle { var minX = Math.POSITIVE_INFINITY; var minY = Math.POSITIVE_INFINITY; var maxX = Math.NEGATIVE_INFINITY; @@ -456,10 +475,12 @@ class Skeleton { ii += 2; } } - if (clipper != null) clipper.clipEnd(slot); + if (clipper != null) + clipper.clipEnd(slot); } } - if (clipper != null) clipper.clipEnd(); + if (clipper != null) + clipper.clipEnd(); _bounds.x = minX; _bounds.y = minY; _bounds.width = maxX - minX; @@ -468,18 +489,18 @@ class Skeleton { } /** Increments the skeleton's Skeleton.time. */ - public function update (delta:Float):Void { + public function update(delta:Float):Void { time += delta; } /** Calls spine.PhysicsConstraint.translate() for each physics constraint. */ - public function physicsTranslate (x:Float, y:Float):Void { + public function physicsTranslate(x:Float, y:Float):Void { for (physicsConstraint in physics) physicsConstraint.translate(x, y); } /** Calls spine.PhysicsConstraint.rotate() for each physics constraint. */ - public function physicsRotate (x:Float, y:Float, degrees:Float):Void { + public function physicsRotate(x:Float, y:Float, degrees:Float):Void { for (physicsConstraint in physics) physicsConstraint.rotate(x, y, degrees); } diff --git a/spine-haxe/spine-haxe/spine/SkeletonBinary.hx b/spine-haxe/spine-haxe/spine/SkeletonBinary.hx index cf24bf3b4..8108766e6 100644 --- a/spine-haxe/spine-haxe/spine/SkeletonBinary.hx +++ b/spine-haxe/spine-haxe/spine/SkeletonBinary.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -219,11 +219,13 @@ class SkeletonBinary { data.setup.color.setFromRgba8888(input.readInt32()); var darkColor = input.readInt32(); - if (darkColor != -1) data.setup.darkColor = new Color(0, 0, 0).setFromRgb888(darkColor); + if (darkColor != -1) + data.setup.darkColor = new Color(0, 0, 0).setFromRgb888(darkColor); data.attachmentName = input.readStringRef(); data.blendMode = BlendMode.values[input.readInt(true)]; - if (nonessential) data.visible = input.readBoolean(); + if (nonessential) + data.visible = input.readBoolean(); slots.push(data); } @@ -248,8 +250,10 @@ class SkeletonBinary { setup.bendDirection = (flags & 4) != 0 ? 1 : -1; setup.compress = (flags & 8) != 0; setup.stretch = (flags & 16) != 0; - if ((flags & 32) != 0) setup.mix = (flags & 64) != 0 ? input.readFloat() : 1; - if ((flags & 128) != 0) setup.softness = input.readFloat() * scale; + if ((flags & 32) != 0) + setup.mix = (flags & 64) != 0 ? input.readFloat() : 1; + if ((flags & 128) != 0) + setup.softness = input.readFloat() * scale; constraints[i] = data; case CONSTRAINT_TRANSFORM: var data = new TransformConstraintData(name); @@ -309,20 +313,32 @@ class SkeletonBinary { froms[ii] = from; } flags = input.readByte(); - if ((flags & 1) != 0) data.offsets[TransformConstraintData.ROTATION] = input.readFloat(); - if ((flags & 2) != 0) data.offsets[TransformConstraintData.X] = input.readFloat() * scale; - if ((flags & 4) != 0) data.offsets[TransformConstraintData.Y] = input.readFloat() * scale; - if ((flags & 8) != 0) data.offsets[TransformConstraintData.SCALEX] = input.readFloat(); - if ((flags & 16) != 0) data.offsets[TransformConstraintData.SCALEY] = input.readFloat(); - if ((flags & 32) != 0) data.offsets[TransformConstraintData.SHEARY] = input.readFloat(); + if ((flags & 1) != 0) + data.offsets[TransformConstraintData.ROTATION] = input.readFloat(); + if ((flags & 2) != 0) + data.offsets[TransformConstraintData.X] = input.readFloat() * scale; + if ((flags & 4) != 0) + data.offsets[TransformConstraintData.Y] = input.readFloat() * scale; + if ((flags & 8) != 0) + data.offsets[TransformConstraintData.SCALEX] = input.readFloat(); + if ((flags & 16) != 0) + data.offsets[TransformConstraintData.SCALEY] = input.readFloat(); + if ((flags & 32) != 0) + data.offsets[TransformConstraintData.SHEARY] = input.readFloat(); flags = input.readByte(); var setup = data.setup; - if ((flags & 1) != 0) setup.mixRotate = input.readFloat(); - if ((flags & 2) != 0) setup.mixX = input.readFloat(); - if ((flags & 4) != 0) setup.mixY = input.readFloat(); - if ((flags & 8) != 0) setup.mixScaleX = input.readFloat(); - if ((flags & 16) != 0) setup.mixScaleY = input.readFloat(); - if ((flags & 32) != 0) setup.mixShearY = input.readFloat(); + if ((flags & 1) != 0) + setup.mixRotate = input.readFloat(); + if ((flags & 2) != 0) + setup.mixX = input.readFloat(); + if ((flags & 4) != 0) + setup.mixY = input.readFloat(); + if ((flags & 8) != 0) + setup.mixScaleX = input.readFloat(); + if ((flags & 16) != 0) + setup.mixScaleY = input.readFloat(); + if ((flags & 32) != 0) + setup.mixShearY = input.readFloat(); constraints[i] = data; case CONSTRAINT_PATH: var data = new PathConstraintData(name); @@ -336,12 +352,15 @@ class SkeletonBinary { data.positionMode = PositionMode.values[(flags >> 1) & 2]; data.spacingMode = SpacingMode.values[(flags >> 2) & 3]; data.rotateMode = RotateMode.values[(flags >> 4) & 3]; - if ((flags & 128) != 0) data.offsetRotation = input.readFloat(); + if ((flags & 128) != 0) + data.offsetRotation = input.readFloat(); var setup = data.setup; setup.position = input.readFloat(); - if (data.positionMode == PositionMode.fixed) setup.position *= scale; + if (data.positionMode == PositionMode.fixed) + setup.position *= scale; setup.spacing = input.readFloat(); - if (data.spacingMode == SpacingMode.length || data.spacingMode == SpacingMode.fixed) setup.spacing *= scale; + if (data.spacingMode == SpacingMode.length || data.spacingMode == SpacingMode.fixed) + setup.spacing *= scale; setup.mixRotate = input.readFloat(); setup.mixX = input.readFloat(); setup.mixY = input.readFloat(); @@ -351,11 +370,16 @@ class SkeletonBinary { data.bone = bones[input.readInt(true)]; var flags = input.readByte(); data.skinRequired = (flags & 1) != 0; - if ((flags & 2) != 0) data.x = input.readFloat(); - if ((flags & 4) != 0) data.y = input.readFloat(); - if ((flags & 8) != 0) data.rotate = input.readFloat(); - if ((flags & 16) != 0) data.scaleX = input.readFloat(); - if ((flags & 32) != 0) data.shearX = input.readFloat(); + if ((flags & 2) != 0) + data.x = input.readFloat(); + if ((flags & 4) != 0) + data.y = input.readFloat(); + if ((flags & 8) != 0) + data.rotate = input.readFloat(); + if ((flags & 16) != 0) + data.scaleX = input.readFloat(); + if ((flags & 32) != 0) + data.shearX = input.readFloat(); data.limit = ((flags & 64) != 0 ? input.readFloat() : 5000) * scale; data.step = .1 / input.readUnsignedByte(); var setup = data.setup; @@ -366,13 +390,20 @@ class SkeletonBinary { setup.wind = input.readFloat(); setup.gravity = input.readFloat(); flags = input.readByte(); - if ((flags & 1) != 0) data.inertiaGlobal = true; - if ((flags & 2) != 0) data.strengthGlobal = true; - if ((flags & 4) != 0) data.dampingGlobal = true; - if ((flags & 8) != 0) data.massGlobal = true; - if ((flags & 16) != 0) data.windGlobal = true; - if ((flags & 32) != 0) data.gravityGlobal = true; - if ((flags & 64) != 0) data.mixGlobal = true; + if ((flags & 1) != 0) + data.inertiaGlobal = true; + if ((flags & 2) != 0) + data.strengthGlobal = true; + if ((flags & 4) != 0) + data.dampingGlobal = true; + if ((flags & 8) != 0) + data.massGlobal = true; + if ((flags & 16) != 0) + data.windGlobal = true; + if ((flags & 32) != 0) + data.gravityGlobal = true; + if ((flags & 64) != 0) + data.mixGlobal = true; setup.mix = (flags & 128) != 0 ? input.readFloat() : 1; constraints[i] = data; case CONSTRAINT_SLIDER: @@ -381,8 +412,10 @@ class SkeletonBinary { data.skinRequired = (flags & 1) != 0; data.loop = (flags & 2) != 0; data.additive = (flags & 4) != 0; - if ((flags & 8) != 0) data.setup.time = input.readFloat(); - if ((flags & 16) != 0) data.setup.mix = (flags & 32) != 0 ? input.readFloat() : 1; + if ((flags & 8) != 0) + data.setup.time = input.readFloat(); + if ((flags & 16) != 0) + data.setup.mix = (flags & 32) != 0 ? input.readFloat() : 1; if ((flags & 64) != 0) { data.local = (flags & 128) != 0; data.bone = bones[input.readInt(true)]; @@ -392,10 +425,10 @@ class SkeletonBinary { case 0: data.property = new FromRotate(); case 1: propertyScale = scale; - data.property = new FromX(); + data.property = new FromX(); case 2: propertyScale = scale; - data.property = new FromY(); + data.property = new FromY(); case 3: data.property = new FromScaleX(); case 4: data.property = new FromScaleY(); case 5: data.property = new FromShearY(); @@ -409,7 +442,6 @@ class SkeletonBinary { } } - // Default skin. var defaultSkin:Skin = readSkin(input, skeletonData, true, nonessential); if (defaultSkin != null) { @@ -462,7 +494,7 @@ class SkeletonBinary { animations[i] = readAnimation(input, input.readString(), skeletonData); for (i in 0...constraintCount) - if (Std.isOfType(constraints[i], SliderData)){ + if (Std.isOfType(constraints[i], SliderData)) { var data = cast(constraints[i], SliderData); data.animation = animations[input.readInt(true)]; }; @@ -481,7 +513,8 @@ class SkeletonBinary { } else { skin = new Skin(input.readString()); - if (nonessential) skin.color.setFromRgba8888(input.readInt32()); + if (nonessential) + skin.color.setFromRgba8888(input.readInt32()); var n:Int; var from1 = skeletonData.bones; @@ -622,7 +655,8 @@ class SkeletonBinary { return mesh; case AttachmentType.linkedmesh: path = (flags & 16) != 0 ? input.readStringRef() : name; - if (path == null) throw new SpineException("Path of linked mesh must not be null"); + if (path == null) + throw new SpineException("Path of linked mesh must not be null"); color = (flags & 32) != 0 ? input.readInt32() : 0xffffffff; var sequence = (flags & 64) != 0 ? this.readSequence(input) : null; var inheritTimelines:Bool = (flags & 128) != 0; @@ -757,11 +791,7 @@ class SkeletonBinary { var i:Int = 0, n:Int = 0, ii:Int = 0, nn:Int = 0; var index:Int, slotIndex:Int, timelineType:Int, timelineScale:Float; - var frameCount:Int, - frameLast:Int, - frame:Int, - bezierCount:Int, - bezier:Int; + var frameCount:Int, frameLast:Int, frame:Int, bezierCount:Int, bezier:Int; var time:Float, time2:Float; // Slot timelines. @@ -1009,19 +1039,26 @@ class SkeletonBinary { } bezierCount = input.readInt(true); switch (timelineType) { - case BONE_ROTATE: readTimeline(input, timelines, new RotateTimeline(frameCount, bezierCount, boneIndex), 1); + case BONE_ROTATE: + readTimeline(input, timelines, new RotateTimeline(frameCount, bezierCount, boneIndex), 1); case BONE_TRANSLATE: // readTimeline2(input, timelines, new TranslateTimeline(frameCount, bezierCount, boneIndex), scale); case BONE_TRANSLATEX: // readTimeline(input, timelines, new TranslateXTimeline(frameCount, bezierCount, boneIndex), scale); case BONE_TRANSLATEY: // readTimeline(input, timelines, new TranslateYTimeline(frameCount, bezierCount, boneIndex), scale); - case BONE_SCALE: readTimeline2(input, timelines, new ScaleTimeline(frameCount, bezierCount, boneIndex), 1); - case BONE_SCALEX: readTimeline(input, timelines, new ScaleXTimeline(frameCount, bezierCount, boneIndex), 1); - case BONE_SCALEY: readTimeline(input, timelines, new ScaleYTimeline(frameCount, bezierCount, boneIndex), 1); - case BONE_SHEAR: readTimeline2(input, timelines, new ShearTimeline(frameCount, bezierCount, boneIndex), 1); - case BONE_SHEARX: readTimeline(input, timelines, new ShearXTimeline(frameCount, bezierCount, boneIndex), 1); - case BONE_SHEARY: readTimeline(input, timelines, new ShearYTimeline(frameCount, bezierCount, boneIndex), 1); + case BONE_SCALE: + readTimeline2(input, timelines, new ScaleTimeline(frameCount, bezierCount, boneIndex), 1); + case BONE_SCALEX: + readTimeline(input, timelines, new ScaleXTimeline(frameCount, bezierCount, boneIndex), 1); + case BONE_SCALEY: + readTimeline(input, timelines, new ScaleYTimeline(frameCount, bezierCount, boneIndex), 1); + case BONE_SHEAR: + readTimeline2(input, timelines, new ShearTimeline(frameCount, bezierCount, boneIndex), 1); + case BONE_SHEARX: + readTimeline(input, timelines, new ShearXTimeline(frameCount, bezierCount, boneIndex), 1); + case BONE_SHEARY: + readTimeline(input, timelines, new ShearYTimeline(frameCount, bezierCount, boneIndex), 1); } } } @@ -1035,7 +1072,7 @@ class SkeletonBinary { var flags = input.readByte(); time = input.readFloat(); var mix:Float = (flags & 1) != 0 ? ((flags & 2) != 0 ? input.readFloat() : 1) : 0; - var softness:Float = (flags & 4) != 0 ? input.readFloat() * scale : 0; + var softness:Float = (flags & 4) != 0 ? input.readFloat() * scale : 0; frame = 0; bezier = 0; @@ -1046,7 +1083,7 @@ class SkeletonBinary { flags = input.readByte(); time2 = input.readFloat(); var mix2:Float = (flags & 1) != 0 ? ((flags & 2) != 0 ? input.readFloat() : 1) : 0; - var softness2:Float = (flags & 4) != 0 ? input.readFloat() * scale : 0; + var softness2:Float = (flags & 4) != 0 ? input.readFloat() * scale : 0; if ((flags & 64) != 0) { ikTimeline.setStepped(frame); } else if ((flags & 128) != 0) { @@ -1094,7 +1131,8 @@ class SkeletonBinary { mixScaleY2:Float = input.readFloat(), mixShearY2:Float = input.readFloat(); switch (input.readByte()) { - case CURVE_STEPPED: transformTimeline.setStepped(frame); + case CURVE_STEPPED: + transformTimeline.setStepped(frame); case CURVE_BEZIER: setBezier(input, transformTimeline, bezier++, frame, 0, time, time2, mixRotate, mixRotate2, 1); setBezier(input, transformTimeline, bezier++, frame, 1, time, time2, mixX, mixX2, 1); @@ -1122,15 +1160,16 @@ class SkeletonBinary { index = input.readInt(true); var data = cast(skeletonData.constraints[index], PathConstraintData); for (ii in 0...input.readInt(true)) { - var type:Int = input.readByte(), frameCount:Int = input.readInt(true), bezierCount:Int = input.readInt(true); + var type:Int = input.readByte(), + frameCount:Int = input.readInt(true), + bezierCount:Int = input.readInt(true); switch (type) { case PATH_POSITION: readTimeline(input, timelines, new PathConstraintPositionTimeline(frameCount, bezierCount, index), data.positionMode == PositionMode.fixed ? scale : 1); case PATH_SPACING: - readTimeline(input, timelines, new PathConstraintSpacingTimeline(frameCount, bezierCount, index), - data.spacingMode == SpacingMode.length - || data.spacingMode == SpacingMode.fixed ? scale : 1); + readTimeline(input, timelines, + new PathConstraintSpacingTimeline(frameCount, bezierCount, index), data.spacingMode == SpacingMode.length || data.spacingMode == SpacingMode.fixed ? scale : 1); case PATH_MIX: var mixTimeline:PathConstraintMixTimeline = new PathConstraintMixTimeline(frameCount, bezierCount, index); time = input.readFloat(); @@ -1172,7 +1211,8 @@ class SkeletonBinary { for (i in 0...input.readInt(true)) { var constraintIndex:Int = input.readInt(true) - 1; for (ii in 0...input.readInt(true)) { - var type:Int = input.readByte(), frameCount:Int = input.readInt(true); + var type:Int = input.readByte(), + frameCount:Int = input.readInt(true); if (type == PHYSICS_RESET) { var timeline:PhysicsConstraintResetTimeline = new PhysicsConstraintResetTimeline(frameCount, constraintIndex); for (frame in 0...frameCount) @@ -1183,14 +1223,22 @@ class SkeletonBinary { var bezierCount = input.readInt(true); var timeline:CurveTimeline1; switch (type) { - case PHYSICS_INERTIA: timeline = new PhysicsConstraintInertiaTimeline(frameCount, bezierCount, constraintIndex); - case PHYSICS_STRENGTH: timeline = new PhysicsConstraintStrengthTimeline(frameCount, bezierCount, constraintIndex); - case PHYSICS_DAMPING: timeline = new PhysicsConstraintDampingTimeline(frameCount, bezierCount, constraintIndex); - case PHYSICS_MASS: timeline = new PhysicsConstraintMassTimeline(frameCount, bezierCount, constraintIndex); - case PHYSICS_WIND: timeline = new PhysicsConstraintWindTimeline(frameCount, bezierCount, constraintIndex); - case PHYSICS_GRAVITY: timeline = new PhysicsConstraintGravityTimeline(frameCount, bezierCount, constraintIndex); - case PHYSICS_MIX: timeline = new PhysicsConstraintMixTimeline(frameCount, bezierCount, constraintIndex); - default: throw new SpineException("Unknown physics timeline type: " + type); + case PHYSICS_INERTIA: + timeline = new PhysicsConstraintInertiaTimeline(frameCount, bezierCount, constraintIndex); + case PHYSICS_STRENGTH: + timeline = new PhysicsConstraintStrengthTimeline(frameCount, bezierCount, constraintIndex); + case PHYSICS_DAMPING: + timeline = new PhysicsConstraintDampingTimeline(frameCount, bezierCount, constraintIndex); + case PHYSICS_MASS: + timeline = new PhysicsConstraintMassTimeline(frameCount, bezierCount, constraintIndex); + case PHYSICS_WIND: + timeline = new PhysicsConstraintWindTimeline(frameCount, bezierCount, constraintIndex); + case PHYSICS_GRAVITY: + timeline = new PhysicsConstraintGravityTimeline(frameCount, bezierCount, constraintIndex); + case PHYSICS_MIX: + timeline = new PhysicsConstraintMixTimeline(frameCount, bezierCount, constraintIndex); + default: + throw new SpineException("Unknown physics timeline type: " + type); } readTimeline(input, timelines, timeline, 1); } @@ -1200,12 +1248,17 @@ class SkeletonBinary { for (i in 0...input.readInt(true)) { var index = input.readInt(true); for (ii in 0...input.readInt(true)) { - var type = input.readByte(), frameCount = input.readInt(true), bezierCount = input.readInt(true); + var type = input.readByte(), + frameCount = input.readInt(true), + bezierCount = input.readInt(true); var timeline:CurveTimeline1; switch (type) { - case SLIDER_TIME: timeline = new SliderTimeline(frameCount, bezierCount, index); - case SLIDER_MIX: timeline = new SliderMixTimeline(frameCount, bezierCount, index); - default: throw new SpineException("Unknown slider timeline type: " + type); + case SLIDER_TIME: + timeline = new SliderTimeline(frameCount, bezierCount, index); + case SLIDER_MIX: + timeline = new SliderMixTimeline(frameCount, bezierCount, index); + default: + throw new SpineException("Unknown slider timeline type: " + type); } readTimeline(input, timelines, timeline, 1); } @@ -1350,7 +1403,8 @@ class SkeletonBinary { event.intValue = input.readInt(false); event.floatValue = input.readFloat(); event.stringValue = input.readString(); - if (event.stringValue == null) event.stringValue = eventData.stringValue; + if (event.stringValue == null) + event.stringValue = eventData.stringValue; if (event.data.audioPath != null) { event.volume = input.readFloat(); event.balance = input.readFloat(); @@ -1370,9 +1424,7 @@ class SkeletonBinary { var time:Float = input.readFloat(), value:Float = input.readFloat() * scale; - var frame:Int = 0, - bezier:Int = 0, - frameLast:Int = timeline.getFrameCount() - 1; + var frame:Int = 0, bezier:Int = 0, frameLast:Int = timeline.getFrameCount() - 1; while (true) { timeline.setFrame(frame, time, value); if (frame == frameLast) @@ -1381,8 +1433,10 @@ class SkeletonBinary { var time2:Float = input.readFloat(), value2:Float = input.readFloat() * scale; switch (input.readByte()) { - case CURVE_STEPPED: timeline.setStepped(frame); - case CURVE_BEZIER: setBezier(input, timeline, bezier++, frame, 0, time, time2, value, value2, scale); + case CURVE_STEPPED: + timeline.setStepped(frame); + case CURVE_BEZIER: + setBezier(input, timeline, bezier++, frame, 0, time, time2, value, value2, scale); } time = time2; value = value2; @@ -1397,9 +1451,7 @@ class SkeletonBinary { value1:Float = input.readFloat() * scale, value2:Float = input.readFloat() * scale; - var frame:Int = 0, - bezier:Int = 0, - frameLast:Int = timeline.getFrameCount() - 1; + var frame:Int = 0, bezier:Int = 0, frameLast:Int = timeline.getFrameCount() - 1; while (true) { timeline.setFrame(frame, time, value1, value2); if (frame == frameLast) @@ -1409,7 +1461,8 @@ class SkeletonBinary { nvalue1:Float = input.readFloat() * scale, nvalue2:Float = input.readFloat() * scale; switch (input.readByte()) { - case CURVE_STEPPED: timeline.setStepped(frame); + case CURVE_STEPPED: + timeline.setStepped(frame); case CURVE_BEZIER: setBezier(input, timeline, bezier++, frame, 0, time, time2, value1, nvalue1, scale); setBezier(input, timeline, bezier++, frame, 1, time, time2, value2, nvalue2, scale); diff --git a/spine-haxe/spine-haxe/spine/SkeletonClipping.hx b/spine-haxe/spine-haxe/spine/SkeletonClipping.hx index 1ec8b2733..9d126c2ca 100644 --- a/spine-haxe/spine-haxe/spine/SkeletonClipping.hx +++ b/spine-haxe/spine-haxe/spine/SkeletonClipping.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -48,9 +48,11 @@ class SkeletonClipping { public function new() {} public function clipStart(skeleton:Skeleton, slot:Slot, clip:ClippingAttachment):Int { - if (clipAttachment != null) return 0; + if (clipAttachment != null) + return 0; var n = clip.worldVerticesLength; - if (n < 6) return 0; + if (n < 6) + return 0; clipAttachment = clip; clippingPolygon.resize(n); @@ -66,7 +68,8 @@ class SkeletonClipping { } public function clipEnd(?slot:Slot):Void { - if (clipAttachment == null || (slot != null && clipAttachment.endSlot != slot.data)) return; + if (clipAttachment == null || (slot != null && clipAttachment.endSlot != slot.data)) + return; clipAttachment = null; clippingPolygons = null; clippedVertices.resize(0); @@ -203,7 +206,8 @@ class SkeletonClipping { var ii:Int = 0; while (ii < clipOutputLength) { - var x = clipOutputItems[ii], y = clipOutputItems[ii + 1]; + var x = clipOutputItems[ii], + y = clipOutputItems[ii + 1]; clippedVerticesItems[s] = x; clippedVerticesItems[s + 1] = y; var c0 = x - x3, c1 = y - y3; diff --git a/spine-haxe/spine-haxe/spine/SkeletonData.hx b/spine-haxe/spine-haxe/spine/SkeletonData.hx index b3ddf133e..3600a534f 100644 --- a/spine-haxe/spine-haxe/spine/SkeletonData.hx +++ b/spine-haxe/spine-haxe/spine/SkeletonData.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -91,6 +91,7 @@ class SkeletonData { public var hash:String; // Nonessential. + /** The dopesheet FPS in Spine, or zero if nonessential data was not exported. */ public var fps:Float = 0; @@ -123,9 +124,11 @@ class SkeletonData { * @param boneName The name of the bone to find. * @return May be null. */ public function findBone(boneName:String):BoneData { - if (boneName == null) throw new SpineException("boneName cannot be null."); + if (boneName == null) + throw new SpineException("boneName cannot be null."); for (bone in bones) - if (bone.name == boneName) return bone; + if (bone.name == boneName) + return bone; return null; } @@ -149,9 +152,11 @@ class SkeletonData { * @param slotName The name of the slot to find. * @return May be null. */ public function findSlot(slotName:String):SlotData { - if (slotName == null) throw new SpineException("slotName cannot be null."); + if (slotName == null) + throw new SpineException("slotName cannot be null."); for (slot in slots) - if (slot.name == slotName) return slot; + if (slot.name == slotName) + return slot; return null; } @@ -162,9 +167,11 @@ class SkeletonData { * @param skinName The name of the skin to find. * @return May be null. */ public function findSkin(skinName:String):Skin { - if (skinName == null) throw new SpineException("skinName cannot be null."); + if (skinName == null) + throw new SpineException("skinName cannot be null."); for (skin in skins) - if (skin.name == skinName) return skin; + if (skin.name == skinName) + return skin; return null; } @@ -175,9 +182,11 @@ class SkeletonData { * @param eventName The name of the event to find. * @return May be null. */ public function findEvent(eventName:String):EventData { - if (eventName == null) throw new SpineException("eventName cannot be null."); + if (eventName == null) + throw new SpineException("eventName cannot be null."); for (eventData in events) - if (eventData.name == eventName) return eventData; + if (eventData.name == eventName) + return eventData; return null; } @@ -188,17 +197,21 @@ class SkeletonData { * @param animationName The name of the animation to find. * @return May be null. */ public function findAnimation(animationName:String):Animation { - if (animationName == null) throw new SpineException("animationName cannot be null."); + if (animationName == null) + throw new SpineException("animationName cannot be null."); for (animation in animations) - if (animation.name == animationName) return animation; + if (animation.name == animationName) + return animation; return null; } // --- Constraints. public function findConstraint>(constraintName:String, type:Class):T { - if (constraintName == null) throw new SpineException("constraintName cannot be null."); - if (type == null) throw new SpineException("type cannot be null."); + if (constraintName == null) + throw new SpineException("constraintName cannot be null."); + if (type == null) + throw new SpineException("type cannot be null."); for (constraint in constraints) { if (Std.isOfType(constraint, type) && constraint.name == constraintName) diff --git a/spine-haxe/spine-haxe/spine/SkeletonJson.hx b/spine-haxe/spine-haxe/spine/SkeletonJson.hx index 2bbe0f2e6..81a219c84 100644 --- a/spine-haxe/spine-haxe/spine/SkeletonJson.hx +++ b/spine-haxe/spine-haxe/spine/SkeletonJson.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -140,7 +140,8 @@ class SkeletonJson { data.skinRequired = Reflect.hasField(boneMap, "skin") ? cast(Reflect.getProperty(boneMap, "skin"), Bool) : false; var color:String = Reflect.getProperty(boneMap, "color"); - if (color != null) data.color.setFromString(color); + if (color != null) + data.color.setFromString(color); skeletonData.bones.push(data); } @@ -150,15 +151,18 @@ class SkeletonJson { var slotName:String = Reflect.getProperty(slotMap, "name"); var boneName:String = Reflect.getProperty(slotMap, "bone"); var boneData = skeletonData.findBone(boneName); - if (boneData == null) throw new SpineException("Slot bone not found: " + boneName); + if (boneData == null) + throw new SpineException("Slot bone not found: " + boneName); var data = new SlotData(skeletonData.slots.length, slotName, boneData); var color:String = Reflect.getProperty(slotMap, "color"); - if (color != null) data.setup.color.setFromString(color); + if (color != null) + data.setup.color.setFromString(color); var dark:String = Reflect.getProperty(slotMap, "dark"); - if (dark != null) data.setup.darkColor = new Color(0, 0, 0).setFromString(dark); + if (dark != null) + data.setup.darkColor = new Color(0, 0, 0).setFromString(dark); data.attachmentName = Reflect.getProperty(slotMap, "attachment"); data.blendMode = Reflect.hasField(slotMap, "blend") ? BlendMode.fromName(Reflect.getProperty(slotMap, "blend")) : BlendMode.normal; @@ -179,20 +183,26 @@ class SkeletonJson { for (boneName in cast(Reflect.getProperty(constraintMap, "bones"), Array)) { var bone = skeletonData.findBone(boneName); - if (bone == null) throw new SpineException("IK constraint bone not found: " + boneName); + if (bone == null) + throw new SpineException("IK constraint bone not found: " + boneName); data.bones.push(bone); } data.target = skeletonData.findBone(Reflect.getProperty(constraintMap, "target")); - if (data.target == null) throw new SpineException("Target bone not found: " + Reflect.getProperty(constraintMap, "target")); + if (data.target == null) + throw new SpineException("Target bone not found: " + Reflect.getProperty(constraintMap, "target")); - data.uniform = (Reflect.hasField(constraintMap, "uniform") && cast(Reflect.getProperty(constraintMap, "uniform"), Bool)); + data.uniform = (Reflect.hasField(constraintMap, "uniform") + && cast(Reflect.getProperty(constraintMap, "uniform"), Bool)); var setup = data.setup; setup.mix = getFloat(constraintMap, "mix", 1); setup.softness = getFloat(constraintMap, "softness", 0) * scale; - setup.bendDirection = (!Reflect.hasField(constraintMap, "bendPositive") || cast(Reflect.getProperty(constraintMap, "bendPositive"), Bool)) ? 1 : -1; - setup.compress = (Reflect.hasField(constraintMap, "compress") && cast(Reflect.getProperty(constraintMap, "compress"), Bool)); - setup.stretch = (Reflect.hasField(constraintMap, "stretch") && cast(Reflect.getProperty(constraintMap, "stretch"), Bool)); + setup.bendDirection = (!Reflect.hasField(constraintMap, "bendPositive") + || cast(Reflect.getProperty(constraintMap, "bendPositive"), Bool)) ? 1 : -1; + setup.compress = (Reflect.hasField(constraintMap, "compress") + && cast(Reflect.getProperty(constraintMap, "compress"), Bool)); + setup.stretch = (Reflect.hasField(constraintMap, "stretch") + && cast(Reflect.getProperty(constraintMap, "stretch"), Bool)); skeletonData.constraints.push(data); case "transform": @@ -201,15 +211,19 @@ class SkeletonJson { for (boneName in cast(Reflect.getProperty(constraintMap, "bones"), Array)) { var bone = skeletonData.findBone(boneName); - if (bone == null) throw new SpineException("Transform constraint bone not found: " + boneName); + if (bone == null) + throw new SpineException("Transform constraint bone not found: " + boneName); data.bones.push(bone); } data.source = skeletonData.findBone(Reflect.getProperty(constraintMap, "source")); - if (data.source == null) throw new SpineException("Transform constraint source bone not found: " + Reflect.getProperty(constraintMap, "source")); + if (data.source == null) + throw new SpineException("Transform constraint source bone not found: " + Reflect.getProperty(constraintMap, "source")); - data.localSource = Reflect.hasField(constraintMap, "localSource") ? cast(Reflect.getProperty(constraintMap, "localSource"), Bool) : false; - data.localTarget = Reflect.hasField(constraintMap, "localTarget") ? cast(Reflect.getProperty(constraintMap, "localTarget"), Bool) : false; + data.localSource = Reflect.hasField(constraintMap, + "localSource") ? cast(Reflect.getProperty(constraintMap, "localSource"), Bool) : false; + data.localTarget = Reflect.hasField(constraintMap, + "localTarget") ? cast(Reflect.getProperty(constraintMap, "localTarget"), Bool) : false; data.additive = Reflect.hasField(constraintMap, "additive") ? cast(Reflect.getProperty(constraintMap, "additive"), Bool) : false; data.clamp = Reflect.hasField(constraintMap, "clamp") ? cast(Reflect.getProperty(constraintMap, "clamp"), Bool) : false; @@ -227,31 +241,31 @@ class SkeletonJson { var to:ToProperty; switch (name) { case "rotate": { - rotate = true; - to = new ToRotate(); - } + rotate = true; + to = new ToRotate(); + } case "x": { - x = true; - to = new ToX(); - toScale = scale; - } + x = true; + to = new ToX(); + toScale = scale; + } case "y": { - y = true; - to = new ToY(); - toScale = scale; - } + y = true; + to = new ToY(); + toScale = scale; + } case "scaleX": { - scaleX = true; - to = new ToScaleX(); - } + scaleX = true; + to = new ToScaleX(); + } case "scaleY": { - scaleY = true; - to = new ToScaleY(); - } + scaleY = true; + to = new ToScaleY(); + } case "shearY": { - shearY = true; - to = new ToShearY(); - } + shearY = true; + to = new ToShearY(); + } default: throw new SpineException("Invalid transform constraint to property: " + toEntry.name); } to.offset = getFloat(toEntry, "offset", 0) * toScale; @@ -259,7 +273,8 @@ class SkeletonJson { to.scale = getFloat(toEntry, "scale") * toScale / fromScale; from.to.push(to); } - if (from.to.length > 0) data.properties.push(from); + if (from.to.length > 0) + data.properties.push(from); } data.offsets[TransformConstraintData.ROTATION] = getFloat(constraintMap, "rotation", 0); @@ -270,12 +285,18 @@ class SkeletonJson { data.offsets[TransformConstraintData.SHEARY] = getFloat(constraintMap, "shearY", 0); var setup = data.setup; - if (rotate) setup.mixRotate = getFloat(constraintMap, "mixRotate", 1); - if (x) setup.mixX = getFloat(constraintMap, "mixX", 1); - if (y) setup.mixY = getFloat(constraintMap, "mixY", setup.mixX); - if (scaleX) setup.mixScaleX = getFloat(constraintMap, "mixScaleX", 1); - if (scaleY) setup.mixScaleY = getFloat(constraintMap, "mixScaleY", setup.mixScaleX); - if (shearY) setup.mixShearY = getFloat(constraintMap, "mixShearY", 1); + if (rotate) + setup.mixRotate = getFloat(constraintMap, "mixRotate", 1); + if (x) + setup.mixX = getFloat(constraintMap, "mixX", 1); + if (y) + setup.mixY = getFloat(constraintMap, "mixY", setup.mixX); + if (scaleX) + setup.mixScaleX = getFloat(constraintMap, "mixScaleX", 1); + if (scaleY) + setup.mixScaleY = getFloat(constraintMap, "mixScaleY", setup.mixScaleX); + if (shearY) + setup.mixShearY = getFloat(constraintMap, "mixShearY", 1); skeletonData.constraints.push(data); case "path": @@ -284,23 +305,30 @@ class SkeletonJson { for (boneName in cast(Reflect.getProperty(constraintMap, "bones"), Array)) { var bone = skeletonData.findBone(boneName); - if (bone == null) throw new SpineException("Path bone not found: " + boneName); + if (bone == null) + throw new SpineException("Path bone not found: " + boneName); data.bones.push(bone); } var slotName = getString(constraintMap, "slot", ""); data.slot = skeletonData.findSlot(slotName); - if (data.slot == null) throw new SpineException("Path slot not found: " + slotName); + if (data.slot == null) + throw new SpineException("Path slot not found: " + slotName); - data.positionMode = Reflect.hasField(constraintMap, "positionMode") ? PositionMode.fromName(Reflect.getProperty(constraintMap, "positionMode")) : PositionMode.percent; - data.spacingMode = Reflect.hasField(constraintMap, "spacingMode") ? SpacingMode.fromName(Reflect.getProperty(constraintMap, "spacingMode")) : SpacingMode.length; - data.rotateMode = Reflect.hasField(constraintMap, "rotateMode") ? RotateMode.fromName(Reflect.getProperty(constraintMap, "rotateMode")) : RotateMode.tangent; + data.positionMode = Reflect.hasField(constraintMap, + "positionMode") ? PositionMode.fromName(Reflect.getProperty(constraintMap, "positionMode")) : PositionMode.percent; + data.spacingMode = Reflect.hasField(constraintMap, + "spacingMode") ? SpacingMode.fromName(Reflect.getProperty(constraintMap, "spacingMode")) : SpacingMode.length; + data.rotateMode = Reflect.hasField(constraintMap, + "rotateMode") ? RotateMode.fromName(Reflect.getProperty(constraintMap, "rotateMode")) : RotateMode.tangent; data.offsetRotation = getFloat(constraintMap, "rotation", 0); var setup = data.setup; setup.position = getFloat(constraintMap, "position", 0); - if (data.positionMode == PositionMode.fixed) setup.position *= scale; + if (data.positionMode == PositionMode.fixed) + setup.position *= scale; setup.spacing = getFloat(constraintMap, "spacing", 0); - if (data.spacingMode == SpacingMode.length || data.spacingMode == SpacingMode.fixed) setup.spacing *= scale; + if (data.spacingMode == SpacingMode.length || data.spacingMode == SpacingMode.fixed) + setup.spacing *= scale; setup.mixRotate = getFloat(constraintMap, "mixRotate", 1); setup.mixX = getFloat(constraintMap, "mixX", 1); setup.mixY = getFloat(constraintMap, "mixY", setup.mixX); @@ -312,7 +340,8 @@ class SkeletonJson { var boneName:String = getString(constraintMap, "bone"); data.bone = skeletonData.findBone(boneName); - if (data.bone == null) throw new SpineException("Physics bone not found: " + boneName); + if (data.bone == null) + throw new SpineException("Physics bone not found: " + boneName); data.x = getFloat(constraintMap, "x"); data.y = getFloat(constraintMap, "y"); @@ -329,12 +358,17 @@ class SkeletonJson { setup.wind = getFloat(constraintMap, "wind", 0); setup.gravity = getFloat(constraintMap, "gravity", 0); setup.mix = getValue(constraintMap, "mix", 1); - data.inertiaGlobal = Reflect.hasField(constraintMap, "inertiaGlobal") ? cast(Reflect.getProperty(constraintMap, "inertiaGlobal"), Bool) : false; - data.strengthGlobal = Reflect.hasField(constraintMap, "strengthGlobal") ? cast(Reflect.getProperty(constraintMap, "strengthGlobal"), Bool) : false; - data.dampingGlobal = Reflect.hasField(constraintMap, "dampingGlobal") ? cast(Reflect.getProperty(constraintMap, "dampingGlobal"), Bool) : false; - data.dampingGlobal = Reflect.hasField(constraintMap, "dampingGlobal") ? cast(Reflect.getProperty(constraintMap, "dampingGlobal"), Bool) : false; + data.inertiaGlobal = Reflect.hasField(constraintMap, + "inertiaGlobal") ? cast(Reflect.getProperty(constraintMap, "inertiaGlobal"), Bool) : false; + data.strengthGlobal = Reflect.hasField(constraintMap, + "strengthGlobal") ? cast(Reflect.getProperty(constraintMap, "strengthGlobal"), Bool) : false; + data.dampingGlobal = Reflect.hasField(constraintMap, + "dampingGlobal") ? cast(Reflect.getProperty(constraintMap, "dampingGlobal"), Bool) : false; + data.dampingGlobal = Reflect.hasField(constraintMap, + "dampingGlobal") ? cast(Reflect.getProperty(constraintMap, "dampingGlobal"), Bool) : false; data.windGlobal = Reflect.hasField(constraintMap, "windGlobal") ? cast(Reflect.getProperty(constraintMap, "windGlobal"), Bool) : false; - data.gravityGlobal = Reflect.hasField(constraintMap, "gravityGlobal") ? cast(Reflect.getProperty(constraintMap, "gravityGlobal"), Bool) : false; + data.gravityGlobal = Reflect.hasField(constraintMap, + "gravityGlobal") ? cast(Reflect.getProperty(constraintMap, "gravityGlobal"), Bool) : false; data.mixGlobal = Reflect.hasField(constraintMap, "mixGlobal") ? cast(Reflect.getProperty(constraintMap, "mixGlobal"), Bool) : false; skeletonData.constraints.push(data); @@ -349,7 +383,8 @@ class SkeletonJson { var boneName = getString(constraintMap, "bone", null); if (boneName != null) { data.bone = skeletonData.findBone(boneName); - if (data.bone == null) throw new SpineException("Slider bone not found: " + boneName); + if (data.bone == null) + throw new SpineException("Slider bone not found: " + boneName); var property = getString(constraintMap, "property"); data.property = fromProperty(property); var propertyScale = propertyScale(property, scale); @@ -364,7 +399,6 @@ class SkeletonJson { } } - // Skins. if (Reflect.hasField(root, "skins")) { for (skinMap in cast(Reflect.getProperty(root, "skins"), Array)) { @@ -424,7 +458,8 @@ class SkeletonJson { var slider = cast(Reflect.getProperty(skinMap, "slider"), Array); for (ii in 0...slider.length) { var constraint = skeletonData.findConstraint(slider[ii], SliderData); - if (constraint == null) throw new SpineException("Skin slider constraint not found: " + slider[ii]); + if (constraint == null) + throw new SpineException("Skin slider constraint not found: " + slider[ii]); skin.constraints.push(constraint); } } @@ -495,7 +530,8 @@ class SkeletonJson { var data = skeletonData.findConstraint(getString(constraintMap, "name"), SliderData); var animationName = getString(constraintMap, "animation", ""); data.animation = skeletonData.findAnimation(animationName); - if (data.animation == null) throw new SpineException("Slider animation not found: " + animationName); + if (data.animation == null) + throw new SpineException("Slider animation not found: " + animationName); } } } @@ -503,25 +539,34 @@ class SkeletonJson { return skeletonData; } - private function fromProperty (type:String): FromProperty { + private function fromProperty(type:String):FromProperty { var property:FromProperty; switch (type) { - case "rotate": property = new FromRotate(); - case "x": property = new FromX(); - case "y": property = new FromY(); - case "scaleX": property = new FromScaleX(); - case "scaleY": property = new FromScaleY(); - case "shearY": property = new FromShearY(); - default: throw new SpineException("Invalid from property: " + type); + case "rotate": + property = new FromRotate(); + case "x": + property = new FromX(); + case "y": + property = new FromY(); + case "scaleX": + property = new FromScaleX(); + case "scaleY": + property = new FromScaleY(); + case "shearY": + property = new FromShearY(); + default: + throw new SpineException("Invalid from property: " + type); }; return property; } - private function propertyScale (type:String, scale:Float):Float { + private function propertyScale(type:String, scale:Float):Float { var scaleValue:Float; switch (type) { - case "x", "y": scaleValue = scale; - default: scaleValue = 1; + case "x", "y": + scaleValue = scale; + default: + scaleValue = 1; }; return scaleValue; } @@ -709,7 +754,8 @@ class SkeletonJson { slotIndex = skeletonData.findSlot(slotName).index; for (timelineName in Reflect.fields(slotMap)) { timelineMap = Reflect.field(slotMap, timelineName); - if (timelineMap == null) continue; + if (timelineMap == null) + continue; switch (timelineName) { case "attachment": @@ -782,7 +828,8 @@ class SkeletonJson { } timelines.push(rgbTimeline); - case "alpha": readTimeline(timelines, timelineMap, new AlphaTimeline(timelineMap.length, timelineMap.length, slotIndex), 0, 1); + case "alpha": + readTimeline(timelines, timelineMap, new AlphaTimeline(timelineMap.length, timelineMap.length, slotIndex), 0, 1); case "rgba2": var rgba2Timeline = new RGBA2Timeline(timelineMap.length, timelineMap.length * 7, slotIndex); @@ -862,7 +909,8 @@ class SkeletonJson { } timelines.push(rgb2Timeline); - default: throw new SpineException("Invalid timeline type for a slot: " + timelineName + " (" + slotName + ")"); + default: + throw new SpineException("Invalid timeline type for a slot: " + timelineName + " (" + slotName + ")"); } } } @@ -871,24 +919,36 @@ class SkeletonJson { var bones = Reflect.getProperty(map, "bones"); for (boneName in Reflect.fields(bones)) { var boneIndex:Int = skeletonData.findBoneIndex(boneName); - if (boneIndex == -1) throw new SpineException("Bone not found: " + boneName); + if (boneIndex == -1) + throw new SpineException("Bone not found: " + boneName); var boneMap:Dynamic = Reflect.field(bones, boneName); for (timelineName in Reflect.fields(boneMap)) { timelineMap = Reflect.field(boneMap, timelineName); var frames = timelineMap.length; - if (frames == 0) continue; + if (frames == 0) + continue; switch (timelineName) { - case "rotate": readTimeline(timelines, timelineMap, new RotateTimeline(frames, frames, boneIndex), 0, 1); - case "translate": readTimeline2(timelines, timelineMap, new TranslateTimeline(frames, frames << 1, boneIndex), "x", "y", 0, scale); - case "translatex": readTimeline(timelines, timelineMap, new TranslateXTimeline(frames, frames, boneIndex), 0, scale); - case "translatey": readTimeline(timelines, timelineMap, new TranslateYTimeline(frames, frames, boneIndex), 0, scale); - case "scale": readTimeline2(timelines, timelineMap, new ScaleTimeline(frames, frames << 1, boneIndex), "x", "y", 1, 1); - case "scalex": readTimeline(timelines, timelineMap, new ScaleXTimeline(frames, frames, boneIndex), 1, 1); - case "scaley": readTimeline(timelines, timelineMap, new ScaleYTimeline(frames, frames, boneIndex), 1, 1); - case "shear": readTimeline2(timelines, timelineMap, new ShearTimeline(frames, frames << 1, boneIndex), "x", "y", 0, 1); - case "shearx": readTimeline(timelines, timelineMap, new ShearXTimeline(frames, frames, boneIndex), 0, 1); - case "sheary": readTimeline(timelines, timelineMap, new ShearYTimeline(frames, frames, boneIndex), 0, 1); + case "rotate": + readTimeline(timelines, timelineMap, new RotateTimeline(frames, frames, boneIndex), 0, 1); + case "translate": + readTimeline2(timelines, timelineMap, new TranslateTimeline(frames, frames << 1, boneIndex), "x", "y", 0, scale); + case "translatex": + readTimeline(timelines, timelineMap, new TranslateXTimeline(frames, frames, boneIndex), 0, scale); + case "translatey": + readTimeline(timelines, timelineMap, new TranslateYTimeline(frames, frames, boneIndex), 0, scale); + case "scale": + readTimeline2(timelines, timelineMap, new ScaleTimeline(frames, frames << 1, boneIndex), "x", "y", 1, 1); + case "scalex": + readTimeline(timelines, timelineMap, new ScaleXTimeline(frames, frames, boneIndex), 1, 1); + case "scaley": + readTimeline(timelines, timelineMap, new ScaleYTimeline(frames, frames, boneIndex), 1, 1); + case "shear": + readTimeline2(timelines, timelineMap, new ShearTimeline(frames, frames << 1, boneIndex), "x", "y", 0, 1); + case "shearx": + readTimeline(timelines, timelineMap, new ShearXTimeline(frames, frames, boneIndex), 0, 1); + case "sheary": + readTimeline(timelines, timelineMap, new ShearYTimeline(frames, frames, boneIndex), 0, 1); case "inherit": var timeline = new InheritTimeline(frames, boneIndex); for (frame in 0...frames) { @@ -896,7 +956,8 @@ class SkeletonJson { timeline.setFrame(frame, getFloat(aFrame, "time"), Inherit.fromName(getValue(aFrame, "inherit", "Normal"))); } timelines.push(timeline); - default: throw new SpineException("Invalid timeline type for a bone: " + timelineName + " (" + boneName + ")"); + default: + throw new SpineException("Invalid timeline type for a bone: " + timelineName + " (" + boneName + ")"); } } } @@ -906,12 +967,13 @@ class SkeletonJson { for (ikConstraintName in Reflect.fields(iks)) { timelineMap = Reflect.field(iks, ikConstraintName); keyMap = timelineMap[0]; - if (keyMap == null) continue; + if (keyMap == null) + continue; var constraint = skeletonData.findConstraint(ikConstraintName, IkConstraintData); - if (constraint == null) throw new SpineException("IK constraint not found: " + ikConstraintName); - var timeline = new IkConstraintTimeline(timelineMap.length, timelineMap.length << 1, - skeletonData.constraints.indexOf(constraint)); + if (constraint == null) + throw new SpineException("IK constraint not found: " + ikConstraintName); + var timeline = new IkConstraintTimeline(timelineMap.length, timelineMap.length << 1, skeletonData.constraints.indexOf(constraint)); time = getFloat(keyMap, "time"); var mix:Float = getFloat(keyMap, "mix", 1); @@ -955,15 +1017,18 @@ class SkeletonJson { for (transformName in Reflect.fields(transforms)) { timelineMap = Reflect.field(transforms, transformName); keyMap = timelineMap[0]; - if (keyMap == null) continue; + if (keyMap == null) + continue; var constraint = skeletonData.findConstraint(transformName, TransformConstraintData); - if (constraint == null) throw new SpineException("Transform constraint not found: " + transformName); - var timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, - skeletonData.constraints.indexOf(constraint)); + if (constraint == null) + throw new SpineException("Transform constraint not found: " + transformName); + var timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, skeletonData.constraints.indexOf(constraint)); var time = getFloat(keyMap, "time", 0); var mixRotate = getFloat(keyMap, "mixRotate", 1); - var mixX = getFloat(keyMap, "mixX", 1), mixY = getFloat(keyMap, "mixY", mixX); - var mixScaleX:Float = getFloat(keyMap, "mixScaleX", 1), mixScaleY:Float = getFloat(keyMap, "mixScaleY", 1); + var mixX = getFloat(keyMap, "mixX", 1), + mixY = getFloat(keyMap, "mixY", mixX); + var mixScaleX:Float = getFloat(keyMap, "mixScaleX", 1), + mixScaleY:Float = getFloat(keyMap, "mixScaleY", 1); var mixShearY:Float = getFloat(keyMap, "mixShearY", 1); frame = 0; @@ -978,8 +1043,10 @@ class SkeletonJson { var time2 = getFloat(nextMap, "time", 0); var mixRotate2 = getFloat(nextMap, "mixRotate", 1); - var mixX2 = getFloat(nextMap, "mixX", 1), mixY2 = getFloat(nextMap, "mixY", mixX2); - var mixScaleX2:Float = getFloat(nextMap, "mixScaleX", 1), mixScaleY2:Float = getFloat(nextMap, "mixScaleY", 1); + var mixX2 = getFloat(nextMap, "mixX", 1), + mixY2 = getFloat(nextMap, "mixY", mixX2); + var mixScaleX2:Float = getFloat(nextMap, "mixScaleX", 1), + mixScaleY2:Float = getFloat(nextMap, "mixScaleY", 1); var mixShearY2:Float = getFloat(nextMap, "mixShearY", 1); var curve = keyMap.curve; if (curve != null) { @@ -1009,14 +1076,16 @@ class SkeletonJson { var paths:Dynamic = Reflect.getProperty(map, "path"); for (pathName in Reflect.fields(paths)) { var constraint = skeletonData.findConstraint(pathName, PathConstraintData); - if (constraint == null) throw new SpineException("Path constraint not found: " + pathName); + if (constraint == null) + throw new SpineException("Path constraint not found: " + pathName); var index = skeletonData.constraints.indexOf(constraint); var pathMap:Dynamic = Reflect.field(paths, pathName); for (timelineName in Reflect.fields(pathMap)) { timelineMap = Reflect.field(pathMap, timelineName); keyMap = timelineMap[0]; - if (keyMap == null) continue; + if (keyMap == null) + continue; switch (timelineName) { case "position": @@ -1024,8 +1093,8 @@ class SkeletonJson { readTimeline(timelines, timelineMap, timeline, 0, constraint.positionMode == PositionMode.fixed ? scale : 1); case "spacing": var timeline = new PathConstraintSpacingTimeline(timelineMap.length, timelineMap.length, index); - readTimeline(timelines, timelineMap, timeline, 0, - constraint.spacingMode == SpacingMode.length || constraint.spacingMode == SpacingMode.fixed ? scale : 1); + readTimeline(timelines, timelineMap, timeline, + 0, constraint.spacingMode == SpacingMode.length || constraint.spacingMode == SpacingMode.fixed ? scale : 1); case "mix": var timeline = new PathConstraintMixTimeline(timelineMap.length, timelineMap.length * 3, index); var time = getFloat(keyMap, "time"); @@ -1072,18 +1141,20 @@ class SkeletonJson { var index = -1; if (physicsName.length > 0) { var constraint = skeletonData.findConstraint(physicsName, PhysicsConstraintData); - if (constraint == null) throw new SpineException("Physics constraint not found: " + physicsName); + if (constraint == null) + throw new SpineException("Physics constraint not found: " + physicsName); index = skeletonData.constraints.indexOf(constraint); } var physicsMap:Dynamic = Reflect.field(physics, physicsName); for (timelineName in Reflect.fields(physicsMap)) { timelineMap = Reflect.field(physicsMap, timelineName); keyMap = timelineMap[0]; - if (keyMap == null) continue; + if (keyMap == null) + continue; var frames = timelineMap.length; - var timeline: CurveTimeline1; + var timeline:CurveTimeline1; var defaultValue = 0.; switch (timelineName) { case "reset": @@ -1092,17 +1163,25 @@ class SkeletonJson { resetTimeline.setFrame(frame, getFloat(keyMap, "time")); timelines.push(resetTimeline); continue; - case "inertia": timeline = new PhysicsConstraintInertiaTimeline(frames, frames, index); - case "strength": timeline = new PhysicsConstraintStrengthTimeline(frames, frames, index); - case "damping": timeline = new PhysicsConstraintDampingTimeline(frames, frames, index); - case "mass": timeline = new PhysicsConstraintMassTimeline(frames, frames, index); - case "wind": timeline = new PhysicsConstraintWindTimeline(frames, frames, index); - case "gravity": timeline = new PhysicsConstraintGravityTimeline(frames, frames, index); - case "mix": { - defaultValue = 1; - timeline = new PhysicsConstraintMixTimeline(frames, frames, index); - } - default: continue; + case "inertia": + timeline = new PhysicsConstraintInertiaTimeline(frames, frames, index); + case "strength": + timeline = new PhysicsConstraintStrengthTimeline(frames, frames, index); + case "damping": + timeline = new PhysicsConstraintDampingTimeline(frames, frames, index); + case "mass": + timeline = new PhysicsConstraintMassTimeline(frames, frames, index); + case "wind": + timeline = new PhysicsConstraintWindTimeline(frames, frames, index); + case "gravity": + timeline = new PhysicsConstraintGravityTimeline(frames, frames, index); + case "mix": + { + defaultValue = 1; + timeline = new PhysicsConstraintMixTimeline(frames, frames, index); + } + default: + continue; } readTimeline(timelines, timelineMap, timeline, defaultValue, 1); } @@ -1112,18 +1191,22 @@ class SkeletonJson { var sliders:Dynamic = Reflect.getProperty(map, "slider"); for (sliderName in Reflect.fields(sliders)) { var constraint = skeletonData.findConstraint(sliderName, SliderData); - if (constraint == null) throw new SpineException("Slider not found: " + sliderName); + if (constraint == null) + throw new SpineException("Slider not found: " + sliderName); var index = skeletonData.constraints.indexOf(constraint); var timelineMap:Dynamic = Reflect.field(sliders, sliderName); for (timelineName in Reflect.fields(timelineMap)) { timelineMap = Reflect.field(timelineMap, timelineName); keyMap = timelineMap[0]; - if (keyMap == null) continue; + if (keyMap == null) + continue; var frames = timelineMap.length; switch (timelineName) { - case "time": readTimeline(timelines, keyMap, new SliderTimeline(frames, frames, index), 1, 1); - case "mix": readTimeline(timelines, keyMap, new SliderMixTimeline(frames, frames, index), 1, 1); + case "time": + readTimeline(timelines, keyMap, new SliderTimeline(frames, frames, index), 1, 1); + case "mix": + readTimeline(timelines, keyMap, new SliderMixTimeline(frames, frames, index), 1, 1); } } } @@ -1344,8 +1427,8 @@ class SkeletonJson { } } - static private function readTimeline2(timelines:Array, keys:Array, timeline:BoneTimeline2, name1:String, name2:String, defaultValue:Float, - scale:Float) { + static private function readTimeline2(timelines:Array, keys:Array, timeline:BoneTimeline2, name1:String, name2:String, + defaultValue:Float, scale:Float) { var keyMap:Dynamic = keys[0]; var time:Float = getFloat(keyMap, "time"); var value1:Float = getFloat(keyMap, name1, defaultValue) * scale; diff --git a/spine-haxe/spine-haxe/spine/Skin.hx b/spine-haxe/spine-haxe/spine/Skin.hx index 48585fc3f..852351bd0 100644 --- a/spine-haxe/spine-haxe/spine/Skin.hx +++ b/spine-haxe/spine-haxe/spine/Skin.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -51,13 +51,15 @@ class Skin { public final color:Color = new Color(0.99607843, 0.61960787, 0.30980393, 1); // fe9e4fff public function new(name:String) { - if (name == null) throw new SpineException("name cannot be null."); + if (name == null) + throw new SpineException("name cannot be null."); this.name = name; } /** Adds an attachment to the skin for the specified slot index and name. */ public function setAttachment(slotIndex:Int, name:String, attachment:Attachment):Void { - if (attachment == null) throw new SpineException("attachment cannot be null."); + if (attachment == null) + throw new SpineException("attachment cannot be null."); if (slotIndex >= attachments.length) attachments.resize(slotIndex + 1); if (attachments[slotIndex] == null) @@ -218,7 +220,8 @@ class Skin { var skinAttachment:Attachment = dictionary.get(name); if (slotAttachment == skinAttachment) { var attachment:Attachment = getAttachment(slotIndex, name); - if (attachment != null) slot.attachment = attachment; + if (attachment != null) + slot.attachment = attachment; break; } } diff --git a/spine-haxe/spine-haxe/spine/SkinEntry.hx b/spine-haxe/spine-haxe/spine/SkinEntry.hx index e32083104..c390ef853 100644 --- a/spine-haxe/spine-haxe/spine/SkinEntry.hx +++ b/spine-haxe/spine-haxe/spine/SkinEntry.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -34,8 +34,10 @@ import spine.attachments.Attachment; /** Stores an entry in the skin consisting of the slot index and the attachment name. */ class SkinEntry { public var slotIndex:Int = 0; + /** The name the attachment is associated with, equivalent to the skin placeholder name in the Spine editor. */ public var name:String; + public var attachment:Attachment; public function new(slotIndex:Int, name:String, attachment:Attachment) { diff --git a/spine-haxe/spine-haxe/spine/Slider.hx b/spine-haxe/spine-haxe/spine/Slider.hx index 0c98901e8..1fdd39074 100644 --- a/spine-haxe/spine-haxe/spine/Slider.hx +++ b/spine-haxe/spine-haxe/spine/Slider.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -36,36 +36,40 @@ import spine.animation.MixDirection; import spine.animation.MixBlend; /** Stores the setup pose for a {@link PhysicsConstraint}. -*

-* See Physics constraints in the Spine User Guide. */ + *

+ * See Physics constraints in the Spine User Guide. */ class Slider extends Constraint { static private final offsets:Array = [for (i in 0...6) .0]; public var bone:Bone; - public function new (data:SliderData, skeleton:Skeleton) { + public function new(data:SliderData, skeleton:Skeleton) { super(data, new SliderPose(), new SliderPose()); - if (skeleton == null) throw new SpineException("skeleton cannot be null."); + if (skeleton == null) + throw new SpineException("skeleton cannot be null."); - if (data.bone != null) bone = skeleton.bones[data.bone.index]; + if (data.bone != null) + bone = skeleton.bones[data.bone.index]; } - public function copy (skeleton:Skeleton) { + public function copy(skeleton:Skeleton) { var copy = new Slider(data, skeleton); copy.pose.set(pose); return copy; } - public function update (skeleton:Skeleton, physics:Physics) { + public function update(skeleton:Skeleton, physics:Physics) { var p = applied; - if (p.mix == 0) return; + if (p.mix == 0) + return; var animation = data.animation; if (bone != null) { - if (!bone.active) return; - if (data.local) bone.applied.validateLocalTransform(skeleton); - p.time = data.offset - + (data.property.value(skeleton, bone.applied, data.local, offsets) - data.property.offset) * data.scale; + if (!bone.active) + return; + if (data.local) + bone.applied.validateLocalTransform(skeleton); + p.time = data.offset + (data.property.value(skeleton, bone.applied, data.local, offsets) - data.property.offset) * data.scale; if (data.loop) p.time = animation.duration + (p.time % animation.duration); else @@ -78,12 +82,12 @@ class Slider extends Constraint { while (i < n) bones[indices[i++]].applied.modifyLocal(skeleton); - animation.apply(skeleton, p.time, p.time, data.loop, null, p.mix, data.additive ? MixBlend.add : MixBlend.replace, - MixDirection.mixIn, true); + animation.apply(skeleton, p.time, p.time, data.loop, null, p.mix, data.additive ? MixBlend.add : MixBlend.replace, MixDirection.mixIn, true); } - function sort (skeleton:Skeleton) { - if (bone != null && !data.local) skeleton.sortBone(bone); + function sort(skeleton:Skeleton) { + if (bone != null && !data.local) + skeleton.sortBone(bone); skeleton._updateCache.push(this); var bones = skeleton.bones; diff --git a/spine-haxe/spine-haxe/spine/SliderData.hx b/spine-haxe/spine-haxe/spine/SliderData.hx index cca4b7dce..5d3e5406c 100644 --- a/spine-haxe/spine-haxe/spine/SliderData.hx +++ b/spine-haxe/spine-haxe/spine/SliderData.hx @@ -1,5 +1,3 @@ - - /****************************************************************************** * Spine Runtimes License Agreement * Last updated April 5, 2025. Replaces all prior versions. @@ -27,16 +25,16 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ - package spine; +package spine; import spine.TransformConstraintData.FromProperty; import spine.animation.Animation; /** Stores the setup pose for a PhysicsConstraint. -* -* See Physics constraints in the Spine User Guide. */ + * + * See Physics constraints in the Spine User Guide. */ class SliderData extends ConstraintData { public var animation:Animation; public var additive = false; @@ -47,11 +45,11 @@ class SliderData extends ConstraintData { public var offset = 0.; public var local = false; - public function new (name:String) { + public function new(name:String) { super(name, new SliderPose()); } - public function create (skeleton:Skeleton) { + public function create(skeleton:Skeleton) { return new Slider(this, skeleton); } } diff --git a/spine-haxe/spine-haxe/spine/SliderPose.hx b/spine-haxe/spine-haxe/spine/SliderPose.hx index 1311823a4..210b8a569 100644 --- a/spine-haxe/spine-haxe/spine/SliderPose.hx +++ b/spine-haxe/spine-haxe/spine/SliderPose.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -34,11 +34,10 @@ class SliderPose implements Pose { public var time = 0.; public var mix = 0.; - public function new () { - } + public function new() {} - public function set (pose:SliderPose) { + public function set(pose:SliderPose) { time = pose.time; mix = pose.mix; } -} \ No newline at end of file +} diff --git a/spine-haxe/spine-haxe/spine/Slot.hx b/spine-haxe/spine-haxe/spine/Slot.hx index 38be3f925..bfe7c096e 100644 --- a/spine-haxe/spine-haxe/spine/Slot.hx +++ b/spine-haxe/spine-haxe/spine/Slot.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -36,17 +36,17 @@ import spine.attachments.VertexAttachment; * state for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared * across multiple skeletons. */ class Slot extends Posed { - public var skeleton:Skeleton; /** The bone this slot belongs to. */ public var bone:Bone; - public var attachmentState:Int ; + public var attachmentState:Int; public function new(data:SlotData, skeleton:Skeleton) { super(data, new SlotPose(), new SlotPose()); - if (skeleton == null) throw new SpineException("skeleton cannot be null."); + if (skeleton == null) + throw new SpineException("skeleton cannot be null."); this.skeleton = skeleton; bone = skeleton.bones[data.boneData.index]; if (data.setup.darkColor != null) { @@ -59,8 +59,10 @@ class Slot extends Posed { /** Copy method. */ public function copy(slot:Slot, bone:Bone, skeleton:Skeleton):Slot { var copy = new Slot(slot.data, skeleton); - if (bone == null) throw new SpineException("bone cannot be null."); - if (skeleton == null) throw new SpineException("skeleton cannot be null."); + if (bone == null) + throw new SpineException("bone cannot be null."); + if (skeleton == null) + throw new SpineException("skeleton cannot be null."); this.bone = bone; if (data.setup.darkColor != null) { pose.darkColor = new Color(1, 1, 1, 1); @@ -73,7 +75,8 @@ class Slot extends Posed { /** Sets this slot to the setup pose. */ override public function setupPose():Void { pose.color.setFromColor(data.setup.color); - if (pose.darkColor != null) pose.darkColor.setFromColor(data.setup.darkColor); + if (pose.darkColor != null) + pose.darkColor.setFromColor(data.setup.darkColor); pose.sequenceIndex = data.setup.sequenceIndex; if (data.attachmentName == null) { pose.attachment = null; diff --git a/spine-haxe/spine-haxe/spine/SlotData.hx b/spine-haxe/spine-haxe/spine/SlotData.hx index fab240ac8..2b5e701fc 100644 --- a/spine-haxe/spine-haxe/spine/SlotData.hx +++ b/spine-haxe/spine-haxe/spine/SlotData.hx @@ -25,13 +25,12 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; /** Stores the setup pose for a spine.Slot. */ class SlotData extends PosedData { - /** The index of the slot in spine.Skeleton.getSlots(). */ public final index:Int; @@ -45,13 +44,16 @@ class SlotData extends PosedData { public var blendMode:BlendMode = BlendMode.normal; // Nonessential. + /** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */ public var visible:Bool = true; public function new(index:Int, name:String, boneData:BoneData) { super(name, new SlotPose()); - if (index < 0) throw new SpineException("index must be >= 0."); - if (boneData == null) throw new SpineException("boneData cannot be null."); + if (index < 0) + throw new SpineException("index must be >= 0."); + if (boneData == null) + throw new SpineException("boneData cannot be null."); this.index = index; this.boneData = boneData; } diff --git a/spine-haxe/spine-haxe/spine/SlotPose.hx b/spine-haxe/spine-haxe/spine/SlotPose.hx index 86397df4b..59386e98c 100644 --- a/spine-haxe/spine-haxe/spine/SlotPose.hx +++ b/spine-haxe/spine-haxe/spine/SlotPose.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -33,49 +33,52 @@ import spine.attachments.Attachment; import spine.attachments.VertexAttachment; /** Stores a slot's pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store state -* for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared across -* multiple skeletons. */ + * for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared across + * multiple skeletons. */ class SlotPose implements Pose { - /** The color used to tint the slot's attachment. If SlotData.darkColor is set, this is used as the light color for two - * color tinting. */ + * color tinting. */ public final color:Color = new Color(1, 1, 1, 1); /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark - * color's alpha is not used. */ + * color's alpha is not used. */ public var darkColor:Color = null; public var attachment(default, set):Attachment; // Not used in setup pose. /** The index of the texture region to display when the slot's attachment has a spine.attachments.Sequence. -1 represents the - * Sequence.getSetupIndex(). */ + * Sequence.getSetupIndex(). */ public var sequenceIndex = -1; /** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a - * weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions. - * @see spine.attachments.VertexAttachment.computeWorldVertices() - * @see spine.animation.DeformTimeline */ + * weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions. + * @see spine.attachments.VertexAttachment.computeWorldVertices() + * @see spine.animation.DeformTimeline */ public var deform:Array = new Array(); - public function new () { - } + public function new() {} - public function set (pose:SlotPose):Void { - if (pose == null) throw new SpineException("pose cannot be null."); + public function set(pose:SlotPose):Void { + if (pose == null) + throw new SpineException("pose cannot be null."); color.setFromColor(pose.color); - if (darkColor != null) darkColor.setFromColor(pose.darkColor); + if (darkColor != null) + darkColor.setFromColor(pose.darkColor); attachment = pose.attachment; sequenceIndex = pose.sequenceIndex; deform.resize(0); - for (e in pose.deform) deform.push(e); + for (e in pose.deform) + deform.push(e); } /** Sets the slot's attachment and, if the attachment changed, resets sequenceIndex and clears the deform. - * The deform is not cleared if the old attachment has the same spine.attachments.VertexAttachment.timelineAttachment as the - * specified attachment. */ + * The deform is not cleared if the old attachment has the same spine.attachments.VertexAttachment.timelineAttachment as the + * specified attachment. */ public function set_attachment(attachmentNew:Attachment):Attachment { - if (attachment == attachmentNew) return attachment; - if (!Std.isOfType(attachmentNew, VertexAttachment) || !Std.isOfType(attachment, VertexAttachment) + if (attachment == attachmentNew) + return attachment; + if (!Std.isOfType(attachmentNew, VertexAttachment) + || !Std.isOfType(attachment, VertexAttachment) || cast(attachmentNew, VertexAttachment).timelineAttachment != cast(attachment, VertexAttachment).timelineAttachment) { deform = new Array(); } @@ -83,5 +86,4 @@ class SlotPose implements Pose { sequenceIndex = -1; return attachment; } - -} \ No newline at end of file +} diff --git a/spine-haxe/spine-haxe/spine/SpacingMode.hx b/spine-haxe/spine-haxe/spine/SpacingMode.hx index 0a0d6df02..58d892d4b 100644 --- a/spine-haxe/spine-haxe/spine/SpacingMode.hx +++ b/spine-haxe/spine-haxe/spine/SpacingMode.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/SpineException.hx b/spine-haxe/spine-haxe/spine/SpineException.hx index 1e4cacb92..d8db3e641 100644 --- a/spine-haxe/spine-haxe/spine/SpineException.hx +++ b/spine-haxe/spine-haxe/spine/SpineException.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/TextureRegion.hx b/spine-haxe/spine-haxe/spine/TextureRegion.hx index c5e377717..2a33e51d4 100644 --- a/spine-haxe/spine-haxe/spine/TextureRegion.hx +++ b/spine-haxe/spine-haxe/spine/TextureRegion.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/TransformConstraint.hx b/spine-haxe/spine-haxe/spine/TransformConstraint.hx index 3737c90ca..093e972fc 100644 --- a/spine-haxe/spine-haxe/spine/TransformConstraint.hx +++ b/spine-haxe/spine-haxe/spine/TransformConstraint.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; @@ -34,7 +34,6 @@ package spine; * * @see https://esotericsoftware.com/spine-transform-constraints Transform constraints in the Spine User Guide */ class TransformConstraint extends Constraint { - /** The bones that will be modified by this transform constraint. */ public final bones:Array; @@ -43,7 +42,8 @@ class TransformConstraint extends Constraint(); for (boneData in data.bones) @@ -60,12 +60,17 @@ class TransformConstraint extends Constraint(); /** Reads this property from the specified bone. */ - abstract public function value (skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float; + abstract public function value(skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float; } /** Constrained property for a TransformConstraint. */ abstract class ToProperty { - public function new () { - } + public function new() {} /** The value of this property that corresponds to FromProperty.offset. */ public var offset:Float; @@ -187,36 +191,43 @@ abstract class ToProperty { public var scale:Float; /** Reads the mix for this property from the specified pose. */ - abstract public function mix (pose:TransformConstraintPose):Float; + abstract public function mix(pose:TransformConstraintPose):Float; /** Applies the value to this property. */ - abstract public function apply (skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void; + abstract public function apply(skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void; } class FromRotate extends FromProperty { - public function value (skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float { - if (local) return source.rotation + offsets[TransformConstraintData.ROTATION]; + public function value(skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float { + if (local) + return source.rotation + offsets[TransformConstraintData.ROTATION]; var sx = skeleton.scaleX, sy = skeleton.scaleY; var value = Math.atan2(source.c / sy, source.a / sx) * MathUtils.radDeg - + ((source.a * source.d - source.b * source.c) * sx * sy > 0 ? offsets[TransformConstraintData.ROTATION] : -offsets[TransformConstraintData.ROTATION]); - if (value < 0) value += 360; + + ((source.a * source.d - source.b * source.c) * sx * sy > 0 ? offsets[TransformConstraintData.ROTATION] : + -offsets[TransformConstraintData.ROTATION]); + if (value < 0) + value += 360; return value; } } class ToRotate extends ToProperty { - public function mix (pose:TransformConstraintPose):Float { + public function mix(pose:TransformConstraintPose):Float { return pose.mixRotate; } - public function apply (skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void { + public function apply(skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void { if (local) bone.rotation += (additive ? value : value - bone.rotation) * pose.mixRotate; else { var sx = skeleton.scaleX, sy = skeleton.scaleY, ix = 1 / sx, iy = 1 / sy; - var a = bone.a * ix, b = bone.b * ix, c = bone.c * iy, d = bone.d * iy; + var a = bone.a * ix, + b = bone.b * ix, + c = bone.c * iy, + d = bone.d * iy; value *= MathUtils.degRad; - if (!additive) value -= Math.atan2(c, a); + if (!additive) + value -= Math.atan2(c, a); if (value > MathUtils.PI) value -= MathUtils.PI2; else if (value < -MathUtils.PI) // @@ -232,65 +243,66 @@ class ToRotate extends ToProperty { } class FromX extends FromProperty { - public function value (skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float { - return local - ? source.x + offsets[TransformConstraintData.X] - : (offsets[TransformConstraintData.X] * source.a + offsets[TransformConstraintData.Y] * source.b + source.worldX) / skeleton.scaleX; + public function value(skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float { + return local ? source.x + offsets[TransformConstraintData.X] : (offsets[TransformConstraintData.X] * source.a + + offsets[TransformConstraintData.Y] * source.b + source.worldX) / skeleton.scaleX; } } class ToX extends ToProperty { - public function mix (pose:TransformConstraintPose):Float { + public function mix(pose:TransformConstraintPose):Float { return pose.mixX; } - public function apply (skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void { + public function apply(skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void { if (local) bone.x += (additive ? value : value - bone.x) * pose.mixX; else { - if (!additive) value -= bone.worldX / skeleton.scaleX; + if (!additive) + value -= bone.worldX / skeleton.scaleX; bone.worldX += value * pose.mixX * skeleton.scaleX; } } } class FromY extends FromProperty { - public function value (skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float { - return local - ? source.y + offsets[TransformConstraintData.Y] - : (offsets[TransformConstraintData.X] * source.c + offsets[TransformConstraintData.Y] * source.d + source.worldY) / skeleton.scaleY; + public function value(skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float { + return local ? source.y + offsets[TransformConstraintData.Y] : (offsets[TransformConstraintData.X] * source.c + + offsets[TransformConstraintData.Y] * source.d + source.worldY) / skeleton.scaleY; } } class ToY extends ToProperty { - public function mix (pose:TransformConstraintPose):Float { + public function mix(pose:TransformConstraintPose):Float { return pose.mixY; } - public function apply (skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void { + public function apply(skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void { if (local) bone.y += (additive ? value : value - bone.y) * pose.mixY; else { - if (!additive) value -= bone.worldY / skeleton.scaleY; + if (!additive) + value -= bone.worldY / skeleton.scaleY; bone.worldY += value * pose.mixY * skeleton.scaleY; } } } class FromScaleX extends FromProperty { - public function value (skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float { - if (local) return source.scaleX + offsets[TransformConstraintData.SCALEX]; + public function value(skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float { + if (local) + return source.scaleX + offsets[TransformConstraintData.SCALEX]; var a = source.a / skeleton.scaleX, c = source.c / skeleton.scaleY; return Math.sqrt(a * a + c * c) + offsets[TransformConstraintData.SCALEX]; } } class ToScaleX extends ToProperty { - public function mix (pose:TransformConstraintPose):Float { + public function mix(pose:TransformConstraintPose):Float { return pose.mixScaleX; } - public function apply (skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void { + public function apply(skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void { if (local) { if (additive) bone.scaleX *= 1 + (value - 1) * pose.mixScaleX; @@ -301,7 +313,9 @@ class ToScaleX extends ToProperty { bone.a *= s; bone.c *= s; } else { - var a = bone.a / skeleton.scaleX, c = bone.c / skeleton.scaleY, s = Math.sqrt(a * a + c * c); + var a = bone.a / skeleton.scaleX, + c = bone.c / skeleton.scaleY, + s = Math.sqrt(a * a + c * c); if (s != 0) { s = 1 + (value - s) * pose.mixScaleX / s; bone.a *= s; @@ -312,19 +326,20 @@ class ToScaleX extends ToProperty { } class FromScaleY extends FromProperty { - public function value (skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float { - if (local) return source.scaleY + offsets[TransformConstraintData.SCALEY]; + public function value(skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float { + if (local) + return source.scaleY + offsets[TransformConstraintData.SCALEY]; var b = source.b / skeleton.scaleX, d = source.d / skeleton.scaleY; return Math.sqrt(b * b + d * d) + offsets[TransformConstraintData.SCALEY]; } } class ToScaleY extends ToProperty { - public function mix (pose:TransformConstraintPose):Float { + public function mix(pose:TransformConstraintPose):Float { return pose.mixScaleY; } - public function apply (skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void { + public function apply(skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void { if (local) { if (additive) bone.scaleY *= 1 + (value - 1) * pose.mixScaleY; @@ -335,7 +350,9 @@ class ToScaleY extends ToProperty { bone.b *= s; bone.d *= s; } else { - var b = bone.b / skeleton.scaleX, d = bone.d / skeleton.scaleY, s = Math.sqrt(b * b + d * d); + var b = bone.b / skeleton.scaleX, + d = bone.d / skeleton.scaleY, + s = Math.sqrt(b * b + d * d); if (s != 0) { s = 1 + (value - s) * pose.mixScaleY / s; bone.b *= s; @@ -346,25 +363,33 @@ class ToScaleY extends ToProperty { } class FromShearY extends FromProperty { - public function value (skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float { - if (local) return source.shearY + offsets[TransformConstraintData.SHEARY]; + public function value(skeleton:Skeleton, source:BonePose, local:Bool, offsets:Array):Float { + if (local) + return source.shearY + offsets[TransformConstraintData.SHEARY]; var sx = 1 / skeleton.scaleX, sy = 1 / skeleton.scaleY; - return (Math.atan2(source.d * sy, source.b * sx) - Math.atan2(source.c * sy, source.a * sx)) - * MathUtils.radDeg - 90 + offsets[TransformConstraintData.SHEARY]; + return (Math.atan2(source.d * sy, source.b * sx) + - Math.atan2(source.c * sy, source.a * sx)) * MathUtils.radDeg + - 90 + + offsets[TransformConstraintData.SHEARY]; } } class ToShearY extends ToProperty { - public function mix (pose:TransformConstraintPose):Float { + public function mix(pose:TransformConstraintPose):Float { return pose.mixShearY; } - public function apply (skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void { + public function apply(skeleton:Skeleton, pose:TransformConstraintPose, bone:BonePose, value:Float, local:Bool, additive:Bool):Void { if (local) { - if (!additive) value -= bone.shearY; + if (!additive) + value -= bone.shearY; bone.shearY += value * pose.mixShearY; } else { - var sx = skeleton.scaleX, sy = skeleton.scaleY, b = bone.b / sx, d = bone.d / sy, by = Math.atan2(d, b); + var sx = skeleton.scaleX, + sy = skeleton.scaleY, + b = bone.b / sx, + d = bone.d / sy, + by = Math.atan2(d, b); value = (value + 90) * MathUtils.degRad; if (additive) value -= MathUtils.PI / 2; diff --git a/spine-haxe/spine-haxe/spine/TransformConstraintPose.hx b/spine-haxe/spine-haxe/spine/TransformConstraintPose.hx index ad56a544e..cae246fc2 100644 --- a/spine-haxe/spine-haxe/spine/TransformConstraintPose.hx +++ b/spine-haxe/spine-haxe/spine/TransformConstraintPose.hx @@ -25,35 +25,33 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; /** Stores a pose for a transform constraint. */ class TransformConstraintPose implements Pose { - /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotation. */ public var mixRotate = 0.; + /** A percentage (0-1) that controls the mix between the constrained and unconstrained translation X. */ - public var mixX = 0.; + /** A percentage (0-1) that controls the mix between the constrained and unconstrained translation Y. */ - public var mixY = 0.; + /** A percentage (0-1) that controls the mix between the constrained and unconstrained scale X. */ - public var mixScaleX = 0.; + /** A percentage (0-1) that controls the mix between the constrained and unconstrained scale Y. */ - public var mixScaleY = 0.; - /** A percentage (0-1) that controls the mix between the constrained and unconstrained shear Y. */ + /** A percentage (0-1) that controls the mix between the constrained and unconstrained shear Y. */ public var mixShearY = 0.; - public function new () { - } + public function new() {} - public function set (pose:TransformConstraintPose) { + public function set(pose:TransformConstraintPose) { mixRotate = pose.mixRotate; mixX = pose.mixX; mixY = pose.mixY; @@ -61,5 +59,4 @@ class TransformConstraintPose implements Pose { mixScaleY = pose.mixScaleY; mixShearY = pose.mixShearY; } - -} \ No newline at end of file +} diff --git a/spine-haxe/spine-haxe/spine/Triangulator.hx b/spine-haxe/spine-haxe/spine/Triangulator.hx index 5e31f4e75..011655f73 100644 --- a/spine-haxe/spine-haxe/spine/Triangulator.hx +++ b/spine-haxe/spine-haxe/spine/Triangulator.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/Update.hx b/spine-haxe/spine-haxe/spine/Update.hx index adf2a3c38..3d2479891 100644 --- a/spine-haxe/spine-haxe/spine/Update.hx +++ b/spine-haxe/spine-haxe/spine/Update.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/Vertex.hx b/spine-haxe/spine-haxe/spine/Vertex.hx index de2eb1e9d..c5986ef85 100644 --- a/spine-haxe/spine-haxe/spine/Vertex.hx +++ b/spine-haxe/spine-haxe/spine/Vertex.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine; diff --git a/spine-haxe/spine-haxe/spine/animation/AlphaTimeline.hx b/spine-haxe/spine-haxe/spine/animation/AlphaTimeline.hx index 31593ee48..f1dac1675 100644 --- a/spine-haxe/spine-haxe/spine/animation/AlphaTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/AlphaTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -55,11 +55,11 @@ class AlphaTimeline extends CurveTimeline1 implements SlotTimeline { return slotIndex; } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var slot = skeleton.slots[slotIndex]; - if (!slot.bone.active) return; + if (!slot.bone.active) + return; var color = (appliedPose ? slot.applied : slot.pose).color; if (time < frames[0]) { diff --git a/spine-haxe/spine-haxe/spine/animation/Animation.hx b/spine-haxe/spine-haxe/spine/animation/Animation.hx index 55645e04b..36a95769e 100644 --- a/spine-haxe/spine-haxe/spine/animation/Animation.hx +++ b/spine-haxe/spine-haxe/spine/animation/Animation.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -36,12 +36,11 @@ import spine.Skeleton; /** Stores a list of timelines to animate a skeleton's pose over time. */ class Animation { - /** The animation's name, which is unique across all animations in the skeleton. */ public final name:String; /** The duration of the animation in seconds, which is usually the highest time of all frames in the timeline. The duration is - * used to know when it has completed and when it should loop back to the start. */ + * used to know when it has completed and when it should loop back to the start. */ public var duration:Float = 0; public var timelines:Array; @@ -49,7 +48,8 @@ class Animation { public final bones:Array; public function new(name:String, timelines:Array, duration:Float) { - if (name == null) throw new SpineException("name cannot be null."); + if (name == null) + throw new SpineException("name cannot be null."); this.name = name; this.duration = duration; var n = timelines.length << 1; @@ -59,7 +59,8 @@ class Animation { } public function setTimelines(timelines:Array) { - if (timelines == null) throw new SpineException("timelines cannot be null."); + if (timelines == null) + throw new SpineException("timelines cannot be null."); this.timelines = timelines; timelineIds.clear(); @@ -67,7 +68,8 @@ class Animation { var boneSet = new IntMap(); for (timeline in timelines) { var ids:Array = timeline.propertyIds; - for (id in ids) timelineIds.set(id, true); + for (id in ids) + timelineIds.set(id, true); if (Std.isOfType(timeline, BoneTimeline)) { var boneTimeline = cast(timeline, BoneTimeline); var boneIndex = boneTimeline.getBoneIndex(); @@ -108,13 +110,15 @@ class Animation { * @param blend Controls how mixing is applied when alpha < 1. * @param direction Indicates whether the timelines are mixing in or out. Used by timelines which perform instant transitions, * such as DrawOrderTimeline or AttachmentTimeline. */ - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, loop:Bool, events:Array, alpha:Float, blend:MixBlend, - direction:MixDirection, appliedPose:Bool):Void { - if (skeleton == null) throw new SpineException("skeleton cannot be null."); + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, loop:Bool, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool):Void { + if (skeleton == null) + throw new SpineException("skeleton cannot be null."); if (loop && duration != 0) { time %= duration; - if (lastTime > 0) lastTime %= duration; + if (lastTime > 0) + lastTime %= duration; } for (timeline in timelines) { diff --git a/spine-haxe/spine-haxe/spine/animation/AnimationState.hx b/spine-haxe/spine-haxe/spine/animation/AnimationState.hx index b331ab1d6..bc12cdb6b 100644 --- a/spine-haxe/spine-haxe/spine/animation/AnimationState.hx +++ b/spine-haxe/spine-haxe/spine/animation/AnimationState.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -47,12 +47,14 @@ class AnimationState { * Result: Mix from the current pose to the timeline pose. */ public static inline var SUBSEQUENT:Int = 0; + /** * 1) This is the first timeline to set this property. * 2) The next track entry applied after this one does not have a timeline to set this property. * Result: Mix from the setup pose to the timeline pose. */ public static inline var FIRST:Int = 1; + /** * 1) A previously applied timeline has set this property. * 2) The next track entry to be applied does have a timeline to set this property. @@ -61,6 +63,7 @@ class AnimationState { * animations that key the same property. A subsequent timeline will set this property using a mix. */ public static inline var HOLD_SUBSEQUENT:Int = 2; + /** * 1) This is the first timeline to set this property. * 2) The next track entry to be applied does have a timeline to set this property. @@ -69,6 +72,7 @@ class AnimationState { * that key the same property. A subsequent timeline will set this property using a mix. */ public static inline var HOLD_FIRST:Int = 3; + /** * 1) This is the first timeline to set this property. * 2) The next track entry to be applied does have a timeline to set this property. @@ -82,6 +86,7 @@ class AnimationState { * out position. */ public static inline var HOLD_MIX:Int = 4; + public static inline var SETUP:Int = 1; public static inline var CURRENT:Int = 2; @@ -203,7 +208,8 @@ class AnimationState { // Mixing is complete for all entries before the from entry or the mix is instantaneous. if (from.totalAlpha == 0 || to.mixDuration == 0) { to.mixingFrom = from.mixingFrom; - if (from.mixingFrom != null) from.mixingFrom.mixingTo = to; + if (from.mixingFrom != null) + from.mixingFrom.mixingTo = to; to.interruptAlpha = from.interruptAlpha; queue.end(from); } @@ -256,7 +262,8 @@ class AnimationState { var timelineCount:Int = timelines.length; var timeline:Timeline; if ((i == 0 && alpha == 1) || blend == MixBlend.add) { - if (i == 0) attachments = true; + if (i == 0) + attachments = true; for (timeline in timelines) { if (Std.isOfType(timeline, AttachmentTimeline)) { applyAttachmentTimeline(cast(timeline, AttachmentTimeline), skeleton, applyTime, blend, attachments); @@ -276,8 +283,8 @@ class AnimationState { var timeline:Timeline = timelines[ii]; var timelineBlend:MixBlend = timelineMode[ii] == SUBSEQUENT ? blend : MixBlend.setup; if (!shortestRotation && Std.isOfType(timeline, RotateTimeline)) { - this.applyRotateTimeline(cast(timeline, RotateTimeline), skeleton, applyTime, alpha, timelineBlend, current.timelinesRotation, ii << 1, - firstFrame); + this.applyRotateTimeline(cast(timeline, RotateTimeline), skeleton, applyTime, alpha, timelineBlend, current.timelinesRotation, + ii << 1, firstFrame); } else if (Std.isOfType(timeline, AttachmentTimeline)) { this.applyAttachmentTimeline(cast(timeline, AttachmentTimeline), skeleton, applyTime, blend, attachments); } else { @@ -387,7 +394,8 @@ class AnimationState { if (!shortestRotation && Std.isOfType(timeline, RotateTimeline)) { applyRotateTimeline(cast(timeline, RotateTimeline), skeleton, applyTime, alpha, timelineBlend, from.timelinesRotation, i << 1, firstFrame); } else if (Std.isOfType(timeline, AttachmentTimeline)) { - applyAttachmentTimeline(cast(timeline, AttachmentTimeline), skeleton, applyTime, timelineBlend, attachments && alpha >= from.alphaAttachmentThreshold); + applyAttachmentTimeline(cast(timeline, AttachmentTimeline), skeleton, applyTime, + timelineBlend, attachments && alpha >= from.alphaAttachmentThreshold); } else { if (drawOrder && Std.isOfType(timeline, DrawOrderTimeline) && timelineBlend == MixBlend.setup) direction = MixDirection.mixIn; @@ -534,7 +542,8 @@ class AnimationState { } } else complete = animationTime >= animationEnd && entry.animationLast < animationEnd; - if (complete) queue.complete(entry); + if (complete) + queue.complete(entry); // Queue events after complete. while (i < n) { @@ -699,11 +708,13 @@ class AnimationState { if (last == null) { setCurrent(trackIndex, entry, true); queue.drain(); - if (delay < 0) delay = 0; + if (delay < 0) + delay = 0; } else { last.next = entry; entry.previous = last; - if (delay <= 0) delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0); + if (delay <= 0) + delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0); } entry.delay = delay; @@ -753,7 +764,8 @@ class AnimationState { */ public function addEmptyAnimation(trackIndex:Int, mixDuration:Float, delay:Float):TrackEntry { var entry:TrackEntry = addAnimation(trackIndex, emptyAnimation, false, delay); - if (delay <= 0) entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0); + if (delay <= 0) + entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0); entry.mixDuration = mixDuration; entry.trackEnd = mixDuration; return entry; diff --git a/spine-haxe/spine-haxe/spine/animation/AnimationStateData.hx b/spine-haxe/spine-haxe/spine/animation/AnimationStateData.hx index 72934e7dc..76cbdfa50 100644 --- a/spine-haxe/spine-haxe/spine/animation/AnimationStateData.hx +++ b/spine-haxe/spine-haxe/spine/animation/AnimationStateData.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; diff --git a/spine-haxe/spine-haxe/spine/animation/AttachmentTimeline.hx b/spine-haxe/spine-haxe/spine/animation/AttachmentTimeline.hx index 3e726a3d0..75813b36e 100644 --- a/spine-haxe/spine-haxe/spine/animation/AttachmentTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/AttachmentTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -63,17 +63,19 @@ class AttachmentTimeline extends Timeline implements SlotTimeline { attachmentNames[frame] = attachmentName; } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var slot = skeleton.slots[slotIndex]; - if (!slot.bone.active) return; + if (!slot.bone.active) + return; var pose = appliedPose ? slot.applied : slot.pose; if (direction == MixDirection.mixOut) { - if (blend == MixBlend.setup) setAttachment(skeleton, pose, slot.data.attachmentName); + if (blend == MixBlend.setup) + setAttachment(skeleton, pose, slot.data.attachmentName); } else if (time < frames[0]) { - if (blend == MixBlend.setup || blend == MixBlend.first) setAttachment(skeleton, pose, slot.data.attachmentName); + if (blend == MixBlend.setup || blend == MixBlend.first) + setAttachment(skeleton, pose, slot.data.attachmentName); } else setAttachment(skeleton, pose, attachmentNames[Timeline.search1(frames, time)]); } diff --git a/spine-haxe/spine-haxe/spine/animation/BoneTimeline.hx b/spine-haxe/spine-haxe/spine/animation/BoneTimeline.hx index 4fe099978..4ff1ae9fb 100644 --- a/spine-haxe/spine-haxe/spine/animation/BoneTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/BoneTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; diff --git a/spine-haxe/spine-haxe/spine/animation/BoneTimeline1.hx b/spine-haxe/spine-haxe/spine/animation/BoneTimeline1.hx index fdb52bf33..e4a7841c0 100644 --- a/spine-haxe/spine-haxe/spine/animation/BoneTimeline1.hx +++ b/spine-haxe/spine-haxe/spine/animation/BoneTimeline1.hx @@ -25,11 +25,11 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ - package spine.animation; +package spine.animation; - abstract class BoneTimeline1 extends CurveTimeline1 implements BoneTimeline { +abstract class BoneTimeline1 extends CurveTimeline1 implements BoneTimeline { public final boneIndex:Int; public function new(frameCount:Int, bezierCount:Int, boneIndex:Int, property:Property) { @@ -37,16 +37,16 @@ this.boneIndex = boneIndex; } - public function getBoneIndex () { + public function getBoneIndex() { return boneIndex; } - public function apply (skeleton: Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, - direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var bone = skeleton.bones[boneIndex]; - if (bone.active) apply1(appliedPose ? bone.applied : bone.pose, bone.data.setup, time, alpha, blend, direction); + if (bone.active) + apply1(appliedPose ? bone.applied : bone.pose, bone.data.setup, time, alpha, blend, direction); } - abstract function apply1 (pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection):Void; + abstract function apply1(pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection):Void; } diff --git a/spine-haxe/spine-haxe/spine/animation/BoneTimeline2.hx b/spine-haxe/spine-haxe/spine/animation/BoneTimeline2.hx index 62450d0ef..87bb4e89a 100644 --- a/spine-haxe/spine-haxe/spine/animation/BoneTimeline2.hx +++ b/spine-haxe/spine-haxe/spine/animation/BoneTimeline2.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -57,16 +57,16 @@ abstract class BoneTimeline2 extends CurveTimeline implements BoneTimeline { frames[frame + VALUE2] = value2; } - public function getBoneIndex () { + public function getBoneIndex() { return boneIndex; } - public function apply (skeleton: Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, - direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var bone = skeleton.bones[boneIndex]; - if (bone.active) apply1(appliedPose ? bone.applied : bone.pose, bone.data.setup, time, alpha, blend, direction); + if (bone.active) + apply1(appliedPose ? bone.applied : bone.pose, bone.data.setup, time, alpha, blend, direction); } - abstract function apply1 (pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection):Void; + abstract function apply1(pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection):Void; } diff --git a/spine-haxe/spine-haxe/spine/animation/ConstraintTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ConstraintTimeline.hx index 4b5882c89..751e243d2 100644 --- a/spine-haxe/spine-haxe/spine/animation/ConstraintTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/ConstraintTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; diff --git a/spine-haxe/spine-haxe/spine/animation/ConstraintTimeline1.hx b/spine-haxe/spine-haxe/spine/animation/ConstraintTimeline1.hx index bebb46cd7..a05be5d3b 100644 --- a/spine-haxe/spine-haxe/spine/animation/ConstraintTimeline1.hx +++ b/spine-haxe/spine-haxe/spine/animation/ConstraintTimeline1.hx @@ -25,19 +25,19 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; abstract class ConstraintTimeline1 extends CurveTimeline1 implements ConstraintTimeline { public final constraintIndex:Int; - public function new (frameCount:Int, bezierCount:Int, constraintIndex:Int, property:Property) { + public function new(frameCount:Int, bezierCount:Int, constraintIndex:Int, property:Property) { super(frameCount, bezierCount, property + "|" + constraintIndex); this.constraintIndex = constraintIndex; } - public function getConstraintIndex () { + public function getConstraintIndex() { return constraintIndex; } } diff --git a/spine-haxe/spine-haxe/spine/animation/CurveTimeline.hx b/spine-haxe/spine-haxe/spine/animation/CurveTimeline.hx index 88631937d..22290949e 100644 --- a/spine-haxe/spine-haxe/spine/animation/CurveTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/CurveTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; diff --git a/spine-haxe/spine-haxe/spine/animation/CurveTimeline1.hx b/spine-haxe/spine-haxe/spine/animation/CurveTimeline1.hx index deea375f0..c6c06c784 100644 --- a/spine-haxe/spine-haxe/spine/animation/CurveTimeline1.hx +++ b/spine-haxe/spine-haxe/spine/animation/CurveTimeline1.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -78,64 +78,86 @@ abstract class CurveTimeline1 extends CurveTimeline { } } - public function getRelativeValue (time:Float, alpha:Float, blend: MixBlend, current:Float, setup:Float):Float { + public function getRelativeValue(time:Float, alpha:Float, blend:MixBlend, current:Float, setup:Float):Float { if (time < frames[0]) { switch (blend) { - case MixBlend.setup: return setup; - case MixBlend.first: return current + (setup - current) * alpha; - default: return current; + case MixBlend.setup: + return setup; + case MixBlend.first: + return current + (setup - current) * alpha; + default: + return current; } } var value:Float = getCurveValue(time); switch (blend) { - case MixBlend.setup: return setup + value * alpha; - case MixBlend.first, MixBlend.replace: return current + (value + setup - current) * alpha; - default: return current + value * alpha; // MixBlend.add + case MixBlend.setup: + return setup + value * alpha; + case MixBlend.first, MixBlend.replace: + return current + (value + setup - current) * alpha; + default: + return current + value * alpha; // MixBlend.add } } - public function getAbsoluteValue (time:Float, alpha:Float, blend: MixBlend, current:Float, setup:Float):Float { + public function getAbsoluteValue(time:Float, alpha:Float, blend:MixBlend, current:Float, setup:Float):Float { if (time < frames[0]) { switch (blend) { - case MixBlend.setup: return setup; - case MixBlend.first: return current + (setup - current) * alpha; - default: return current; + case MixBlend.setup: + return setup; + case MixBlend.first: + return current + (setup - current) * alpha; + default: + return current; } } var value:Float = getCurveValue(time); switch (blend) { - case MixBlend.setup: return setup + (value - setup) * alpha; - case MixBlend.first, MixBlend.replace: return current + (value - current) * alpha; - default: return current + value * alpha; // MixBlend.add + case MixBlend.setup: + return setup + (value - setup) * alpha; + case MixBlend.first, MixBlend.replace: + return current + (value - current) * alpha; + default: + return current + value * alpha; // MixBlend.add } } - public function getAbsoluteValue2 (time:Float, alpha:Float, blend: MixBlend, current:Float, setup:Float, value:Float):Float { + public function getAbsoluteValue2(time:Float, alpha:Float, blend:MixBlend, current:Float, setup:Float, value:Float):Float { if (time < frames[0]) { switch (blend) { - case MixBlend.setup: return setup; - case MixBlend.first: return current + (setup - current) * alpha; - default: current; + case MixBlend.setup: + return setup; + case MixBlend.first: + return current + (setup - current) * alpha; + default: + current; } } switch (blend) { - case MixBlend.setup: return setup + (value - setup) * alpha; - case MixBlend.first, MixBlend.replace: return current + (value - current) * alpha; - default: return current + value * alpha; // MixBlend.add + case MixBlend.setup: + return setup + (value - setup) * alpha; + case MixBlend.first, MixBlend.replace: + return current + (value - current) * alpha; + default: + return current + value * alpha; // MixBlend.add } } - public function getScaleValue (time:Float, alpha:Float, blend: MixBlend, direction: MixDirection, current:Float, setup:Float):Float { + public function getScaleValue(time:Float, alpha:Float, blend:MixBlend, direction:MixDirection, current:Float, setup:Float):Float { var frames:Array = frames; if (time < frames[0]) { switch (blend) { - case MixBlend.setup: return setup; - case MixBlend.first: return current + (setup - current) * alpha; - default: return current; + case MixBlend.setup: + return setup; + case MixBlend.first: + return current + (setup - current) * alpha; + default: + return current; } } var value:Float = getCurveValue(time) * setup; - if (alpha == 1) return blend == MixBlend.add ? current + value - setup : value; + if (alpha == 1) + return blend == MixBlend.add ? current + value - setup : value; // Mixing out uses sign of setup or current pose, else use sign of key. if (direction == MixDirection.mixOut) { switch (blend) { diff --git a/spine-haxe/spine-haxe/spine/animation/DeformTimeline.hx b/spine-haxe/spine-haxe/spine/animation/DeformTimeline.hx index f669307b1..c2f057ade 100644 --- a/spine-haxe/spine-haxe/spine/animation/DeformTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/DeformTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -139,19 +139,23 @@ class DeformTimeline extends SlotCurveTimeline { return y + (1 - y) * (time - x) / (frames[frame + getFrameEntries()] - x); } - public function apply1 (slot:Slot, pose:SlotPose, time:Float, alpha:Float, blend:MixBlend) { - if (!Std.isOfType(pose.attachment, VertexAttachment)) return; + public function apply1(slot:Slot, pose:SlotPose, time:Float, alpha:Float, blend:MixBlend) { + if (!Std.isOfType(pose.attachment, VertexAttachment)) + return; var vertexAttachment = cast(pose.attachment, VertexAttachment); - if (vertexAttachment.timelineAttachment != attachment) return; + if (vertexAttachment.timelineAttachment != attachment) + return; var deform = pose.deform; - if (deform.length == 0) blend = MixBlend.setup; + if (deform.length == 0) + blend = MixBlend.setup; var vertexCount = vertices[0].length; if (time < frames[0]) { switch (blend) { - case MixBlend.setup: deform.resize(0); + case MixBlend.setup: + deform.resize(0); case MixBlend.first: if (alpha == 1) { deform.resize(0); @@ -253,7 +257,8 @@ class DeformTimeline extends SlotCurveTimeline { if (vertexAttachment.bones == null) { // Unweighted vertex positions, with alpha. var setupVertices = vertexAttachment.vertices; for (i in 0...vertexCount) { - var prev = prevVertices[i], setup = setupVertices[i]; + var prev = prevVertices[i], + setup = setupVertices[i]; deform[i] = setup + (prev + (nextVertices[i] - prev) * percent - setup) * alpha; } } else { // Weighted deform offsets, with alpha. diff --git a/spine-haxe/spine-haxe/spine/animation/DrawOrderTimeline.hx b/spine-haxe/spine-haxe/spine/animation/DrawOrderTimeline.hx index 69e1ef84a..c7cc519d1 100644 --- a/spine-haxe/spine-haxe/spine/animation/DrawOrderTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/DrawOrderTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -59,9 +59,8 @@ class DrawOrderTimeline extends Timeline { drawOrders[frame] = drawOrder; } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var drawOrder:Array = skeleton.drawOrder; var slots:Array = skeleton.slots; var i:Int = 0, n:Int = slots.length; diff --git a/spine-haxe/spine-haxe/spine/animation/EventQueue.hx b/spine-haxe/spine-haxe/spine/animation/EventQueue.hx index e6912baf7..4708d11e8 100644 --- a/spine-haxe/spine-haxe/spine/animation/EventQueue.hx +++ b/spine-haxe/spine-haxe/spine/animation/EventQueue.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -79,7 +79,8 @@ class EventQueue { } public function drain():Void { - if (drainDisabled) return; // Not reentrant. + if (drainDisabled) + return; // Not reentrant. drainDisabled = true; var i:Int = 0; diff --git a/spine-haxe/spine-haxe/spine/animation/EventTimeline.hx b/spine-haxe/spine-haxe/spine/animation/EventTimeline.hx index 0011a681e..6f8d966ee 100644 --- a/spine-haxe/spine-haxe/spine/animation/EventTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/EventTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -56,9 +56,10 @@ class EventTimeline extends Timeline { } /** Fires events for frames > lastTime and <= time. */ - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, firedEvents:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - if (firedEvents == null) return; + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, firedEvents:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { + if (firedEvents == null) + return; var frameCount:Int = frames.length; @@ -67,7 +68,8 @@ class EventTimeline extends Timeline { lastTime = -1; } else if (lastTime >= frames[frameCount - 1]) // Last time is after last frame. return; - if (time < frames[0]) return; + if (time < frames[0]) + return; var frame:Int; var i:Int = 0; diff --git a/spine-haxe/spine-haxe/spine/animation/EventType.hx b/spine-haxe/spine-haxe/spine/animation/EventType.hx index 6d9a5ddb9..2ba127aa6 100644 --- a/spine-haxe/spine-haxe/spine/animation/EventType.hx +++ b/spine-haxe/spine-haxe/spine/animation/EventType.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; diff --git a/spine-haxe/spine-haxe/spine/animation/IkConstraintTimeline.hx b/spine-haxe/spine-haxe/spine/animation/IkConstraintTimeline.hx index 3899fa3c6..90d366756 100644 --- a/spine-haxe/spine-haxe/spine/animation/IkConstraintTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/IkConstraintTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -52,7 +52,7 @@ class IkConstraintTimeline extends CurveTimeline implements ConstraintTimeline { return ENTRIES; } - public function getConstraintIndex () { + public function getConstraintIndex() { return constraintIndex; } @@ -70,11 +70,11 @@ class IkConstraintTimeline extends CurveTimeline implements ConstraintTimeline { frames[frame + STRETCH] = stretch ? 1 : 0; } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var constraint = cast(skeleton.constraints[constraintIndex], IkConstraint); - if (!constraint.active) return; + if (!constraint.active) + return; var pose = appliedPose ? constraint.applied : constraint.pose; if (time < frames[0]) { @@ -129,12 +129,13 @@ class IkConstraintTimeline extends CurveTimeline implements ConstraintTimeline { case MixBlend.first, MixBlend.replace: pose.mix += (mix - pose.mix) * alpha; pose.softness += (softness - pose.softness) * alpha; - if (direction == MixDirection.mixOut) return; + if (direction == MixDirection.mixOut) + return; case MixBlend.add: pose.mix += mix * alpha; pose.softness += softness * alpha; - if (direction == MixDirection.mixOut) return; - + if (direction == MixDirection.mixOut) + return; } pose.bendDirection = Std.int(frames[i + BEND_DIRECTION]); pose.compress = frames[i + COMPRESS] != 0; diff --git a/spine-haxe/spine-haxe/spine/animation/InheritTimeline.hx b/spine-haxe/spine-haxe/spine/animation/InheritTimeline.hx index 35e77ca47..a5cc63b1a 100644 --- a/spine-haxe/spine-haxe/spine/animation/InheritTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/InheritTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -45,7 +45,7 @@ class InheritTimeline extends Timeline implements BoneTimeline { this.boneIndex = boneIndex; } - public function getBoneIndex () { + public function getBoneIndex() { return boneIndex; } @@ -56,27 +56,29 @@ class InheritTimeline extends Timeline implements BoneTimeline { /** Sets the transform mode for the specified frame. * @param frame Between 0 and frameCount, inclusive. * @param time The frame time in seconds. */ - public function setFrame(frame:Int, time:Float, inherit: Inherit):Void { + public function setFrame(frame:Int, time:Float, inherit:Inherit):Void { frame *= ENTRIES; frames[frame] = time; frames[frame + INHERIT] = inherit.ordinal; } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool):Void { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool):Void { var bone:Bone = skeleton.bones[boneIndex]; - if (!bone.active) return; + if (!bone.active) + return; var pose = appliedPose ? bone.applied : bone.pose; if (direction == MixDirection.mixOut) { - if (blend == MixBlend.setup) pose.inherit = bone.data.setup.inherit; + if (blend == MixBlend.setup) + pose.inherit = bone.data.setup.inherit; return; } var frames:Array = frames; if (time < frames[0]) { - if (blend == MixBlend.setup || blend == MixBlend.first) pose.inherit = bone.data.setup.inherit; + if (blend == MixBlend.setup || blend == MixBlend.first) + pose.inherit = bone.data.setup.inherit; } else pose.inherit = Inherit.values[Std.int(frames[Timeline.search(frames, time, ENTRIES) + INHERIT])]; } diff --git a/spine-haxe/spine-haxe/spine/animation/Listeners.hx b/spine-haxe/spine-haxe/spine/animation/Listeners.hx index b86e057b3..807aa8f4d 100644 --- a/spine-haxe/spine-haxe/spine/animation/Listeners.hx +++ b/spine-haxe/spine-haxe/spine/animation/Listeners.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; diff --git a/spine-haxe/spine-haxe/spine/animation/MixBlend.hx b/spine-haxe/spine-haxe/spine/animation/MixBlend.hx index 1d2e250ed..5cba38a0e 100644 --- a/spine-haxe/spine-haxe/spine/animation/MixBlend.hx +++ b/spine-haxe/spine-haxe/spine/animation/MixBlend.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -41,28 +41,28 @@ class MixBlend { } /** Transitions between the setup and timeline values (the current value is not used). Before the first frame, the setup - * value is used. - * - * `setup` is intended to transition to or from the setup pose, not for animations layered on top of others. */ + * value is used. + * + * `setup` is intended to transition to or from the setup pose, not for animations layered on top of others. */ public static var setup(default, never):MixBlend = new MixBlend(0); /** Transitions between the current and timeline values. Before the first frame, transitions between the current and setup - * values. Timelines which perform instant transitions, such as {@link DrawOrderTimeline} or {@link AttachmentTimeline}, use - * the setup value before the first frame. - * - * `first` is intended for the first animations applied, not for animations layered on top of others. */ + * values. Timelines which perform instant transitions, such as {@link DrawOrderTimeline} or {@link AttachmentTimeline}, use + * the setup value before the first frame. + * + * `first` is intended for the first animations applied, not for animations layered on top of others. */ public static var first(default, never):MixBlend = new MixBlend(1); /** Transitions between the current and timeline values. No change is made before the first frame. - * - * `replace` is intended for animations layered on top of others, not for the first animations applied. */ + * + * `replace` is intended for animations layered on top of others, not for the first animations applied. */ public static var replace(default, never):MixBlend = new MixBlend(2); /** Transitions between the current value and the current plus timeline values. No change is made before the first frame. - * - * `add` is intended for animations layered on top of others, not for the first animations applied. - * - * Properties set by additive animations must be set manually or by another animation before applying the additive - * animations, else the property values will increase each time the additive animations are applied. */ + * + * `add` is intended for animations layered on top of others, not for the first animations applied. + * + * Properties set by additive animations must be set manually or by another animation before applying the additive + * animations, else the property values will increase each time the additive animations are applied. */ public static var add(default, never):MixBlend = new MixBlend(3); } diff --git a/spine-haxe/spine-haxe/spine/animation/MixDirection.hx b/spine-haxe/spine-haxe/spine/animation/MixDirection.hx index 5f87b7919..915987a6c 100644 --- a/spine-haxe/spine-haxe/spine/animation/MixDirection.hx +++ b/spine-haxe/spine-haxe/spine/animation/MixDirection.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; diff --git a/spine-haxe/spine-haxe/spine/animation/PathConstraintMixTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PathConstraintMixTimeline.hx index fcc437755..9fb7e6646 100644 --- a/spine-haxe/spine-haxe/spine/animation/PathConstraintMixTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/PathConstraintMixTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -54,7 +54,7 @@ class PathConstraintMixTimeline extends CurveTimeline implements ConstraintTimel return ENTRIES; } - public function getConstraintIndex () { + public function getConstraintIndex() { return constraintIndex; } @@ -69,11 +69,11 @@ class PathConstraintMixTimeline extends CurveTimeline implements ConstraintTimel frames[frame + Y] = mixY; } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var constraint = cast(skeleton.constraints[constraintIndex], PathConstraint); - if (!constraint.active) return; + if (!constraint.active) + return; var pose = appliedPose ? constraint.applied : constraint.pose; if (time < frames[0]) { diff --git a/spine-haxe/spine-haxe/spine/animation/PathConstraintPositionTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PathConstraintPositionTimeline.hx index 699e439b4..1b8434c86 100644 --- a/spine-haxe/spine-haxe/spine/animation/PathConstraintPositionTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/PathConstraintPositionTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,14 +35,12 @@ class PathConstraintPositionTimeline extends ConstraintTimeline1 { super(frameCount, bezierCount, constraintIndex, Property.pathConstraintPosition); } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var constraint = cast(skeleton.constraints[constraintIndex], PathConstraint); if (constraint.active) { var pose = appliedPose ? constraint.applied : constraint.pose; pose.position = getAbsoluteValue(time, alpha, blend, pose.position, constraint.data.setup.position); } - } } diff --git a/spine-haxe/spine-haxe/spine/animation/PathConstraintSpacingTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PathConstraintSpacingTimeline.hx index 4b5ab5ba8..d089b3f15 100644 --- a/spine-haxe/spine-haxe/spine/animation/PathConstraintSpacingTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/PathConstraintSpacingTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -39,9 +39,8 @@ class PathConstraintSpacingTimeline extends ConstraintTimeline1 { super(frameCount, bezierCount, constraintIndex, Property.pathConstraintSpacing); } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var constraint = cast(skeleton.constraints[constraintIndex], PathConstraint); if (constraint.active) { var pose = appliedPose ? constraint.applied : constraint.pose; diff --git a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintDampingTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintDampingTimeline.hx index 172a65de1..505b4cc9d 100644 --- a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintDampingTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintDampingTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,16 +35,15 @@ class PhysicsConstraintDampingTimeline extends PhysicsConstraintTimeline { super(frameCount, bezierCount, constraintIndex, Property.physicsConstraintDamping); } - public function get (pose: PhysicsConstraintPose):Float { + public function get(pose:PhysicsConstraintPose):Float { return pose.damping; } - public function set (pose: PhysicsConstraintPose, value:Float):Void { + public function set(pose:PhysicsConstraintPose, value:Float):Void { pose.damping = value; } - public function global (constraint: PhysicsConstraintData):Bool { + public function global(constraint:PhysicsConstraintData):Bool { return constraint.dampingGlobal; } - } diff --git a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintGravityTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintGravityTimeline.hx index c6399926b..df3362be1 100644 --- a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintGravityTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintGravityTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,16 +35,15 @@ class PhysicsConstraintGravityTimeline extends PhysicsConstraintTimeline { super(frameCount, bezierCount, constraintIndex, Property.physicsConstraintGravity); } - public function get (pose: PhysicsConstraintPose):Float { + public function get(pose:PhysicsConstraintPose):Float { return pose.gravity; } - public function set (pose: PhysicsConstraintPose, value:Float):Void { + public function set(pose:PhysicsConstraintPose, value:Float):Void { pose.gravity = value; } - public function global (constraint: PhysicsConstraintData):Bool { + public function global(constraint:PhysicsConstraintData):Bool { return constraint.gravityGlobal; } - } diff --git a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintInertiaTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintInertiaTimeline.hx index 32054adf8..2a6059c84 100644 --- a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintInertiaTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintInertiaTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,16 +35,15 @@ class PhysicsConstraintInertiaTimeline extends PhysicsConstraintTimeline { super(frameCount, bezierCount, constraintIndex, Property.physicsConstraintInertia); } - public function get (pose: PhysicsConstraintPose):Float { + public function get(pose:PhysicsConstraintPose):Float { return pose.inertia; } - public function set (pose: PhysicsConstraintPose, value:Float):Void { + public function set(pose:PhysicsConstraintPose, value:Float):Void { pose.inertia = value; } - public function global (constraint: PhysicsConstraintData):Bool { + public function global(constraint:PhysicsConstraintData):Bool { return constraint.inertiaGlobal; } - } diff --git a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintMassTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintMassTimeline.hx index bd47350a6..404fa5150 100644 --- a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintMassTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintMassTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,16 +35,15 @@ class PhysicsConstraintMassTimeline extends PhysicsConstraintTimeline { super(frameCount, bezierCount, constraintIndex, Property.physicsConstraintMass); } - public function get (pose: PhysicsConstraintPose):Float { + public function get(pose:PhysicsConstraintPose):Float { return 1 / pose.massInverse; } - public function set (pose: PhysicsConstraintPose, value:Float):Void { + public function set(pose:PhysicsConstraintPose, value:Float):Void { pose.massInverse = 1 / value; } - public function global (constraint: PhysicsConstraintData):Bool { + public function global(constraint:PhysicsConstraintData):Bool { return constraint.massGlobal; } - } diff --git a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintMixTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintMixTimeline.hx index 21e3211a3..b6a843b3d 100644 --- a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintMixTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintMixTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,16 +35,15 @@ class PhysicsConstraintMixTimeline extends PhysicsConstraintTimeline { super(frameCount, bezierCount, constraintIndex, Property.physicsConstraintMix); } - public function get (pose: PhysicsConstraintPose):Float { + public function get(pose:PhysicsConstraintPose):Float { return pose.mix; } - public function set (pose: PhysicsConstraintPose, value:Float):Void { + public function set(pose:PhysicsConstraintPose, value:Float):Void { pose.mix = value; } - public function global (constraint: PhysicsConstraintData):Bool { + public function global(constraint:PhysicsConstraintData):Bool { return constraint.mixGlobal; } - } diff --git a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintResetTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintResetTimeline.hx index 73ea745c4..33ec52100 100644 --- a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintResetTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintResetTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -43,7 +43,7 @@ class PhysicsConstraintResetTimeline extends Timeline implements ConstraintTimel this.constraintIndex = constraintIndex; } - public function getConstraintIndex () { + public function getConstraintIndex() { return constraintIndex; } @@ -58,13 +58,13 @@ class PhysicsConstraintResetTimeline extends Timeline implements ConstraintTimel } /** Resets the physics constraint when frames > lastTime and <= time. */ - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var constraint:PhysicsConstraint = null; if (constraintIndex != -1) { constraint = cast(skeleton.constraints[constraintIndex], PhysicsConstraint); - if (!constraint.active) return; + if (!constraint.active) + return; } var frames:Array = this.frames; @@ -74,14 +74,16 @@ class PhysicsConstraintResetTimeline extends Timeline implements ConstraintTimel lastTime = -1; } else if (lastTime >= frames[frames.length - 1]) // Last time is after last frame. return; - if (time < frames[0]) return; + if (time < frames[0]) + return; if (lastTime < frames[0] || time >= frames[Timeline.search1(frames, lastTime) + 1]) { if (constraint != null) constraint.reset(skeleton); else { for (constraint in skeleton.physics) { - if (constraint.active) constraint.reset(skeleton); + if (constraint.active) + constraint.reset(skeleton); } } } diff --git a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintStrengthTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintStrengthTimeline.hx index e1ddd9e2a..65a73b4b6 100644 --- a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintStrengthTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintStrengthTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,16 +35,15 @@ class PhysicsConstraintStrengthTimeline extends PhysicsConstraintTimeline { super(frameCount, bezierCount, constraintIndex, Property.physicsConstraintStrength); } - public function get (pose: PhysicsConstraintPose):Float { + public function get(pose:PhysicsConstraintPose):Float { return pose.strength; } - public function set (pose: PhysicsConstraintPose, value:Float):Void { + public function set(pose:PhysicsConstraintPose, value:Float):Void { pose.strength = value; } - public function global (constraint: PhysicsConstraintData):Bool { + public function global(constraint:PhysicsConstraintData):Bool { return constraint.strengthGlobal; } - } diff --git a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintTimeline.hx index d61c20422..01801adf8 100644 --- a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -42,9 +42,8 @@ abstract class PhysicsConstraintTimeline extends ConstraintTimeline1 { super(frameCount, bezierCount, constraintIndex, property); } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { if (constraintIndex == -1) { var value:Float = time >= frames[0] ? getCurveValue(time) : 0; for (constraint in skeleton.physics) { @@ -62,9 +61,9 @@ abstract class PhysicsConstraintTimeline extends ConstraintTimeline1 { } } - abstract public function get (pose: PhysicsConstraintPose):Float; + abstract public function get(pose:PhysicsConstraintPose):Float; - abstract public function set (pose: PhysicsConstraintPose, value:Float):Void; + abstract public function set(pose:PhysicsConstraintPose, value:Float):Void; - abstract public function global (constraint: PhysicsConstraintData):Bool; + abstract public function global(constraint:PhysicsConstraintData):Bool; } diff --git a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintWindTimeline.hx b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintWindTimeline.hx index 37590d5bb..a3cd7e117 100644 --- a/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintWindTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/PhysicsConstraintWindTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,16 +35,15 @@ class PhysicsConstraintWindTimeline extends PhysicsConstraintTimeline { super(frameCount, bezierCount, constraintIndex, Property.physicsConstraintWind); } - public function get (pose: PhysicsConstraintPose):Float { + public function get(pose:PhysicsConstraintPose):Float { return pose.wind; } - public function set (pose: PhysicsConstraintPose, value:Float):Void { + public function set(pose:PhysicsConstraintPose, value:Float):Void { pose.wind = value; } - public function global (constraint: PhysicsConstraintData):Bool { + public function global(constraint:PhysicsConstraintData):Bool { return constraint.windGlobal; } - } diff --git a/spine-haxe/spine-haxe/spine/animation/Property.hx b/spine-haxe/spine-haxe/spine/animation/Property.hx index 3a99febf8..306e989e7 100644 --- a/spine-haxe/spine-haxe/spine/animation/Property.hx +++ b/spine-haxe/spine-haxe/spine/animation/Property.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -72,4 +72,4 @@ enum abstract Property(String) from String to String { var sliderTime = "29"; var sliderMix = "30"; -} \ No newline at end of file +} diff --git a/spine-haxe/spine-haxe/spine/animation/RGB2Timeline.hx b/spine-haxe/spine-haxe/spine/animation/RGB2Timeline.hx index 6cba8d6e2..b79b692d5 100644 --- a/spine-haxe/spine-haxe/spine/animation/RGB2Timeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/RGB2Timeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -40,9 +40,7 @@ class RGB2Timeline extends SlotCurveTimeline { private static inline var B2:Int = 6; public function new(frameCount:Int, bezierCount:Int, slotIndex:Int) { - super(frameCount, bezierCount, slotIndex, - Property.rgb + "|" + slotIndex, - Property.rgb2 + "|" + slotIndex); + super(frameCount, bezierCount, slotIndex, Property.rgb + "|" + slotIndex, Property.rgb2 + "|" + slotIndex); } public override function getFrameEntries():Int { @@ -63,7 +61,7 @@ class RGB2Timeline extends SlotCurveTimeline { frames[frame + B2] = b2; } - public function apply1 (slot:Slot, pose:SlotPose, time:Float, alpha:Float, blend:MixBlend) { + public function apply1(slot:Slot, pose:SlotPose, time:Float, alpha:Float, blend:MixBlend) { var light:Color = pose.color, dark:Color = pose.darkColor; if (time < frames[0]) { var setup = slot.data.setup; diff --git a/spine-haxe/spine-haxe/spine/animation/RGBA2Timeline.hx b/spine-haxe/spine-haxe/spine/animation/RGBA2Timeline.hx index 26f5d37f1..e1ce8fea2 100644 --- a/spine-haxe/spine-haxe/spine/animation/RGBA2Timeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/RGBA2Timeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -41,11 +41,13 @@ class RGBA2Timeline extends SlotCurveTimeline { private static inline var B2:Int = 7; public function new(frameCount:Int, bezierCount:Int, slotIndex:Int) { - super(frameCount, bezierCount, slotIndex, - Property.rgb + "|" + slotIndex, - Property.alpha + "|" + slotIndex, - Property.rgb2 + "|" + slotIndex - ); + super(frameCount, bezierCount, slotIndex, Property.rgb + + "|" + + slotIndex, Property.alpha + + "|" + + slotIndex, Property.rgb2 + + "|" + + slotIndex); } public override function getFrameEntries():Int { @@ -67,7 +69,7 @@ class RGBA2Timeline extends SlotCurveTimeline { frames[frame + B2] = b2; } - public function apply1 (slot:Slot, pose:SlotPose, time:Float, alpha:Float, blend:MixBlend) { + public function apply1(slot:Slot, pose:SlotPose, time:Float, alpha:Float, blend:MixBlend) { var light = pose.color, dark = pose.darkColor; if (time < frames[0]) { var setup = slot.data.setup; diff --git a/spine-haxe/spine-haxe/spine/animation/RGBATimeline.hx b/spine-haxe/spine-haxe/spine/animation/RGBATimeline.hx index f51ac1039..9b65dd6a6 100644 --- a/spine-haxe/spine-haxe/spine/animation/RGBATimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/RGBATimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -38,9 +38,7 @@ class RGBATimeline extends SlotCurveTimeline { private static inline var A:Int = 4; public function new(frameCount:Int, bezierCount:Int, slotIndex:Int) { - super(frameCount, bezierCount, slotIndex, - Property.rgb + "|" + slotIndex, - Property.alpha + "|" + slotIndex); + super(frameCount, bezierCount, slotIndex, Property.rgb + "|" + slotIndex, Property.alpha + "|" + slotIndex); } public override function getFrameEntries():Int { @@ -59,7 +57,7 @@ class RGBATimeline extends SlotCurveTimeline { frames[frame + A] = a; } - public function apply1 (slot:Slot, pose:SlotPose, time:Float, alpha:Float, blend:MixBlend) { + public function apply1(slot:Slot, pose:SlotPose, time:Float, alpha:Float, blend:MixBlend) { var color = pose.color; if (time < frames[0]) { var setup:Color = slot.data.setup.color; diff --git a/spine-haxe/spine-haxe/spine/animation/RGBTimeline.hx b/spine-haxe/spine-haxe/spine/animation/RGBTimeline.hx index e4a9d7fbc..84fd65611 100644 --- a/spine-haxe/spine-haxe/spine/animation/RGBTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/RGBTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -55,7 +55,7 @@ class RGBTimeline extends SlotCurveTimeline { frames[frame + B] = b; } - public function apply1 (slot:Slot, pose:SlotPose, time:Float, alpha:Float, blend:MixBlend) { + public function apply1(slot:Slot, pose:SlotPose, time:Float, alpha:Float, blend:MixBlend) { var color = pose.color; if (time < frames[0]) { var setup = slot.data.setup.color; diff --git a/spine-haxe/spine-haxe/spine/animation/RotateTimeline.hx b/spine-haxe/spine-haxe/spine/animation/RotateTimeline.hx index 6ab957401..ab44ad827 100644 --- a/spine-haxe/spine-haxe/spine/animation/RotateTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/RotateTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -36,7 +36,7 @@ class RotateTimeline extends BoneTimeline1 { this.boneIndex = boneIndex; } - public function apply1 (pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection):Void { + public function apply1(pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection):Void { pose.rotation = getRelativeValue(time, alpha, blend, pose.rotation, setup.rotation); } } diff --git a/spine-haxe/spine-haxe/spine/animation/ScaleTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ScaleTimeline.hx index 381d94f1c..26d618189 100644 --- a/spine-haxe/spine-haxe/spine/animation/ScaleTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/ScaleTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -40,7 +40,7 @@ class ScaleTimeline extends BoneTimeline2 { super(frameCount, bezierCount, boneIndex, Property.scaleX, Property.scaleY); } - public function apply1 (pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { + public function apply1(pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { if (time < frames[0]) { switch (blend) { case MixBlend.setup: diff --git a/spine-haxe/spine-haxe/spine/animation/ScaleXTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ScaleXTimeline.hx index 6352e2182..7d85d58c3 100644 --- a/spine-haxe/spine-haxe/spine/animation/ScaleXTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/ScaleXTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,7 +35,7 @@ class ScaleXTimeline extends BoneTimeline1 { super(frameCount, bezierCount, boneIndex, Property.scaleX); } - public function apply1 (pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { + public function apply1(pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { pose.scaleX = getScaleValue(time, alpha, blend, direction, pose.scaleX, setup.scaleX); } } diff --git a/spine-haxe/spine-haxe/spine/animation/ScaleYTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ScaleYTimeline.hx index 63b384a7a..92274794b 100644 --- a/spine-haxe/spine-haxe/spine/animation/ScaleYTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/ScaleYTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,7 +35,7 @@ class ScaleYTimeline extends BoneTimeline1 { super(frameCount, bezierCount, boneIndex, Property.scaleY); } - public function apply1 (pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { + public function apply1(pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { pose.scaleY = getScaleValue(time, alpha, blend, direction, pose.scaleY, setup.scaleY); } } diff --git a/spine-haxe/spine-haxe/spine/animation/SequenceTimeline.hx b/spine-haxe/spine-haxe/spine/animation/SequenceTimeline.hx index fca8b29f6..3ce3b49ad 100644 --- a/spine-haxe/spine-haxe/spine/animation/SequenceTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/SequenceTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -42,8 +42,7 @@ class SequenceTimeline extends Timeline implements SlotTimeline { var attachment:HasTextureRegion; public function new(frameCount:Int, slotIndex:Int, attachment:HasTextureRegion) { - super(frameCount, - Std.string(Property.sequence) + "|" + Std.string(slotIndex) + "|" + Std.string(attachment.sequence.id)); + super(frameCount, Std.string(Property.sequence) + "|" + Std.string(slotIndex) + "|" + Std.string(attachment.sequence.id)); this.slotIndex = slotIndex; this.attachment = attachment; } @@ -70,11 +69,11 @@ class SequenceTimeline extends Timeline implements SlotTimeline { frames[frame + SequenceTimeline.DELAY] = delay; } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var slot = skeleton.slots[this.slotIndex]; - if (!slot.bone.active) return; + if (!slot.bone.active) + return; var pose = appliedPose ? slot.applied : slot.pose; var slotAttachment = pose.attachment; @@ -85,12 +84,14 @@ class SequenceTimeline extends Timeline implements SlotTimeline { } if (direction == MixDirection.mixOut) { - if (blend == MixBlend.setup) pose.sequenceIndex = -1; + if (blend == MixBlend.setup) + pose.sequenceIndex = -1; return; } if (time < frames[0]) { - if (blend == MixBlend.setup || blend == MixBlend.first) pose.sequenceIndex = -1; + if (blend == MixBlend.setup || blend == MixBlend.first) + pose.sequenceIndex = -1; return; } diff --git a/spine-haxe/spine-haxe/spine/animation/ShearTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ShearTimeline.hx index a2fb42c5c..929e5b87c 100644 --- a/spine-haxe/spine-haxe/spine/animation/ShearTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/ShearTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,7 +35,7 @@ class ShearTimeline extends BoneTimeline2 { super(frameCount, bezierCount, boneIndex, Property.shearX, Property.shearY); } - public function apply1 (pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { + public function apply1(pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { if (time < frames[0]) { switch (blend) { case MixBlend.setup: diff --git a/spine-haxe/spine-haxe/spine/animation/ShearXTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ShearXTimeline.hx index 1d37533b5..17498802b 100644 --- a/spine-haxe/spine-haxe/spine/animation/ShearXTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/ShearXTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,7 +35,7 @@ class ShearXTimeline extends BoneTimeline1 { super(frameCount, bezierCount, boneIndex, Property.shearX); } - public function apply1 (pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { + public function apply1(pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { pose.shearX = getRelativeValue(time, alpha, blend, pose.shearX, setup.shearX); } } diff --git a/spine-haxe/spine-haxe/spine/animation/ShearYTimeline.hx b/spine-haxe/spine-haxe/spine/animation/ShearYTimeline.hx index ea046c054..f77e408bd 100644 --- a/spine-haxe/spine-haxe/spine/animation/ShearYTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/ShearYTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,7 +35,7 @@ class ShearYTimeline extends BoneTimeline1 { super(frameCount, bezierCount, boneIndex, Property.shearY); } - public function apply1 (pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { + public function apply1(pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { pose.shearY = getRelativeValue(time, alpha, blend, pose.shearY, setup.shearY); } } diff --git a/spine-haxe/spine-haxe/spine/animation/SliderMixTimeline.hx b/spine-haxe/spine-haxe/spine/animation/SliderMixTimeline.hx index 5468e0532..afbfb16eb 100644 --- a/spine-haxe/spine-haxe/spine/animation/SliderMixTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/SliderMixTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -33,13 +33,12 @@ import haxe.macro.Type.VarAccess; /** Changes a slider's spine.SliderPose.mix. */ class SliderMixTimeline extends ConstraintTimeline1 { - public function new (frameCount:Int, bezierCount:Int, constraintIndex:Int) { + public function new(frameCount:Int, bezierCount:Int, constraintIndex:Int) { super(frameCount, bezierCount, constraintIndex, Property.sliderMix); } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var constraint = cast(skeleton.constraints[constraintIndex], Slider); if (constraint.active) { var pose = appliedPose ? constraint.applied : constraint.pose; diff --git a/spine-haxe/spine-haxe/spine/animation/SliderTimeline.hx b/spine-haxe/spine-haxe/spine/animation/SliderTimeline.hx index eb80803b5..4815365ba 100644 --- a/spine-haxe/spine-haxe/spine/animation/SliderTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/SliderTimeline.hx @@ -25,19 +25,18 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; /** Changes a slider's spine.SliderPose.time. */ class SliderTimeline extends ConstraintTimeline1 { - public function new (frameCount:Int, bezierCount:Int, constraintIndex:Int) { + public function new(frameCount:Int, bezierCount:Int, constraintIndex:Int) { super(frameCount, bezierCount, constraintIndex, Property.sliderTime); } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var constraint = cast(skeleton.constraints[constraintIndex], Slider); if (constraint.active) { var pose = appliedPose ? constraint.applied : constraint.pose; diff --git a/spine-haxe/spine-haxe/spine/animation/SlotCurveTimeline.hx b/spine-haxe/spine-haxe/spine/animation/SlotCurveTimeline.hx index 226a901e9..303f71600 100644 --- a/spine-haxe/spine-haxe/spine/animation/SlotCurveTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/SlotCurveTimeline.hx @@ -25,28 +25,28 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; abstract class SlotCurveTimeline extends CurveTimeline implements SlotTimeline { public final slotIndex:Int; - public function new (frameCount:Int, bezierCount:Int, slotIndex:Int, propertyIds:...String) { + public function new(frameCount:Int, bezierCount:Int, slotIndex:Int, propertyIds:...String) { super(frameCount, bezierCount, ...propertyIds); this.slotIndex = slotIndex; } - public function getSlotIndex () { + public function getSlotIndex() { return slotIndex; } - public function apply (skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, - direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var slot = skeleton.slots[slotIndex]; - if (slot.bone.active) apply1(slot, appliedPose ? slot.applied : slot.pose, time, alpha, blend); + if (slot.bone.active) + apply1(slot, appliedPose ? slot.applied : slot.pose, time, alpha, blend); } - abstract function apply1 (slot:Slot, pose:SlotPose, time:Float, alpha:Float, blend:MixBlend):Void; + abstract function apply1(slot:Slot, pose:SlotPose, time:Float, alpha:Float, blend:MixBlend):Void; } diff --git a/spine-haxe/spine-haxe/spine/animation/SlotTimeline.hx b/spine-haxe/spine-haxe/spine/animation/SlotTimeline.hx index c98cdca26..9014828cf 100644 --- a/spine-haxe/spine-haxe/spine/animation/SlotTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/SlotTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; diff --git a/spine-haxe/spine-haxe/spine/animation/Timeline.hx b/spine-haxe/spine-haxe/spine/animation/Timeline.hx index 10f02a60e..080bd0ca4 100644 --- a/spine-haxe/spine-haxe/spine/animation/Timeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/Timeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -36,6 +36,7 @@ import spine.Skeleton; abstract class Timeline { /** Uniquely encodes both the type of this timeline and the skeleton properties that it affects. */ public var propertyIds:Array; + /** The time in seconds and any other values for each frame. */ public var frames:Array; @@ -83,8 +84,8 @@ abstract class Timeline { * @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions, * such as spine.animation.DrawOrderTimeline or spine.animation.AttachmentTimeline, and others such as spine.animation.ScaleTimeline. * @param appliedPose True to to modify the applied pose. */ - abstract public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool):Void; + abstract public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool):Void; /** Linear search using a stride of 1. * @param time Must be >= the first value in frames. diff --git a/spine-haxe/spine-haxe/spine/animation/TrackEntry.hx b/spine-haxe/spine-haxe/spine/animation/TrackEntry.hx index 26d8fec74..6023b6c67 100644 --- a/spine-haxe/spine-haxe/spine/animation/TrackEntry.hx +++ b/spine-haxe/spine-haxe/spine/animation/TrackEntry.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -38,34 +38,43 @@ import spine.Poolable; class TrackEntry implements Poolable { /** The animation to apply for this track entry. */ public var animation:Animation; + /** The animation queued to start after this animation, or null if there is none. next makes up a doubly linked * list. * * See spine.animation.AnimationState.clearNext(TrackEntry) to truncate the list. */ public var next:TrackEntry; + /** The animation queued to play before this animation, or null. previous makes up a doubly linked list. */ public var previous:TrackEntry; + /** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no * mixing is currently occurring. When mixing from multiple animations, mixingFrom makes up a linked list. */ public var mixingFrom:TrackEntry; + /** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is * currently occurring. When mixing to multiple animations, mixingTo makes up a linked list. */ public var mixingTo:TrackEntry; + public var onStart:Listeners = new Listeners(); public var onInterrupt:Listeners = new Listeners(); public var onEnd:Listeners = new Listeners(); public var onDispose:Listeners = new Listeners(); public var onComplete:Listeners = new Listeners(); public var onEvent:EventListeners = new EventListeners(); + /** The index of the track where this track entry is either current or queued. * * See spine.animation.AnimationState.getCurrent(int). */ public var trackIndex:Int = 0; + /** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its * duration. */ public var loop:Bool = false; + /** If true, the animation will be applied in reverse. Events are not fired when an animation is applied in reverse. */ public var reverse:Bool = false; + /** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead * of being mixed out. * @@ -78,55 +87,65 @@ class TrackEntry implements Poolable { * Snapping will occur if holdPrevious is true and this animation does not key all the same properties as the * previous animation. */ public var holdPrevious:Bool = false; + /** When the mix percentage (TrackEntry.getMixTime() / TrackEntry.getMixDuration()) is less than the * eventThreshold, event timelines are applied while this animation is being mixed out. Defaults to 0, so event * timelines are not applied while this animation is being mixed out. */ public var eventThreshold:Float = 0; + /** When the mix percentage (TrackEntry.getMixTime() / TrackEntry.getMixDuration()) is less than the * mixAttachmentThreshold, attachment timelines are applied while this animation is being mixed out. Defaults * to 0, so attachment timelines are not applied while this animation is being mixed out. */ public var mixAttachmentThreshold:Float = 0; + /** When TrackEntry.getAlpha() is greater than alphaAttachmentThreshold, attachment timelines are applied. * Defaults to 0, so attachment timelines are always applied. */ public var alphaAttachmentThreshold:Float = 0; + /** When the mix percentage (TrackEntry.getMixTime() / TrackEntry.getMixDuration()) is less than the * mixDrawOrderThreshold, draw order timelines are applied while this animation is being mixed out. Defaults to * 0, so draw order timelines are not applied while this animation is being mixed out. */ public var mixDrawOrderThreshold:Float = 0; + /** Seconds when this animation starts, both initially and after looping. Defaults to 0. * * When changing the animationStart time, it often makes sense to set TrackEntry.getAnimationLast() to the same * value to prevent timeline keys before the start time from triggering. */ public var animationStart:Float = 0; + /** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will * loop back to TrackEntry.getAnimationStart() at this time. Defaults to the animation spine.animation.Animation.duration. */ public var animationEnd:Float = 0; + /** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this * animation is applied, event timelines will fire all events between the animationLast time (exclusive) and * animationTime (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation * is applied. */ public var animationLast:Float = 0; + public var nextAnimationLast:Float = 0; /** Seconds to postpone playing the animation. Must be >= 0. When this track entry is the current track entry, - * delay postpones incrementing the TrackEntry.getTrackTime(). When this track entry is queued, - * delay is the time from the start of the previous animation to when this track entry will become the current - * track entry (ie when the previous track entry TrackEntry.getTrackTime() >= this track entry's - * delay). - * - * TrackEntry.getTimeScale() affects the delay. - * - * When passing delay <= 0 to spine.animation.AnimationState.addAnimation(int, Animation, boolean, float) this - * delay is set using a mix duration from spine.animation.AnimationStateData. To change the TrackEntry.getMixDuration() - * afterward, use TrackEntry.setMixDuration(float, float) so this delay is adjusted. */ + * delay postpones incrementing the TrackEntry.getTrackTime(). When this track entry is queued, + * delay is the time from the start of the previous animation to when this track entry will become the current + * track entry (ie when the previous track entry TrackEntry.getTrackTime() >= this track entry's + * delay). + * + * TrackEntry.getTimeScale() affects the delay. + * + * When passing delay <= 0 to spine.animation.AnimationState.addAnimation(int, Animation, boolean, float) this + * delay is set using a mix duration from spine.animation.AnimationStateData. To change the TrackEntry.getMixDuration() + * afterward, use TrackEntry.setMixDuration(float, float) so this delay is adjusted. */ public var delay(default, set):Float = 0; /** Current time in seconds this track entry has been the current track entry. The track time determines * TrackEntry.getAnimationTime(). The track time can be set to start the animation at a time other than 0, without affecting * looping. */ public var trackTime:Float = 0; + public var trackLast:Float = 0; public var nextTrackLast:Float = 0; + /** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float * value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time * is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the @@ -135,6 +154,7 @@ class TrackEntry implements Poolable { * It may be desired to use spine.animation.AnimationState.addEmptyAnimation(int, float, float) rather than have the animation * abruptly cease being applied. */ public var trackEnd:Float = 0; + /** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or * faster. Defaults to 1. * @@ -149,15 +169,18 @@ class TrackEntry implements Poolable { * * See AnimationState spine.animation.AnimationState.getTimeScale() for affecting all animations. */ public var timeScale:Float = 0; + /** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults * to 1, which overwrites the skeleton's current pose with this animation. * * Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to * use alpha on track 0 if the skeleton pose is from the last frame render. */ public var alpha:Float = 0; + /** Seconds from 0 to the TrackEntry.getMixDuration() when mixing from the previous animation to this animation. May be * slightly more than mixDuration when the mix is complete. */ public var mixTime:Float = 0; + /** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData * spine.animation.AnimationStateData.getMix(Animation, Animation) based on the animation before this animation (if any). * @@ -176,8 +199,10 @@ class TrackEntry implements Poolable { * Alternatively, TrackEntry.setMixDuration(float, float) can be used to recompute the delay: * entry.setMixDuration(0.25f, 0); */ public var mixDuration:Float = 0; + public var interruptAlpha:Float = 0; public var totalAlpha:Float = 0; + /** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to spine.animation.MixBlend.replace. * * Track entries on track 0 ignore this setting and always use spine.animation.MixBlend.first. @@ -185,9 +210,11 @@ class TrackEntry implements Poolable { * The mixBlend can be set for a new track entry only before spine.animation.AnimationState.apply(Skeleton) is first * called. */ public var mixBlend:MixBlend = MixBlend.replace; + public var timelineMode:Array = new Array(); public var timelineHoldMix:Array = new Array(); public var timelinesRotation:Array = new Array(); + /** If true, mixing rotation between tracks always uses the shortest rotation direction. If the rotation is animated, the * shortest rotation direction may change during the mix. * @@ -196,7 +223,8 @@ class TrackEntry implements Poolable { public var shortestRotation = false; function set_delay(delay:Float):Float { - if (delay < 0) throw new SpineException("delay must be >= 0."); + if (delay < 0) + throw new SpineException("delay must be >= 0."); return this.delay = delay; } @@ -240,7 +268,7 @@ class TrackEntry implements Poolable { } /** Returns true if there is a TrackEntry.getNext() track entry and it will become the current track entry during the next - * spine.animation.AnimationState.update(float). */ + * spine.animation.AnimationState.update(float). */ public function isNextReady():Bool { return next != null && nextTrackLast - next.delay >= 0; } diff --git a/spine-haxe/spine-haxe/spine/animation/TransformConstraintTimeline.hx b/spine-haxe/spine-haxe/spine/animation/TransformConstraintTimeline.hx index 37b085555..2a86c303a 100644 --- a/spine-haxe/spine-haxe/spine/animation/TransformConstraintTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/TransformConstraintTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -54,7 +54,7 @@ class TransformConstraintTimeline extends CurveTimeline implements ConstraintTim return ENTRIES; } - public function getConstraintIndex () { + public function getConstraintIndex() { return constraintIndex; } @@ -72,11 +72,11 @@ class TransformConstraintTimeline extends CurveTimeline implements ConstraintTim frames[frame + SHEARY] = mixShearY; } - public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, - blend:MixBlend, direction:MixDirection, appliedPose:Bool) { - + public function apply(skeleton:Skeleton, lastTime:Float, time:Float, events:Array, alpha:Float, blend:MixBlend, direction:MixDirection, + appliedPose:Bool) { var constraint = cast(skeleton.constraints[constraintIndex], TransformConstraint); - if (!constraint.active) return; + if (!constraint.active) + return; var pose = appliedPose ? constraint.applied : constraint.pose; if (time < frames[0]) { diff --git a/spine-haxe/spine-haxe/spine/animation/TranslateTimeline.hx b/spine-haxe/spine-haxe/spine/animation/TranslateTimeline.hx index 14f9afc32..1ee08c6f6 100644 --- a/spine-haxe/spine-haxe/spine/animation/TranslateTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/TranslateTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -39,7 +39,7 @@ class TranslateTimeline extends BoneTimeline2 { super(frameCount, bezierCount, boneIndex, Property.x, Property.y); } - public function apply1 (pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection):Void { + public function apply1(pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection):Void { if (time < frames[0]) { switch (blend) { case MixBlend.setup: diff --git a/spine-haxe/spine-haxe/spine/animation/TranslateXTimeline.hx b/spine-haxe/spine-haxe/spine/animation/TranslateXTimeline.hx index 898d30423..f07535ef0 100644 --- a/spine-haxe/spine-haxe/spine/animation/TranslateXTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/TranslateXTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -40,7 +40,7 @@ class TranslateXTimeline extends BoneTimeline1 { this.boneIndex = boneIndex; } - public function apply1 (pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { + public function apply1(pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { pose.x = getRelativeValue(time, alpha, blend, pose.x, setup.x); } } diff --git a/spine-haxe/spine-haxe/spine/animation/TranslateYTimeline.hx b/spine-haxe/spine-haxe/spine/animation/TranslateYTimeline.hx index c85fe9e53..915bb62fb 100644 --- a/spine-haxe/spine-haxe/spine/animation/TranslateYTimeline.hx +++ b/spine-haxe/spine-haxe/spine/animation/TranslateYTimeline.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.animation; @@ -35,7 +35,7 @@ class TranslateYTimeline extends BoneTimeline1 { super(frameCount, bezierCount, boneIndex, Property.y); } - public function apply1 (pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { + public function apply1(pose:BoneLocal, setup:BoneLocal, time:Float, alpha:Float, blend:MixBlend, direction:MixDirection) { pose.y = getRelativeValue(time, alpha, blend, pose.y, setup.y); } } diff --git a/spine-haxe/spine-haxe/spine/atlas/Format.hx b/spine-haxe/spine-haxe/spine/atlas/Format.hx index 1049e7f30..92658dd1d 100644 --- a/spine-haxe/spine-haxe/spine/atlas/Format.hx +++ b/spine-haxe/spine-haxe/spine/atlas/Format.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.atlas; diff --git a/spine-haxe/spine-haxe/spine/atlas/TextureAtlas.hx b/spine-haxe/spine-haxe/spine/atlas/TextureAtlas.hx index d7c0e66bd..c138e97f3 100644 --- a/spine-haxe/spine-haxe/spine/atlas/TextureAtlas.hx +++ b/spine-haxe/spine-haxe/spine/atlas/TextureAtlas.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.atlas; diff --git a/spine-haxe/spine-haxe/spine/atlas/TextureAtlasPage.hx b/spine-haxe/spine-haxe/spine/atlas/TextureAtlasPage.hx index 07ea222d1..aa4e087ff 100644 --- a/spine-haxe/spine-haxe/spine/atlas/TextureAtlasPage.hx +++ b/spine-haxe/spine-haxe/spine/atlas/TextureAtlasPage.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.atlas; diff --git a/spine-haxe/spine-haxe/spine/atlas/TextureAtlasRegion.hx b/spine-haxe/spine-haxe/spine/atlas/TextureAtlasRegion.hx index ee93de1f1..450447cc3 100644 --- a/spine-haxe/spine-haxe/spine/atlas/TextureAtlasRegion.hx +++ b/spine-haxe/spine-haxe/spine/atlas/TextureAtlasRegion.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.atlas; diff --git a/spine-haxe/spine-haxe/spine/atlas/TextureFilter.hx b/spine-haxe/spine-haxe/spine/atlas/TextureFilter.hx index 00dfe54d9..a3d29f53c 100644 --- a/spine-haxe/spine-haxe/spine/atlas/TextureFilter.hx +++ b/spine-haxe/spine-haxe/spine/atlas/TextureFilter.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.atlas; diff --git a/spine-haxe/spine-haxe/spine/atlas/TextureLoader.hx b/spine-haxe/spine-haxe/spine/atlas/TextureLoader.hx index 04fd792bb..ccef44d05 100644 --- a/spine-haxe/spine-haxe/spine/atlas/TextureLoader.hx +++ b/spine-haxe/spine-haxe/spine/atlas/TextureLoader.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.atlas; diff --git a/spine-haxe/spine-haxe/spine/atlas/TextureWrap.hx b/spine-haxe/spine-haxe/spine/atlas/TextureWrap.hx index 014278e63..ef4692dc1 100644 --- a/spine-haxe/spine-haxe/spine/atlas/TextureWrap.hx +++ b/spine-haxe/spine-haxe/spine/atlas/TextureWrap.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.atlas; diff --git a/spine-haxe/spine-haxe/spine/attachments/AtlasAttachmentLoader.hx b/spine-haxe/spine-haxe/spine/attachments/AtlasAttachmentLoader.hx index b9e7a7e04..047c37924 100644 --- a/spine-haxe/spine-haxe/spine/attachments/AtlasAttachmentLoader.hx +++ b/spine-haxe/spine-haxe/spine/attachments/AtlasAttachmentLoader.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.attachments; diff --git a/spine-haxe/spine-haxe/spine/attachments/Attachment.hx b/spine-haxe/spine-haxe/spine/attachments/Attachment.hx index 81e3a7665..442bc7dff 100644 --- a/spine-haxe/spine-haxe/spine/attachments/Attachment.hx +++ b/spine-haxe/spine-haxe/spine/attachments/Attachment.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.attachments; diff --git a/spine-haxe/spine-haxe/spine/attachments/AttachmentLoader.hx b/spine-haxe/spine-haxe/spine/attachments/AttachmentLoader.hx index 147e124bb..ec4262e4f 100644 --- a/spine-haxe/spine-haxe/spine/attachments/AttachmentLoader.hx +++ b/spine-haxe/spine-haxe/spine/attachments/AttachmentLoader.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.attachments; diff --git a/spine-haxe/spine-haxe/spine/attachments/AttachmentType.hx b/spine-haxe/spine-haxe/spine/attachments/AttachmentType.hx index 52ca24857..ead1a92fa 100644 --- a/spine-haxe/spine-haxe/spine/attachments/AttachmentType.hx +++ b/spine-haxe/spine-haxe/spine/attachments/AttachmentType.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.attachments; diff --git a/spine-haxe/spine-haxe/spine/attachments/BoundingBoxAttachment.hx b/spine-haxe/spine-haxe/spine/attachments/BoundingBoxAttachment.hx index e799a6b4b..023d5c58a 100644 --- a/spine-haxe/spine-haxe/spine/attachments/BoundingBoxAttachment.hx +++ b/spine-haxe/spine-haxe/spine/attachments/BoundingBoxAttachment.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.attachments; diff --git a/spine-haxe/spine-haxe/spine/attachments/ClippingAttachment.hx b/spine-haxe/spine-haxe/spine/attachments/ClippingAttachment.hx index c2ff9604f..8d4022836 100644 --- a/spine-haxe/spine-haxe/spine/attachments/ClippingAttachment.hx +++ b/spine-haxe/spine-haxe/spine/attachments/ClippingAttachment.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.attachments; @@ -37,6 +37,7 @@ class ClippingAttachment extends VertexAttachment { /** Clipping is performed between the clipping attachment's slot and the end slot. If null clipping is done until the end of * the skeleton's rendering. */ public var endSlot:SlotData; + /** The color of the clipping attachment as it was in Spine, or a default color if nonessential data was not exported. Clipping * attachments are not usually rendered at runtime. */ public var color:Color = new Color(0.2275, 0.2275, 0.2275, 1); diff --git a/spine-haxe/spine-haxe/spine/attachments/MeshAttachment.hx b/spine-haxe/spine-haxe/spine/attachments/MeshAttachment.hx index 14e483d83..31d0285fa 100644 --- a/spine-haxe/spine-haxe/spine/attachments/MeshAttachment.hx +++ b/spine-haxe/spine-haxe/spine/attachments/MeshAttachment.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.attachments; @@ -40,23 +40,32 @@ import spine.atlas.TextureAtlasPage; class MeshAttachment extends VertexAttachment implements HasTextureRegion { public var region:TextureRegion; public var path:String; + /** The UV pair for each vertex, normalized within the texture region. */ public var regionUVs = new Array(); + /** The UV pair for each vertex, normalized within the entire texture. * See #updateRegion(). */ public var uvs = new Array(); + /** Triplets of vertex indices which describe the mesh's triangulation. */ public var triangles = new Array(); + public var color:Color = new Color(1, 1, 1, 1); + /** The width of the mesh's image, or zero if nonessential data was not exported. */ public var width:Float = 0; + /** The height of the mesh's image, or zero if nonessential data was not exported. */ public var height:Float = 0; + /** The number of entries at the beginning of #vertices that make up the mesh hull. */ public var hullLength:Int = 0; + /** Vertex index pairs describing edges for controlling triangulation, or null if nonessential data was not exported. Mesh * triangles will never cross edges. Triangulation is not performed at runtime. */ public var edges = new Array(); + public var rendererObject:Dynamic; public var sequence:Sequence; @@ -86,7 +95,8 @@ class MeshAttachment extends VertexAttachment implements HasTextureRegion { var n = uvs.length; var u = region.u, v = region.v, width:Float = 0, height:Float = 0; if (Std.isOfType(region, TextureAtlasRegion)) { - var atlasRegion:TextureAtlasRegion = cast(region, TextureAtlasRegion), page:TextureAtlasPage = atlasRegion.page; + var atlasRegion:TextureAtlasRegion = cast(region, TextureAtlasRegion), + page:TextureAtlasPage = atlasRegion.page; var textureWidth = page.width, textureHeight = page.height; switch (atlasRegion.degrees) { case 90: diff --git a/spine-haxe/spine-haxe/spine/attachments/PathAttachment.hx b/spine-haxe/spine-haxe/spine/attachments/PathAttachment.hx index 1843d4ccb..d007080fc 100644 --- a/spine-haxe/spine-haxe/spine/attachments/PathAttachment.hx +++ b/spine-haxe/spine-haxe/spine/attachments/PathAttachment.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.attachments; @@ -39,11 +39,14 @@ import spine.Color; class PathAttachment extends VertexAttachment { /** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */ public var lengths:Array; + /** If true, the start and end knots are connected. */ public var closed:Bool = false; + /** If true, additional calculations are performed to make computing positions along the path more accurate and movement along * the path have a constant speed. */ public var constantSpeed:Bool = false; + /** The color of the path as it was in Spine, or a default color if nonessential data was not exported. Paths are not usually * rendered at runtime. */ public var color:Color = new Color(0, 0, 0, 0); diff --git a/spine-haxe/spine-haxe/spine/attachments/PointAttachment.hx b/spine-haxe/spine-haxe/spine/attachments/PointAttachment.hx index 6e5872e66..7c1b677aa 100644 --- a/spine-haxe/spine-haxe/spine/attachments/PointAttachment.hx +++ b/spine-haxe/spine-haxe/spine/attachments/PointAttachment.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.attachments; @@ -42,6 +42,7 @@ class PointAttachment extends VertexAttachment { public var x:Float = 0; public var y:Float = 0; public var rotation:Float = 0; + /** The color of the point attachment as it was in Spine, or a default color if nonessential data was not exported. Point * attachments are not usually rendered at runtime. */ public var color:Color = new Color(0.38, 0.94, 0, 1); @@ -58,7 +59,9 @@ class PointAttachment extends VertexAttachment { } public function computeWorldRotation(bone:BonePose):Float { - var r:Float = this.rotation * MathUtils.degRad, cos:Float = Math.cos(r), sin:Float = Math.sin(r); + var r:Float = this.rotation * MathUtils.degRad, + cos:Float = Math.cos(r), + sin:Float = Math.sin(r); var x:Float = cos * bone.a + sin * bone.b; var y:Float = cos * bone.c + sin * bone.d; return MathUtils.atan2Deg(y, x); diff --git a/spine-haxe/spine-haxe/spine/attachments/RegionAttachment.hx b/spine-haxe/spine-haxe/spine/attachments/RegionAttachment.hx index cb1a867e1..332647118 100644 --- a/spine-haxe/spine-haxe/spine/attachments/RegionAttachment.hx +++ b/spine-haxe/spine-haxe/spine/attachments/RegionAttachment.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.attachments; @@ -47,18 +47,25 @@ class RegionAttachment extends Attachment implements HasTextureRegion { /** The local x translation. */ public var x:Float = 0; + /** The local y translation. */ public var y:Float = 0; + /** The local scaleX. */ public var scaleX:Float = 1; + /** The local scaleY. */ public var scaleY:Float = 1; + /** The local rotation. */ public var rotation:Float = 0; + /** The width of the region attachment in Spine. */ public var width:Float = 0; + /** The height of the region attachment in Spine. */ public var height:Float = 0; + public var color:Color = new Color(1, 1, 1, 1); public var path:String; public var rendererObject:Dynamic; @@ -150,7 +157,8 @@ class RegionAttachment extends Attachment implements HasTextureRegion { * @param offset The worldVertices index to begin writing values. * @param stride The number of worldVertices entries between the value pairs written. */ public function computeWorldVertices(slot:Slot, worldVertices:Array, offset:Int, stride:Int):Void { - if (sequence != null) sequence.apply(slot.applied, this); + if (sequence != null) + sequence.apply(slot.applied, this); var vertexOffset = this.offset; var bone = slot.bone.applied; diff --git a/spine-haxe/spine-haxe/spine/attachments/VertexAttachment.hx b/spine-haxe/spine-haxe/spine/attachments/VertexAttachment.hx index ffca2f6a9..ea2dfaf66 100644 --- a/spine-haxe/spine-haxe/spine/attachments/VertexAttachment.hx +++ b/spine-haxe/spine-haxe/spine/attachments/VertexAttachment.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.attachments; @@ -79,7 +79,8 @@ class VertexAttachment extends Attachment { var deform:Array = slot.applied.deform; var vertices = vertices; if (bones == null) { - if (deform.length > 0) vertices = deform; + if (deform.length > 0) + vertices = deform; var bone = slot.bone.applied; var x = bone.worldX, y = bone.worldY; var a = bone.a, b = bone.b, c = bone.c, d = bone.d; @@ -109,7 +110,9 @@ class VertexAttachment extends Attachment { n += v; while (v < n) { var bone = skeletonBones[bones[v]].applied; - var vx = vertices[b], vy = vertices[b + 1], weight = vertices[b + 2]; + var vx = vertices[b], + vy = vertices[b + 1], + weight = vertices[b + 2]; wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight; wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight; v++; @@ -127,7 +130,9 @@ class VertexAttachment extends Attachment { n += v; while (v < n) { var bone = skeletonBones[bones[v]].applied; - var vx = vertices[b] + deform[f], vy = vertices[b + 1] + deform[f + 1], weight = vertices[b + 2]; + var vx = vertices[b] + deform[f], + vy = vertices[b + 1] + deform[f + 1], + weight = vertices[b + 2]; wx += (vx * bone.a + vy * bone.b + bone.worldX) * weight; wy += (vx * bone.c + vy * bone.d + bone.worldY) * weight; v++; diff --git a/spine-haxe/spine-haxe/spine/flixel/FlixelTextureLoader.hx b/spine-haxe/spine-haxe/spine/flixel/FlixelTextureLoader.hx index 737fd91ad..3227e7f92 100644 --- a/spine-haxe/spine-haxe/spine/flixel/FlixelTextureLoader.hx +++ b/spine-haxe/spine-haxe/spine/flixel/FlixelTextureLoader.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.flixel; @@ -36,8 +36,7 @@ import spine.atlas.TextureAtlasRegion; import spine.atlas.TextureLoader; import spine.flixel.SpineTexture; -class FlixelTextureLoader implements TextureLoader -{ +class FlixelTextureLoader implements TextureLoader { private var basePath:String; public function new(prefix:String) { @@ -48,8 +47,7 @@ class FlixelTextureLoader implements TextureLoader } } - public function loadPage(page:TextureAtlasPage, path:String):Void - { + public function loadPage(page:TextureAtlasPage, path:String):Void { var bitmapData = openfl.utils.Assets.getBitmapData(basePath + "/" + path); if (bitmapData == null) { throw new SpineException("Could not load atlas page texture " + basePath + "/" + path); @@ -65,8 +63,7 @@ class FlixelTextureLoader implements TextureLoader region.texture = region.page.texture; } - public function unloadPage(page:TextureAtlasPage):Void - { + public function unloadPage(page:TextureAtlasPage):Void { FlxG.bitmap.remove(cast page.texture); } } diff --git a/spine-haxe/spine-haxe/spine/flixel/SkeletonMesh.hx b/spine-haxe/spine-haxe/spine/flixel/SkeletonMesh.hx index fffd5be30..461804b30 100644 --- a/spine-haxe/spine-haxe/spine/flixel/SkeletonMesh.hx +++ b/spine-haxe/spine-haxe/spine/flixel/SkeletonMesh.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.flixel; diff --git a/spine-haxe/spine-haxe/spine/flixel/SkeletonSprite.hx b/spine-haxe/spine-haxe/spine/flixel/SkeletonSprite.hx index 368de8653..7ee805b57 100644 --- a/spine-haxe/spine-haxe/spine/flixel/SkeletonSprite.hx +++ b/spine-haxe/spine-haxe/spine/flixel/SkeletonSprite.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.flixel; @@ -63,13 +63,13 @@ import spine.attachments.ClippingAttachment; import spine.flixel.SkeletonMesh; /** A FlxObject that draws a skeleton. The animation state and skeleton must be updated each frame. */ -class SkeletonSprite extends FlxObject -{ +class SkeletonSprite extends FlxObject { public var skeleton(default, null):Skeleton; public var state(default, null):AnimationState; public var stateData(default, null):AnimationStateData; - public var beforeUpdateWorldTransforms: SkeletonSprite -> Void = function(_) {}; - public var afterUpdateWorldTransforms: SkeletonSprite -> Void = function(_) {}; + public var beforeUpdateWorldTransforms:SkeletonSprite->Void = function(_) {}; + public var afterUpdateWorldTransforms:SkeletonSprite->Void = function(_) {}; + public static var clipper(default, never):SkeletonClipping = new SkeletonClipping(); public var offsetX = .0; @@ -93,9 +93,9 @@ class SkeletonSprite extends FlxObject private var _tempPoint = new Point(); private static var QUAD_INDICES:Array = [0, 1, 2, 2, 3, 0]; + /** Creates an uninitialized SkeletonSprite. The renderer, skeleton, and animation state must be set before use. */ - public function new(skeletonData:SkeletonData, animationStateData:AnimationStateData = null) - { + public function new(skeletonData:SkeletonData, animationStateData:AnimationStateData = null) { super(0, 0); Bone.yDown = true; skeleton = new Skeleton(skeletonData); @@ -114,17 +114,20 @@ class SkeletonSprite extends FlxObject } } - public function getAnimationBounds(animation:Animation, clip:Bool = true): lime.math.Rectangle { + public function getAnimationBounds(animation:Animation, clip:Bool = true):lime.math.Rectangle { var clipper = clip ? SkeletonSprite.clipper : null; skeleton.setupPose(); var steps = 100, time = 0.; var stepTime = animation.duration != 0 ? animation.duration / steps : 0; - var minX = 100000000., maxX = -100000000., minY = 100000000., maxY = -100000000.; + var minX = 100000000., + maxX = -100000000., + minY = 100000000., + maxY = -100000000.; var bounds = new lime.math.Rectangle(); for (i in 0...steps) { - animation.apply(skeleton, time , time, false, [], 1, MixBlend.setup, MixDirection.mixIn, false); + animation.apply(skeleton, time, time, false, [], 1, MixBlend.setup, MixDirection.mixIn, false); skeleton.updateWorldTransform(Physics.update); bounds = skeleton.getBounds(clipper); @@ -145,8 +148,7 @@ class SkeletonSprite extends FlxObject return bounds; } - override public function destroy():Void - { + override public function destroy():Void { state.clearListeners(); state = null; skeleton = null; @@ -157,15 +159,15 @@ class SkeletonSprite extends FlxObject _tempPoint = null; if (_meshes != null) { - for (mesh in _meshes) mesh.destroy(); + for (mesh in _meshes) + mesh.destroy(); _meshes = null; } super.destroy(); } - override public function update(elapsed:Float):Void - { + override public function update(elapsed:Float):Void { super.update(elapsed); state.update(elapsed); state.apply(skeleton); @@ -175,14 +177,15 @@ class SkeletonSprite extends FlxObject this.afterUpdateWorldTransforms(this); } - override public function draw():Void - { - if (alpha == 0) return; + override public function draw():Void { + if (alpha == 0) + return; renderMeshes(); #if FLX_DEBUG - if (FlxG.debugger.drawDebug) drawDebug(); + if (FlxG.debugger.drawDebug) + drawDebug(); #end } @@ -248,14 +251,10 @@ class SkeletonSprite extends FlxObject } if (mesh != null) { - // cannot use directly mesh.color.setRGBFloat otherwise the setter won't be called and transfor color not set - mesh.color = FlxColor.fromRGBFloat( - skeleton.color.r * pose.color.r * attachmentColor.r * color.redFloat, + mesh.color = FlxColor.fromRGBFloat(skeleton.color.r * pose.color.r * attachmentColor.r * color.redFloat, skeleton.color.g * pose.color.g * attachmentColor.g * color.greenFloat, - skeleton.color.b * pose.color.b * attachmentColor.b * color.blueFloat, - 1 - ); + skeleton.color.b * pose.color.b * attachmentColor.b * color.blueFloat, 1); mesh.alpha = skeleton.color.a * pose.color.a * attachmentColor.a * alpha; if (clipper.isClipping() && clipper.clipTriangles(worldVertices, triangles, triangles.length, uvs)) { @@ -273,7 +272,7 @@ class SkeletonSprite extends FlxObject _tempPoint = _tempMatrix.transformPoint(_tempPoint); mesh.vertices[i] = _tempPoint.x; mesh.vertices[i + 1] = _tempPoint.y; - i+=2; + i += 2; } } } else { @@ -320,7 +319,7 @@ class SkeletonSprite extends FlxObject _tempMatrix.identity(); // scale is connected to the skeleton scale - no need to rescale _tempMatrix.scale(1, 1); - _tempMatrix.rotate(angle * Math.PI / 180); + _tempMatrix.rotate(angle * Math.PI / 180); _tempMatrix.translate(x + offsetX, y + offsetY); return _tempMatrix; } @@ -333,10 +332,10 @@ class SkeletonSprite extends FlxObject d = transform.d, tx = transform.tx, ty = transform.ty; - var x = point[0]; - var y = point[1]; - point[0] = x * a + y * c + tx; - point[1] = x * b + y * d + ty; + var x = point[0]; + var y = point[1]; + point[0] = x * a + y * c + tx; + point[1] = x * b + y * d + ty; } public function haxeWorldCoordinatesToSkeleton(point:Array):Void { @@ -353,7 +352,7 @@ class SkeletonSprite extends FlxObject point[1] = x * b + y * d + ty; } - public function haxeWorldCoordinatesToBone(point:Array, bone: Bone):Void { + public function haxeWorldCoordinatesToBone(point:Array, bone:Bone):Void { this.haxeWorldCoordinatesToSkeleton(point); var parentBone = bone.parent; if (parentBone != null) { @@ -363,7 +362,7 @@ class SkeletonSprite extends FlxObject } } - private function getFlixelMeshFromRendererAttachment(region: RenderedAttachment) { + private function getFlixelMeshFromRendererAttachment(region:RenderedAttachment) { if (region.rendererObject == null) { var skeletonMesh = new SkeletonMesh(); region.rendererObject = skeletonMesh; @@ -373,15 +372,15 @@ class SkeletonSprite extends FlxObject return region.rendererObject; } - function set_flipX(value:Bool):Bool - { - if (value != flipX) skeleton.scaleX = -skeleton.scaleX; + function set_flipX(value:Bool):Bool { + if (value != flipX) + skeleton.scaleX = -skeleton.scaleX; return flipX = value; } - function set_flipY(value:Bool):Bool - { - if (value != flipY) skeleton.scaleY = -skeleton.scaleY; + function set_flipY(value:Bool):Bool { + if (value != flipY) + skeleton.scaleY = -skeleton.scaleY; return flipY = value; } @@ -404,7 +403,6 @@ class SkeletonSprite extends FlxObject function set_scaleY(value:Float):Float { return skeleton.scaleY = value; } - } typedef RenderedAttachment = { diff --git a/spine-haxe/spine-haxe/spine/flixel/SpineTexture.hx b/spine-haxe/spine-haxe/spine/flixel/SpineTexture.hx index 5aa5b964c..75b75bcaf 100644 --- a/spine-haxe/spine-haxe/spine/flixel/SpineTexture.hx +++ b/spine-haxe/spine-haxe/spine/flixel/SpineTexture.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.flixel; @@ -33,13 +33,12 @@ import flixel.FlxG; import flixel.graphics.FlxGraphic; import openfl.display.BlendMode; -class SpineTexture extends FlxGraphic -{ - public static function from(bitmapData: openfl.display.BitmapData): FlxGraphic { +class SpineTexture extends FlxGraphic { + public static function from(bitmapData:openfl.display.BitmapData):FlxGraphic { return FlxG.bitmap.add(bitmapData); } - public static function toFlixelBlending (blend: spine.BlendMode): BlendMode { + public static function toFlixelBlending(blend:spine.BlendMode):BlendMode { switch (blend) { case spine.BlendMode.normal: return BlendMode.NORMAL; @@ -55,5 +54,4 @@ class SpineTexture extends FlxGraphic } return BlendMode.NORMAL; } - } diff --git a/spine-haxe/spine-haxe/spine/starling/SkeletonMesh.hx b/spine-haxe/spine-haxe/spine/starling/SkeletonMesh.hx index 95d03777b..d7e56dfbe 100644 --- a/spine-haxe/spine-haxe/spine/starling/SkeletonMesh.hx +++ b/spine-haxe/spine-haxe/spine/starling/SkeletonMesh.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.starling; diff --git a/spine-haxe/spine-haxe/spine/starling/SkeletonSprite.hx b/spine-haxe/spine-haxe/spine/starling/SkeletonSprite.hx index dcee4a173..0cffae9b2 100644 --- a/spine-haxe/spine-haxe/spine/starling/SkeletonSprite.hx +++ b/spine-haxe/spine-haxe/spine/starling/SkeletonSprite.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.starling; @@ -76,8 +76,8 @@ class SkeletonSprite extends DisplayObject implements IAnimatable { private var tempLight:spine.Color = new spine.Color(0, 0, 0); private var tempDark:spine.Color = new spine.Color(0, 0, 0); - public var beforeUpdateWorldTransforms: SkeletonSprite -> Void = function(_) {}; - public var afterUpdateWorldTransforms: SkeletonSprite -> Void = function(_) {}; + public var beforeUpdateWorldTransforms:SkeletonSprite->Void = function(_) {}; + public var afterUpdateWorldTransforms:SkeletonSprite->Void = function(_) {}; /** Creates an uninitialized SkeletonSprite. The skeleton and animation state must be set before use. */ public function new(skeletonData:SkeletonData, animationStateData:AnimationStateData = null) { @@ -324,17 +324,20 @@ class SkeletonSprite extends DisplayObject implements IAnimatable { return resultRect; } - public function getAnimationBounds(animation:Animation, clip:Bool = true): Rectangle { + public function getAnimationBounds(animation:Animation, clip:Bool = true):Rectangle { var clipper = clip ? SkeletonSprite.clipper : null; _skeleton.setupPose(); var steps = 100, time = 0.; var stepTime = animation.duration != 0 ? animation.duration / steps : 0; - var minX = 100000000., maxX = -100000000., minY = 100000000., maxY = -100000000.; + var minX = 100000000., + maxX = -100000000., + minY = 100000000., + maxY = -100000000.; var bound:lime.math.Rectangle; for (i in 0...steps) { - animation.apply(_skeleton, time , time, false, [], 1, MixBlend.setup, MixDirection.mixIn, false); + animation.apply(_skeleton, time, time, false, [], 1, MixBlend.setup, MixDirection.mixIn, false); _skeleton.updateWorldTransform(Physics.update); bound = _skeleton.getBounds(clipper); @@ -392,10 +395,10 @@ class SkeletonSprite extends DisplayObject implements IAnimatable { d = transform.d, tx = transform.tx, ty = transform.ty; - var x = point[0]; - var y = point[1]; - point[0] = x * a + y * c + tx; - point[1] = x * b + y * d + ty; + var x = point[0]; + var y = point[1]; + point[0] = x * a + y * c + tx; + point[1] = x * b + y * d + ty; } public function haxeWorldCoordinatesToSkeleton(point:Array):Void { @@ -412,7 +415,7 @@ class SkeletonSprite extends DisplayObject implements IAnimatable { point[1] = x * b + y * d + ty; } - public function haxeWorldCoordinatesToBone(point:Array, bone: Bone):Void { + public function haxeWorldCoordinatesToBone(point:Array, bone:Bone):Void { this.haxeWorldCoordinatesToSkeleton(point); var parentBone = bone.parent; if (parentBone != null) { @@ -427,7 +430,8 @@ class SkeletonSprite extends DisplayObject implements IAnimatable { _state.clearListeners(); _state = null; } - if (_skeleton != null) _skeleton = null; + if (_skeleton != null) + _skeleton = null; dispatchEventWith(starling.events.Event.REMOVE_FROM_JUGGLER); removeFromParent(); diff --git a/spine-haxe/spine-haxe/spine/starling/StarlingTextureLoader.hx b/spine-haxe/spine-haxe/spine/starling/StarlingTextureLoader.hx index c3b04a08f..e243482c1 100644 --- a/spine-haxe/spine-haxe/spine/starling/StarlingTextureLoader.hx +++ b/spine-haxe/spine-haxe/spine/starling/StarlingTextureLoader.hx @@ -25,7 +25,7 @@ * 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 * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ +*****************************************************************************/ package spine.starling;