diff --git a/.github/workflows/spine-haxe.yml b/.github/workflows/spine-haxe.yml new file mode 100644 index 000000000..e7fe52755 --- /dev/null +++ b/.github/workflows/spine-haxe.yml @@ -0,0 +1,18 @@ +name: Build spine-haxe + +on: + push: + paths: + - 'spine-haxe/**' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build spine-haxe + working-directory: spine-haxe + env: + HAXE_UPDATE_URL: ${{secrets.HAXE_UPDATE_URL}} + run: ./build.sh \ No newline at end of file diff --git a/.gitignore b/.gitignore index 54b473332..c6ebe4583 100644 --- a/.gitignore +++ b/.gitignore @@ -202,3 +202,5 @@ spine-haxe/export spine-godot/example-v4-csharp/.godot spine-flutter/src/spine-cpp-lite spine-sdl/.vs +spine-ts/spine-canvaskit/dist +spine-ts/output.png diff --git a/CHANGELOG.md b/CHANGELOG.md index 587ead8b8..ed1be6312 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -160,6 +160,7 @@ - All Spine Outline shaders, including the URP outline shader, now provide an additional parameter `Width in Screen Space`. Enable it to keep the outline width constant in screen space instead of texture space. Requires more expensive computations, so enable only where necessary. Defaults to `disabled` to maintain existing behaviour. - Added support for BlendModeMaterials at runtime instantiation from files via an additional method `SkeletonDataAsset.SetupRuntimeBlendModeMaterials`. See example scene `Spine Examples/Other Examples/Instantiate from Script` for a usage example. - SkeletonGraphic: You can now offset the skeleton mesh relative to the pivot via a newly added green circle handle. This allows you to e.g. frame only the face of a skeleton inside a masked frame. Previously offsetting the pivot downwards fails when `Layout Scale Mode` scales the mesh smaller and towards the pivot (e.g. the feet) and thus out of the frame. Now you can keep the pivot in the center of the `RectTransform` while offsetting only the mesh downwards, keeping the desired skeleton area (e.g. the face) centered while resizing. Moving the new larger green circle handle moves the mesh offset, while moving the blue pivot circle handle moves the pivot as usual. + - `Universal Render Pipeline/Spine/Skeleton` shader now performs proper alpha-testing when `Depth Write` is enabled, using the existing `Shadow alpha cutoff` parameter. - **Breaking changes** @@ -173,7 +174,6 @@ - `SkeletonGraphicRenderTexture` example component: `protected RawImage quadRawImage` was changed to `protected SkeletonSubmeshGraphic quadMaskableGraphic` for a bugfix. This is only relevant for subclasses of `SkeletonGraphicRenderTexture` or when querying the `RawImage` component via e.g. `skeletonGraphicRenderTexture.quad.GetComponent()`. - Fixed a bug where when Linear color space is used and `PMA vertex colors` enabled, additive slots add a too dark (too transparent) color value. If you want the old incorrect behaviour (darker additive slots) or are not using Linear but Gamma color space, you can comment-out the define `LINEAR_COLOR_SPACE_FIX_ADDITIVE_ALPHA` in `MeshGenerator.cs` to deactivate the fix or just to skip unnecessary instructions. - - **Changes of default values** - **Deprecated** @@ -260,6 +260,10 @@ ### Canvas backend +### CanvasKit backend + +- Added spine-canvaskit runtime. See https://esotericsoftware.com/spine-canvaskit + ### Three.js backend - Added physics support @@ -418,6 +422,7 @@ - Made `SkeletonGraphic.unscaledTime` parameter protected, use the new property `UnscaledTime` instead. - `SkeletonGraphic` `OnRebuild` callback delegate is now issued after the skeleton has been initialized, before the `AnimationState` component is initialized. This makes behaviour consistent with `SkeletonAnimation` and `SkeletonMecanim` component behaviour. Use the new callback `OnAnimationRebuild` if you want to receive a callback after the `SkeletonGraphic` `AnimationState` has been initialized. + - Changed name of prefab skeleton meshes stored at prefabs from `Skeleton Prefab Mesh "name"` to `Skeleton Prefab Mesh [name]` to avoid issues with quotes in mesh asset names (see [this issue](https://github.com/EsotericSoftware/spine-runtimes/issues/2572)). Likely this change poses no problems at all, however if you are parsing the prefab's mesh name for whatever reason, be sure to adjust the pattern accordingly. - **Changes of default values** diff --git a/examples/export/runtimes.sh b/examples/export/runtimes.sh index 1267e9574..811ac1385 100755 --- a/examples/export/runtimes.sh +++ b/examples/export/runtimes.sh @@ -448,10 +448,24 @@ cp -f ../sack/export/sack-pma.png "$ROOT/spine-ts/spine-webgl/example/assets/" cp -f ../celestial-circus/export/* "$ROOT/spine-ts/spine-webgl/example/assets/" rm "$ROOT/spine-ts/spine-canvas/example/assets/"* +cp -f ../spineboy/export/spineboy-pro.skel "$ROOT/spine-ts/spine-canvas/example/assets/" cp -f ../spineboy/export/spineboy-ess.json "$ROOT/spine-ts/spine-canvas/example/assets/" cp -f ../spineboy/export/spineboy.atlas "$ROOT/spine-ts/spine-canvas/example/assets/" cp -f ../spineboy/export/spineboy.png "$ROOT/spine-ts/spine-canvas/example/assets/" +rm "$ROOT/spine-ts/spine-canvaskit/example/assets/"* +cp -f ../spineboy/export/spineboy-pro.skel "$ROOT/spine-ts/spine-canvaskit/example/assets/" +cp -f ../spineboy/export/spineboy.atlas "$ROOT/spine-ts/spine-canvaskit/example/assets/" +cp -f ../spineboy/export/spineboy.png "$ROOT/spine-ts/spine-canvaskit/example/assets/" + +cp -f ../mix-and-match/export/mix-and-match-pro.skel "$ROOT/spine-ts/spine-canvaskit/example/assets/" +cp -f ../mix-and-match/export/mix-and-match.atlas "$ROOT/spine-ts/spine-canvaskit/example/assets/" +cp -f ../mix-and-match/export/mix-and-match.png "$ROOT/spine-ts/spine-canvaskit/example/assets/" + +cp -f ../celestial-circus/export/celestial-circus-pro.json "$ROOT/spine-ts/spine-canvaskit/example/assets/" +cp -f ../celestial-circus/export/celestial-circus.atlas "$ROOT/spine-ts/spine-canvaskit/example/assets/" +cp -f ../celestial-circus/export/celestial-circus.png "$ROOT/spine-ts/spine-canvaskit/example/assets/" + rm "$ROOT/spine-ts/spine-threejs/example/assets/"* cp -f ../raptor/export/raptor-pro.json "$ROOT/spine-ts/spine-threejs/example/assets/" cp -f ../raptor/export/raptor.atlas "$ROOT/spine-ts/spine-threejs/example/assets/" diff --git a/spine-haxe/LICENSE b/spine-haxe/LICENSE new file mode 100644 index 000000000..1d809bd71 --- /dev/null +++ b/spine-haxe/LICENSE @@ -0,0 +1,26 @@ +Spine Runtimes License Agreement +Last updated July 28, 2023. Replaces all prior versions. + +Copyright (c) 2013-2023, Esoteric Software LLC + +Integration of the Spine Runtimes into software or otherwise creating +derivative works of the Spine Runtimes is permitted under the terms and +conditions of Section 2 of the Spine Editor License Agreement: +http://esotericsoftware.com/spine-editor-license + +Otherwise, it is permitted to integrate the Spine Runtimes into software or +otherwise create derivative works of the Spine Runtimes (collectively, +"Products"), provided that each user of the Products must obtain their own +Spine Editor license and redistribution of the Products in any form must +include this license and copyright notice. + +THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, +BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE +SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/spine-haxe/README.md b/spine-haxe/README.md index d173639c1..7771d8345 100644 --- a/spine-haxe/README.md +++ b/spine-haxe/README.md @@ -4,6 +4,10 @@ The spine-haxe runtime provides functionality to load, manipulate and render [Spine](http://esotericsoftware.com) skeletal animation data using [Haxe](https://haxe.org/) in combination with [OpenFL](https://www.openfl.org/) and [Lime](https://lime.openfl.org/). +For documentation of the core API in `spine-core`, please refer to our [Spine Runtimes Guide](http://esotericsoftware.com/spine-runtimes-guide). + +For documentation of `spine-haxe`, please refer to our [spine-haxe Guide](https://esotericsoftware.com/spine-haxe). + ## Licensing You are welcome to evaluate the Spine Runtimes and the examples we provide in this repository free of charge. @@ -21,12 +25,31 @@ spine-haxe works with data exported from Spine 4.2.xx. spine-haxe supports all Spine features except premultiplied alpha atlases and two color tinting. ## Setup +The core module of spine-haxe has zero dependencies. The rendering implementation through Starling has two dependencies: openfl and starling. +To use spine-haxe you have first to install all the necessary dependencies: -TBD +``` +haxelib install openfl +haxelib install starling +``` + +Once you have installed the dependencies, you can [download the latest version of spine-haxe](https://esotericsoftware.com/files/spine-haxe/4.2/spine-haxe-latest.zip) and install it: + +``` +haxelib install spine-haxe-x.y.z.zip +``` + +Notice that the spine-haxe library is not available on [lib.haxe.org](https://lib.haxe.org/). This is why you need to download the library and install it through the zip archive. ## Example -TBD +The `example/` folder contains the spine-haxe examples. They demonstrates the usage of the API. Enter the the `spine-haxe` folder and run the following command: + +``` +lime test html5 +``` + +This will compile the modules and start a server that serves the example pages at http://127.0.0.1:3000. ## Development diff --git a/spine-haxe/build.sh b/spine-haxe/build.sh new file mode 100755 index 000000000..20b2d075e --- /dev/null +++ b/spine-haxe/build.sh @@ -0,0 +1,32 @@ +#!/bin/sh +set -e + +if [ -z "$GITHUB_REF" ]; then + BRANCH=$(git symbolic-ref --short -q HEAD) +else + BRANCH=${GITHUB_REF#refs/heads/} +fi + +# Get the latest commit message +COMMIT_MSG=$(git log -1 --pretty=%B) + +# Public only if the commit message is in the correct format +if echo "$COMMIT_MSG" | grep -qE '^\[haxe\] Release [0-9]+\.[0-9]+\.[0-9]+$'; then + VERSION=$(echo "$COMMIT_MSG" | sed -E 's/^\[haxe\] Release ([0-9]+\.[0-9]+\.[0-9]+)$/\1/') + echo "Building spine-haxe $BRANCH artifacts (version $VERSION)" + + if [ ! -z "$HAXE_UPDATE_URL" ] && [ ! -z "$BRANCH" ]; then + echo "Deploying spine-haxe $BRANCH artifacts (version $VERSION)" + zip -r "spine-haxe-$VERSION.zip" \ + haxelib.json \ + LICENSE \ + README.md \ + spine-haxe + curl -f -F "file=@spine-haxe-$VERSION.zip" "$HAXE_UPDATE_URL$BRANCH" + else + echo "Not deploying artifacts. HAXE_UPDATE_URL and/or BRANCH not set." + fi +else + echo "The commit is not a release - do not publish." + echo "To release the commit has to be in the for: \"[haxe] Release x.y.z\"" +fi \ No newline at end of file diff --git a/spine-haxe/haxelib.json b/spine-haxe/haxelib.json index debac7468..b95426a61 100644 --- a/spine-haxe/haxelib.json +++ b/spine-haxe/haxelib.json @@ -17,8 +17,8 @@ "cpp" ], "description": "The official Spine Runtime for Haxe", - "version": "4.1.0", - "releasenote": "Initial release", + "version": "4.2.0", + "releasenote": "Update to 4.2.0", "contributors": [ "esotericsoftware" ], diff --git a/spine-haxe/publish.sh b/spine-haxe/publish.sh new file mode 100755 index 000000000..441bb7e0b --- /dev/null +++ b/spine-haxe/publish.sh @@ -0,0 +1,29 @@ +#!/bin/sh +set -e + +currentVersion=$(grep -o '"version": "[^"]*' haxelib.json | grep -o '[^"]*$') + +major=$(echo "$currentVersion" | cut -d. -f1) +minor=$(echo "$currentVersion" | cut -d. -f2) +patch=$(echo "$currentVersion" | cut -d. -f3) +newPatch=$((patch + 1)) +newVersion="$major.$minor.$newPatch" + +echo "current version: $currentVersion" +echo "new version: $newVersion" + +sed -i '' "s/$currentVersion/$newVersion/" haxelib.json + +echo "Write Y if you want to commit and push the new version $newVersion." +echo "This will trigger a pipeline that will publish the new version on esoteric software server." +echo "Do you want to proceed [y/n]?" + +read answer +if [ "$answer" = "Y" ] || [ "$answer" = "y" ]; then + git add haxelib.json + git commit -m "[haxe] Release $newVersion" + git push origin haxe-ci + echo "Changes committed and pushed." +else + echo "Commit and push cancelled, but haxelib.json version updated." +fi \ No newline at end of file diff --git a/spine-ts/README.md b/spine-ts/README.md index 6343767fc..1161689b6 100644 --- a/spine-ts/README.md +++ b/spine-ts/README.md @@ -6,10 +6,11 @@ up into multiple modules: 1. `spine-core/`, the core classes to load and process Spine skeletons. 1. `spine-webgl/`, a self-contained WebGL backend, built on the core classes. 1. `spine-canvas/`, a self-contained Canvas backend, built on the core classes. -1. `spine-threejs/`, a self-contained THREE.JS backend, built on the core classes. +1. `spine-canvaskit/`, a self-contained [CanvasKit](https://skia.org/docs/user/modules/canvaskit/) backend, built on the core classes for CanvasKit, supporting both NodeJS for headless rendering, and browsers. +1. `spine-threejs/`, a self-contained [THREE.JS](https://threejs.org/) backend, built on the core classes. 1. `spine-player/`, a self-contained player to easily display Spine animations on your website, built on the core classes and WebGL backend. -1. `spine-phaser/`, a Phaser backend, built on the core classes. -1. `spine-pixi/`, a Pixi backend, built on the core classes. +1. `spine-phaser/`, a [Phaser](https://phaser.io/) backend, built on the core classes. +1. `spine-pixi/`, a [PixiJS](https://pixijs.com/) backend, built on the core classes. In most cases, the `spine-player` module is best suited for your needs. Please refer to the [Spine Web Player documentation](https://esotericsoftware.com/spine-player) for more information. @@ -35,9 +36,11 @@ For the official legal terms governing the Spine Runtimes, please read the [Spin spine-ts works with data exported from Spine 4.2.xx. -The spine-ts WebGL and Player backends support all Spine features. +spine-ts Canvas does not support mesh attachments, clipping attachments, or two-color tinting. Only the alpha channel from tint colors is applied. Experimental support for mesh attachments can be enabled by setting `spine.SkeletonRenderer.useTriangleRendering` to true. Note that this experimental mesh rendering is slow and render with artifacts on some browsers. -spine-ts Canvas does not support mesh attachments, clipping attachments, or color tinting. Only the alpha channel from tint colors is applied. Experimental support for mesh attachments can be enabled by setting `spine.SkeletonRenderer.useTriangleRendering` to true. Note that this experimental mesh rendering is slow and render with artifacts on some browsers. +spine-canvaskit supports all Spine features except two-color tinting. + +The spine-webgl and spine-player support all Spine features. spine-ts THREE.JS does not support two color tinting. The THREE.JS backend provides `SkeletonMesh.zOffset` to avoid z-fighting. Adjust to your near/far plane settings. @@ -50,20 +53,23 @@ All spine-ts modules are published to [npm](http://npmjs.com) for consumption vi You can include a module in your project via a ` -// spine-ts Canvas +// spine-canvas -// spine-ts WebGL +// spine-canvaskit + + +// spine-webgl -// spine-ts Player, which requires a spine-player.css as well +// spine-player, which requires a spine-player.css as well -// spine-ts ThreeJS +// spine-threejs // spine-phaser @@ -84,6 +90,7 @@ If your project dependencies are managed through NPM or Yarn, you can add spine- ``` npm install @esotericsoftware/spine-core npm install @esotericsoftware/spine-canvas +npm install @esotericsoftware/spine-canvaskit npm install @esotericsoftware/spine-webgl npm install @esotericsoftware/spine-player npm install @esotericsoftware/spine-threejs diff --git a/spine-ts/index.css b/spine-ts/index.css index d14bfda8a..72a527d80 100644 --- a/spine-ts/index.css +++ b/spine-ts/index.css @@ -226,3 +226,7 @@ ol { .p-4 { padding: 1em; } + +.mb-4 { + margin-bottom: 1em; +} diff --git a/spine-ts/index.html b/spine-ts/index.html index 60518ab10..f5daeba5d 100644 --- a/spine-ts/index.html +++ b/spine-ts/index.html @@ -20,6 +20,15 @@ Mouse click +
  • CanvasKit
  • +
  • Pixi