Przeglądaj źródła

Merge branch '4.1' into 4.2-beta

Harald Csaszar 2 lat temu
rodzic
commit
ea16621fb1

+ 26 - 0
.github/workflows/spine-godot-v4-all.yml

@@ -0,0 +1,26 @@
+name: Build spine-godot (All Godot 4.x versions)
+
+on:
+  push:
+    paths:
+      - ".github/workflows/spine-godot.yml"
+      - 'spine-godot/**'
+      - 'spine-cpp/**'
+  workflow_dispatch:
+
+jobs:
+  build-versions:
+    strategy:
+      matrix:
+        version:
+          [
+            {"tag": "4.0-stable", "version": "4.0.stable", "mono": false},
+            {"tag": "4.1-stable", "version": "4.1.stable", "mono": false},
+            {"tag": "4.1-stable", "version": "4.1.stable", "mono": true},
+          ]
+    uses: ./.github/workflows/spine-godot-v4.yml
+    with:
+      godot_tag: ${{ matrix.version.tag }}
+      godot_version: ${{ matrix.version.version }}
+      godot_mono: ${{ matrix.version.mono }}
+    secrets: inherit

+ 0 - 368
.github/workflows/spine-godot-v4.1.yml

@@ -1,368 +0,0 @@
-name: Build and Publish Godot 4.1 editor and templates
-
-on:
-  push:
-    paths:
-      - ".github/workflows/spine-godot.yml"
-      - 'spine-godot/**'
-      - 'spine-cpp/**'
-  workflow_dispatch:
-
-env:
-  AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
-  AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
-  AWS_EC2_METADATA_DISABLED: true
-  EM_VERSION: 3.1.18
-  GODOT_TAG: 4.1-stable
-  GODOT_VERSION: 4.1.stable
-
-jobs:
-
-  godot-editor-windows:
-    runs-on: windows-latest
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          fetch-depth: 0
-
-      - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps
-
-      - name: Build Godot artifact
-        shell: bash
-        run: |
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-v4.sh
-
-      - name: Upload artifacts
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-editor-windows.zip
-          path: spine-godot/godot/bin/godot.windows.editor.x86_64.exe
-
-  godot-editor-linux:
-    runs-on: ubuntu-20.04
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          fetch-depth: 0
-
-      - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps
-
-      - name: Build Godot artifact
-        shell: bash
-        run: |
-          sudo apt-get update
-          sudo apt-get install build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-v4.sh
-
-      - name: Upload artifacts
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-editor-linux.zip
-          path: spine-godot/godot/bin/godot.linuxbsd.editor.x86_64
-
-  godot-editor-macos:
-    runs-on: macos-latest
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          fetch-depth: 0
-
-      - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps
-
-      - name: Build Godot artifact
-        shell: bash
-        run: |
-          ./spine-godot/build/install-macos-vulkan-sdk.sh
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-v4.sh
-          pushd spine-godot/godot/bin
-          zip -r godot-editor-macos.zip Godot.app
-          popd
-
-      - name: Upload artifacts
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-editor-macos.zip
-          path: spine-godot/godot/bin/godot-editor-macos.zip
-
-  godot-template-ios:
-    runs-on: macos-latest
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          fetch-depth: 0
-
-      - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps
-
-      - name: Build Godot artifact
-        run: |
-          ./spine-godot/build/install-macos-vulkan-sdk.sh
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-templates-v4.sh ios
-
-      - name: Upload artifacts
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-template-ios.zip
-          path: spine-godot/godot/bin/ios.zip
-
-  godot-template-macos:
-    runs-on: macos-latest
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          fetch-depth: 0
-
-      - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps
-
-      - name: Build Godot artifact
-        run: |
-          ./spine-godot/build/install-macos-vulkan-sdk.sh
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-templates-v4.sh macos
-
-      - name: Upload artifacts
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-template-macos.zip
-          path: spine-godot/godot/bin/macos.zip
-
-  godot-template-linux:
-    runs-on: ubuntu-20.04
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          fetch-depth: 0
-
-      - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps
-
-      - name: Build Godot artifact
-        run: |
-          sudo apt-get update
-          sudo apt-get install build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-templates-v4.sh linux
-
-      - name: Upload artifacts debug
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-template-linux-debug.zip
-          path: spine-godot/godot/bin/linux_x11_64_debug
-
-      - name: Upload artifacts release
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-template-linux-release.zip
-          path: spine-godot/godot/bin/linux_x11_64_release
-
-  godot-template-windows:
-    runs-on: windows-latest
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          fetch-depth: 0
-
-      - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps
-
-      - name: Build Godot artifact
-        shell: bash
-        run: |
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-templates-v4.sh windows
-
-      - name: Upload artifacts debug
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-template-windows-debug.zip
-          path: spine-godot/godot/bin/windows_debug_x86_64.exe
-
-      - name: Upload artifacts release
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-template-windows-release.zip
-          path: spine-godot/godot/bin/windows_release_x86_64.exe
-
-  godot-template-android:
-    runs-on: ubuntu-20.04
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          fetch-depth: 0
-
-      # Azure repositories are not reliable, we need to prevent azure giving us packages.
-      - name: Make apt sources.list use the default Ubuntu repositories
-        run: |
-          sudo rm -f /etc/apt/sources.list.d/*
-          sudo cp -f spine-godot/build/sources.lst /etc/apt/sources.list
-          sudo apt-get update
-
-      - name: Set up Java 11
-        uses: actions/setup-java@v1
-        with:
-          java-version: 11
-
-      - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps
-
-      - name: Build Godot artifact
-        shell: bash
-        run: |
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-templates-v4.sh android
-
-      - name: Upload artifacts debug
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-template-android-debug.zip
-          path: spine-godot/godot/bin/android_debug.apk
-
-      - name: Upload artifacts release
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-template-android-release.zip
-          path: spine-godot/godot/bin/android_release.apk
-
-      - name: Upload artifacts source
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-template-android-source.zip
-          path: spine-godot/godot/bin/android_source.zip
-
-  godot-template-web:
-    runs-on: ubuntu-20.04
-    steps:
-      - uses: actions/checkout@v3
-        with:
-          fetch-depth: 0
-
-      - name: Set up Emscripten latest
-        uses: mymindstorm/setup-emsdk@v11
-        with:
-          version: ${{env.EM_VERSION}}
-
-      - name: Verify Emscripten setup
-        run: |
-          emcc -v
-
-      - name: Setup python and scons
-        uses: ./.github/actions/setup-godot-deps
-
-      - name: Build Godot artifact
-        run: |
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-templates-v4.sh web
-
-      - name: Upload artifacts debug
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-template-web-debug.zip
-          path: spine-godot/godot/bin/web_debug.zip
-
-      - name: Upload artifacts release
-        uses: actions/upload-artifact@v3
-        with:
-          name: godot-template-web-release.zip
-          path: spine-godot/godot/bin/web_release.zip
-
-  upload-to-s3:
-    needs: [godot-editor-windows, godot-editor-linux, godot-editor-macos, godot-template-ios, godot-template-macos, godot-template-windows, godot-template-linux, godot-template-android, godot-template-web]
-    runs-on: ubuntu-latest
-    steps:
-      - name: Download godot-editor-windows artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-editor-windows.zip
-
-      - name: Download godot-editor-linux artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-editor-linux.zip
-
-      - name: Download godot-editor-macos artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-editor-macos.zip
-
-      - name: Download godot-template-ios artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-template-ios.zip
-
-      - name: Download godot-template-macos artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-template-macos.zip
-
-      - name: Download godot-template-windows-release artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-template-windows-release.zip
-
-      - name: Download godot-template-windows-debug artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-template-windows-debug.zip
-
-      - name: Download godot-template-linux-release artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-template-linux-release.zip
-
-      - name: Download godot-template-linux-debug artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-template-linux-debug.zip
-
-      - name: Download godot-template-android-release artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-template-android-release.zip
-
-      - name: Download godot-template-android-debug artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-template-android-debug.zip
-
-      - name: Download godot-template-android-source artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-template-android-source.zip
-
-      - name: Download godot-template-web-release artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-template-web-release.zip
-
-      - name: Download godot-template-web-debug artifact
-        uses: actions/download-artifact@v2
-        with:
-          name: godot-template-web-debug.zip
-
-      - name: Upload artifacts to S3
-        shell: bash
-        if: env.AWS_ACCESS_KEY_ID != null
-        run: |
-          BRANCH=${GITHUB_REF#refs/heads/}
-          echo "branch: $BRANCH"
-          mv godot.windows.editor.x86_64.exe godot-$BRANCH-$GODOT_TAG.exe
-          mv godot.linuxbsd.editor.x86_64 godot-$BRANCH-$GODOT_TAG
-          zip godot-editor-windows.zip godot-$BRANCH-$GODOT_TAG.exe
-          zip godot-editor-linux.zip godot-$BRANCH-$GODOT_TAG
-          aws s3 cp godot-editor-windows.zip s3://spine-godot/$BRANCH/$GODOT_TAG/
-          aws s3 cp godot-editor-linux.zip s3://spine-godot/$BRANCH/$GODOT_TAG/
-          aws s3 cp godot-editor-macos.zip s3://spine-godot/$BRANCH/$GODOT_TAG/
-          echo "$GODOT_VERSION" > version.txt
-          ls -lah
-          zip spine-godot-templates-$BRANCH-$GODOT_TAG.zip ios.zip macos.zip windows_debug_x86_64.exe windows_release_x86_64.exe linux_x11_64_debug linux_x11_64_release web_debug.zip web_release.zip android_release.apk android_debug.apk android_source.zip version.txt
-          aws s3 cp spine-godot-templates-$BRANCH-$GODOT_TAG.zip s3://spine-godot/$BRANCH/$GODOT_TAG/spine-godot-templates-$BRANCH-$GODOT_TAG.tpz
-
-

+ 135 - 39
.github/workflows/spine-godot-v4.yml

@@ -1,20 +1,44 @@
-name: Build and Publish Godot 4.0 editor and templates
+name: Build spine-godot (Godot 4.x)
 
 
 on:
 on:
-  push:
-    paths:
-      - ".github/workflows/spine-godot.yml"
-      - 'spine-godot/**'
-      - 'spine-cpp/**'
+  workflow_call:
+    inputs:
+      godot_tag:
+        required: true
+        type: string
+        default: "Godot tag not specified!"
+      godot_version:
+        required: true
+        type: string
+        default: "Godot version not specified!"
+      godot_mono:
+        required: true
+        type: boolean
+        default: false
   workflow_dispatch:
   workflow_dispatch:
+    inputs:
+      godot_tag:
+        required: true
+        type: string
+        default: "Godot tag not specified!"
+      godot_version:
+        required: true
+        type: string
+        default: "Godot version not specified!"
+      godot_mono:
+        required: true
+        type: boolean
+        default: false
 
 
 env:
 env:
   AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
   AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
   AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
   AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
   AWS_EC2_METADATA_DISABLED: true
   AWS_EC2_METADATA_DISABLED: true
   EM_VERSION: 3.1.18
   EM_VERSION: 3.1.18
-  GODOT_TAG: 4.0.3-stable
-  GODOT_VERSION: 4.0.3.stable
+  GODOT_TAG: ${{ inputs.godot_tag }}
+  GODOT_VERSION: ${{ inputs.godot_version }}
+  GODOT_MONO: ${{ inputs.godot_mono }}
+  GODOT_MONO_UPLOAD_SUFFIX: ${{ inputs.godot_mono == true && '-mono' || '' }}
 
 
 jobs:
 jobs:
 
 
@@ -31,14 +55,14 @@ jobs:
       - name: Build Godot artifact
       - name: Build Godot artifact
         shell: bash
         shell: bash
         run: |
         run: |
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-v4.sh
+          ./spine-godot/build/setup.sh $GODOT_TAG false $GODOT_MONO
+          ./spine-godot/build/build-v4.sh $GODOT_MONO
 
 
       - name: Upload artifacts
       - name: Upload artifacts
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-editor-windows.zip
-          path: spine-godot/godot/bin/godot.windows.editor.x86_64.exe
+          name: ${{ format('{0}{1}.zip', 'godot-editor-windows', env.GODOT_MONO_UPLOAD_SUFFIX) }}
+          path: spine-godot/godot/bin/**/*
 
 
   godot-editor-linux:
   godot-editor-linux:
     runs-on: ubuntu-20.04
     runs-on: ubuntu-20.04
@@ -55,14 +79,14 @@ jobs:
         run: |
         run: |
           sudo apt-get update
           sudo apt-get update
           sudo apt-get install build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev
           sudo apt-get install build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-v4.sh
+          ./spine-godot/build/setup.sh $GODOT_TAG false $GODOT_MONO
+          ./spine-godot/build/build-v4.sh $GODOT_MONO
 
 
       - name: Upload artifacts
       - name: Upload artifacts
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-editor-linux.zip
-          path: spine-godot/godot/bin/godot.linuxbsd.editor.x86_64
+          name: ${{ format('{0}{1}.zip', 'godot-editor-linux', env.GODOT_MONO_UPLOAD_SUFFIX) }}
+          path: spine-godot/godot/bin/**/*
 
 
   godot-editor-macos:
   godot-editor-macos:
     runs-on: macos-latest
     runs-on: macos-latest
@@ -78,8 +102,8 @@ jobs:
         shell: bash
         shell: bash
         run: |
         run: |
           ./spine-godot/build/install-macos-vulkan-sdk.sh
           ./spine-godot/build/install-macos-vulkan-sdk.sh
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-v4.sh
+          ./spine-godot/build/setup.sh $GODOT_TAG false $GODOT_MONO
+          ./spine-godot/build/build-v4.sh $GODOT_MONO
           pushd spine-godot/godot/bin
           pushd spine-godot/godot/bin
           zip -r godot-editor-macos.zip Godot.app
           zip -r godot-editor-macos.zip Godot.app
           popd
           popd
@@ -87,11 +111,13 @@ jobs:
       - name: Upload artifacts
       - name: Upload artifacts
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-editor-macos.zip
+          name: ${{ format('{0}{1}.zip', 'godot-editor-macos', env.GODOT_MONO_UPLOAD_SUFFIX) }}
           path: spine-godot/godot/bin/godot-editor-macos.zip
           path: spine-godot/godot/bin/godot-editor-macos.zip
 
 
   godot-template-ios:
   godot-template-ios:
     runs-on: macos-latest
     runs-on: macos-latest
+    if: ${{ inputs.godot_mono == false }}
+
     steps:
     steps:
       - uses: actions/checkout@v3
       - uses: actions/checkout@v3
         with:
         with:
@@ -109,7 +135,7 @@ jobs:
       - name: Upload artifacts
       - name: Upload artifacts
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-template-ios.zip
+          name: ${{ format('{0}{1}.zip', 'godot-template-ios', env.GODOT_MONO_UPLOAD_SUFFIX) }}
           path: spine-godot/godot/bin/ios.zip
           path: spine-godot/godot/bin/ios.zip
 
 
   godot-template-macos:
   godot-template-macos:
@@ -125,13 +151,13 @@ jobs:
       - name: Build Godot artifact
       - name: Build Godot artifact
         run: |
         run: |
           ./spine-godot/build/install-macos-vulkan-sdk.sh
           ./spine-godot/build/install-macos-vulkan-sdk.sh
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-templates-v4.sh macos
+          ./spine-godot/build/setup.sh $GODOT_TAG false $GODOT_MONO
+          ./spine-godot/build/build-templates-v4.sh macos $GODOT_MONO
 
 
       - name: Upload artifacts
       - name: Upload artifacts
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-template-macos.zip
+          name: ${{ format('{0}{1}.zip', 'godot-template-macos', env.GODOT_MONO_UPLOAD_SUFFIX) }}
           path: spine-godot/godot/bin/macos.zip
           path: spine-godot/godot/bin/macos.zip
 
 
   godot-template-linux:
   godot-template-linux:
@@ -148,20 +174,20 @@ jobs:
         run: |
         run: |
           sudo apt-get update
           sudo apt-get update
           sudo apt-get install build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev
           sudo apt-get install build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-templates-v4.sh linux
+          ./spine-godot/build/setup.sh $GODOT_TAG false $GODOT_MONO
+          ./spine-godot/build/build-templates-v4.sh linux $GODOT_MONO
 
 
       - name: Upload artifacts debug
       - name: Upload artifacts debug
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-template-linux-debug.zip
-          path: spine-godot/godot/bin/linux_x11_64_debug
+          name: ${{ format('{0}{1}.zip', 'godot-template-linux-debug', env.GODOT_MONO_UPLOAD_SUFFIX) }}
+          path: spine-godot/godot/bin/linux_debug.x86_64
 
 
       - name: Upload artifacts release
       - name: Upload artifacts release
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-template-linux-release.zip
-          path: spine-godot/godot/bin/linux_x11_64_release
+          name: ${{ format('{0}{1}.zip', 'godot-template-linux-release', env.GODOT_MONO_UPLOAD_SUFFIX) }}
+          path: spine-godot/godot/bin/linux_release.x86_64
 
 
   godot-template-windows:
   godot-template-windows:
     runs-on: windows-latest
     runs-on: windows-latest
@@ -176,23 +202,24 @@ jobs:
       - name: Build Godot artifact
       - name: Build Godot artifact
         shell: bash
         shell: bash
         run: |
         run: |
-          ./spine-godot/build/setup.sh $GODOT_TAG false
-          ./spine-godot/build/build-templates-v4.sh windows
+          ./spine-godot/build/setup.sh $GODOT_TAG false $GODOT_MONO
+          ./spine-godot/build/build-templates-v4.sh windows $GODOT_MONO
 
 
       - name: Upload artifacts debug
       - name: Upload artifacts debug
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-template-windows-debug.zip
+          name: ${{ format('{0}{1}.zip', 'godot-template-windows-debug', env.GODOT_MONO_UPLOAD_SUFFIX) }}
           path: spine-godot/godot/bin/windows_debug_x86_64.exe
           path: spine-godot/godot/bin/windows_debug_x86_64.exe
 
 
       - name: Upload artifacts release
       - name: Upload artifacts release
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-template-windows-release.zip
+          name: ${{ format('{0}{1}.zip', 'godot-template-windows-release', env.GODOT_MONO_UPLOAD_SUFFIX) }}
           path: spine-godot/godot/bin/windows_release_x86_64.exe
           path: spine-godot/godot/bin/windows_release_x86_64.exe
 
 
   godot-template-android:
   godot-template-android:
     runs-on: ubuntu-20.04
     runs-on: ubuntu-20.04
+    if: ${{ inputs.godot_mono == false }}
     steps:
     steps:
       - uses: actions/checkout@v3
       - uses: actions/checkout@v3
         with:
         with:
@@ -222,23 +249,25 @@ jobs:
       - name: Upload artifacts debug
       - name: Upload artifacts debug
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-template-android-debug.zip
+          name: ${{ format('{0}{1}.zip', 'godot-template-android-debug', env.GODOT_MONO_UPLOAD_SUFFIX) }}
           path: spine-godot/godot/bin/android_debug.apk
           path: spine-godot/godot/bin/android_debug.apk
 
 
       - name: Upload artifacts release
       - name: Upload artifacts release
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-template-android-release.zip
+          name: ${{ format('{0}{1}.zip', 'godot-template-android-release', env.GODOT_MONO_UPLOAD_SUFFIX) }}
           path: spine-godot/godot/bin/android_release.apk
           path: spine-godot/godot/bin/android_release.apk
 
 
       - name: Upload artifacts source
       - name: Upload artifacts source
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-template-android-source.zip
+          name: ${{ format('{0}{1}.zip', 'godot-template-android-source', env.GODOT_MONO_UPLOAD_SUFFIX) }}
           path: spine-godot/godot/bin/android_source.zip
           path: spine-godot/godot/bin/android_source.zip
 
 
   godot-template-web:
   godot-template-web:
     runs-on: ubuntu-20.04
     runs-on: ubuntu-20.04
+    if: ${{ inputs.godot_mono == false }}
+
     steps:
     steps:
       - uses: actions/checkout@v3
       - uses: actions/checkout@v3
         with:
         with:
@@ -264,18 +293,20 @@ jobs:
       - name: Upload artifacts debug
       - name: Upload artifacts debug
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-template-web-debug.zip
+          name: ${{ format('{0}{1}.zip', 'godot-template-web-debug', env.GODOT_MONO_UPLOAD_SUFFIX) }}
           path: spine-godot/godot/bin/web_debug.zip
           path: spine-godot/godot/bin/web_debug.zip
 
 
       - name: Upload artifacts release
       - name: Upload artifacts release
         uses: actions/upload-artifact@v3
         uses: actions/upload-artifact@v3
         with:
         with:
-          name: godot-template-web-release.zip
+          name: ${{ format('{0}{1}.zip', 'godot-template-web-release', env.GODOT_MONO_UPLOAD_SUFFIX) }}
           path: spine-godot/godot/bin/web_release.zip
           path: spine-godot/godot/bin/web_release.zip
 
 
   upload-to-s3:
   upload-to-s3:
     needs: [godot-editor-windows, godot-editor-linux, godot-editor-macos, godot-template-ios, godot-template-macos, godot-template-windows, godot-template-linux, godot-template-android, godot-template-web]
     needs: [godot-editor-windows, godot-editor-linux, godot-editor-macos, godot-template-ios, godot-template-macos, godot-template-windows, godot-template-linux, godot-template-android, godot-template-web]
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
+    if: ${{ inputs.godot_mono == false }}
+
     steps:
     steps:
       - name: Download godot-editor-windows artifact
       - name: Download godot-editor-windows artifact
         uses: actions/download-artifact@v2
         uses: actions/download-artifact@v2
@@ -362,7 +393,72 @@ jobs:
           aws s3 cp godot-editor-macos.zip s3://spine-godot/$BRANCH/$GODOT_TAG/
           aws s3 cp godot-editor-macos.zip s3://spine-godot/$BRANCH/$GODOT_TAG/
           echo "$GODOT_VERSION" > version.txt
           echo "$GODOT_VERSION" > version.txt
           ls -lah
           ls -lah
-          zip spine-godot-templates-$BRANCH-$GODOT_TAG.zip ios.zip macos.zip windows_debug_x86_64.exe windows_release_x86_64.exe linux_x11_64_debug linux_x11_64_release web_debug.zip web_release.zip android_release.apk android_debug.apk android_source.zip version.txt
+          zip spine-godot-templates-$BRANCH-$GODOT_TAG.zip ios.zip macos.zip windows_debug_x86_64.exe windows_release_x86_64.exe linux_debug.x86_64 linux_release.x86_64 web_debug.zip web_release.zip android_release.apk android_debug.apk android_source.zip version.txt
+          aws s3 cp spine-godot-templates-$BRANCH-$GODOT_TAG.zip s3://spine-godot/$BRANCH/$GODOT_TAG/spine-godot-templates-$BRANCH-$GODOT_TAG.tpz
+
+  upload-to-s3-mono:
+    needs: [godot-editor-windows, godot-editor-linux, godot-editor-macos, godot-template-macos, godot-template-windows, godot-template-linux]
+    runs-on: ubuntu-latest
+    if: ${{ inputs.godot_mono == true }}
+
+    steps:
+      - name: Download godot-editor-windows artifact
+        uses: actions/download-artifact@v2
+        with:
+          name: godot-editor-windows-mono.zip
+
+      - name: Download godot-editor-linux artifact
+        uses: actions/download-artifact@v2
+        with:
+          name: godot-editor-linux-mono.zip
+
+      - name: Download godot-editor-macos artifact
+        uses: actions/download-artifact@v2
+        with:
+          name: godot-editor-macos-mono.zip
+
+      - name: Download godot-template-macos artifact
+        uses: actions/download-artifact@v2
+        with:
+          name: godot-template-macos-mono.zip
+
+      - name: Download godot-template-windows-release artifact
+        uses: actions/download-artifact@v2
+        with:
+          name: godot-template-windows-release-mono.zip
+
+      - name: Download godot-template-windows-debug artifact
+        uses: actions/download-artifact@v2
+        with:
+          name: godot-template-windows-debug-mono.zip
+
+      - name: Download godot-template-linux-release artifact
+        uses: actions/download-artifact@v2
+        with:
+          name: godot-template-linux-release-mono.zip
+
+      - name: Download godot-template-linux-debug artifact
+        uses: actions/download-artifact@v2
+        with:
+          name: godot-template-linux-debug-mono.zip
+
+      - name: Upload artifacts to S3
+        shell: bash
+        if: env.AWS_ACCESS_KEY_ID != null
+        run: |
+          BRANCH=${GITHUB_REF#refs/heads/}
+          echo "branch: $BRANCH"
+          mv godot.windows.editor.x86_64.mono.exe godot-$BRANCH-$GODOT_TAG-mono.exe
+          mv godot.linuxbsd.editor.x86_64.mono godot-$BRANCH-$GODOT_TAG-mono
+          zip godot-editor-windows-mono.zip godot-$BRANCH-$GODOT_TAG-mono.exe GodotSharp
+          zip godot-editor-linux-mono.zip godot-$BRANCH-$GODOT_TAG-mono GodotSharp
+          aws s3 cp godot-editor-windows-mono.zip s3://spine-godot/$BRANCH/$GODOT_TAG/
+          aws s3 cp godot-editor-linux-mono.zip s3://spine-godot/$BRANCH/$GODOT_TAG/
+          aws s3 cp godot-editor-macos-mono.zip s3://spine-godot/$BRANCH/$GODOT_TAG/
+          echo "$GODOT_VERSION.mono" > version.txt
+          ls -lah
+          zip spine-godot-templates-$BRANCH-$GODOT_TAG-mono.zip macos.zip windows_debug_x86_64.exe windows_release_x86_64.exe linux_debug.x86_64 linux_release.x86_64 version.txt
           aws s3 cp spine-godot-templates-$BRANCH-$GODOT_TAG.zip s3://spine-godot/$BRANCH/$GODOT_TAG/spine-godot-templates-$BRANCH-$GODOT_TAG.tpz
           aws s3 cp spine-godot-templates-$BRANCH-$GODOT_TAG.zip s3://spine-godot/$BRANCH/$GODOT_TAG/spine-godot-templates-$BRANCH-$GODOT_TAG.tpz
 
 
 
 
+

+ 1 - 3
.github/workflows/spine-godot.yml

@@ -1,5 +1,4 @@
-name: Build and Publish Godot 3.5 editor and templates
-
+name: Build spine-godot (Godot 3.5)
 on:
 on:
   push:
   push:
     paths:
     paths:
@@ -17,7 +16,6 @@ env:
   GODOT_VERSION: 3.5.2.stable
   GODOT_VERSION: 3.5.2.stable
 
 
 jobs:
 jobs:
-
   godot-editor-windows:
   godot-editor-windows:
     runs-on: windows-latest
     runs-on: windows-latest
     steps:
     steps:

+ 3 - 1
.gitignore

@@ -192,4 +192,6 @@ spine-godot/build/compile_commands.json
 
 
 spine-flutter/ios/Classes/spine-cpp
 spine-flutter/ios/Classes/spine-cpp
 spine-flutter/macos/Classes/spine-cpp
 spine-flutter/macos/Classes/spine-cpp
-spine-flutter/src/spine-cpp
+spine-flutter/src/spine-cpp
+spine-godot/godot-nuget
+spine-godot/godot-spine-csharp

+ 25 - 0
spine-godot/.vscode/launch.json

@@ -54,6 +54,31 @@
                 "program": "${workspaceFolder}/godot/bin/godot.macos.editor.dev.arm64",
                 "program": "${workspaceFolder}/godot/bin/godot.macos.editor.dev.arm64",
             },
             },
         },
         },
+        {
+            "type": "cppvsdbg",
+            "request": "launch",
+            "name": "debug editor v4 c#",
+            "program": "godot/bin/godot.windows.editor.dev.x86_64.mono.exe",
+            "args": [
+                "-e",
+                "--path",
+                "example-v4",
+            ],
+            "cwd": "${workspaceFolder}",
+            "preLaunchTask": "build-v4",
+            "linux": {
+                "type": "lldb",
+                "request": "launch",
+                "name": "debug editor v4",
+                "program": "${workspaceFolder}/godot/bin/godot.linux.editor.dev.x86_64",
+            },
+            "osx": {
+                "type": "lldb",
+                "request": "launch",
+                "name": "debug editor v4",
+                "program": "${workspaceFolder}/godot/bin/godot.macos.editor.dev.arm64.mono",
+            },
+        },
         {
         {
             "type": "cppvsdbg",
             "type": "cppvsdbg",
             "request": "launch",
             "request": "launch",

+ 48 - 26
spine-godot/build/build-templates-v4.sh

@@ -4,8 +4,8 @@ set -e
 dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 pushd "$dir" > /dev/null
 pushd "$dir" > /dev/null
 
 
-if [ ! "$#" -eq 1 ]; then
-	echo "Usage: ./build-templates.sh <platform>"
+if [ "$#" -lt 1 ]; then
+	echo "Usage: ./build-templates.sh <platform> <mono:true|false>?"
 	echo
 	echo
 	echo "e.g.:"
 	echo "e.g.:"
 	echo "       ./build-templates.sh windows"
 	echo "       ./build-templates.sh windows"
@@ -14,7 +14,7 @@ if [ ! "$#" -eq 1 ]; then
 	echo "       ./build-templates.sh ios"
 	echo "       ./build-templates.sh ios"
 	echo "       ./build-templates.sh android"
 	echo "       ./build-templates.sh android"
 	echo "       ./build-templates.sh web"
 	echo "       ./build-templates.sh web"
-	echo	
+	echo
 	exit 1
 	exit 1
 fi
 fi
 
 
@@ -24,6 +24,28 @@ if [ ! -d ../godot ]; then
 fi
 fi
 
 
 platform=${1%/}
 platform=${1%/}
+mono=false
+
+if [[ $# -eq 2 ]]; then
+	mono=${2%/}
+	if [ "$platform" != "windows" ] && [ "$platform" != "linux" ] && [ "$platform" != "macos" ]; then
+		echo "C# is only supported for Windows, Linux, and macOS"
+		exit 1
+	fi
+	echo "Building Godot template with C# support"
+else
+	echo "Building Godot template without C# support"
+fi
+
+mono_module=""
+mono_extension=""
+if [ $mono == "true" ]; then
+	mono_module="module_mono_enabled=yes"
+	mono_extension=".mono"
+	echo "Building Godot with C# support"
+else
+	echo "Building Godot without C# support"
+fi
 
 
 cpus=2
 cpus=2
 if [ "$OSTYPE" = "msys" ]; then
 if [ "$OSTYPE" = "msys" ]; then
@@ -38,10 +60,10 @@ pushd ../godot
 if [ "$platform" = "windows" ]; then
 if [ "$platform" = "windows" ]; then
 	# --- Windows ---
 	# --- Windows ---
 	#generates windows_64_debug.exe and windows_64_release.exe
 	#generates windows_64_debug.exe and windows_64_release.exe
-	scons platform=windows tools=no target=template_release custom_modules="../spine_godot" --jobs=$cpus
-	scons platform=windows tools=no target=template_debug custom_modules="../spine_godot" --jobs=$cpus
-	cp bin/godot.windows.template_release.x86_64.exe bin/windows_release_x86_64.exe
-	cp bin/godot.windows.template_debug.x86_64.exe bin/windows_debug_x86_64.exe
+	scons platform=windows tools=no target=template_release custom_modules="../spine_godot" $mono_module --jobs=$cpus
+	scons platform=windows tools=no target=template_debug custom_modules="../spine_godot" $mono_module --jobs=$cpus
+	cp bin/godot.windows.template_release.x86_64$mono_extension.exe bin/windows_release_x86_64.exe
+	cp bin/godot.windows.template_debug.x86_64$mono_extension.exe bin/windows_debug_x86_64.exe
 
 
 elif [ "$platform" = "macos" ]; then
 elif [ "$platform" = "macos" ]; then
 	# --- macOS ---
 	# --- macOS ---
@@ -51,8 +73,8 @@ elif [ "$platform" = "macos" ]; then
 	scons platform=macos tools=no target=template_debug arch=x86_64 custom_modules="../spine_godot" --jobs=$cpus
 	scons platform=macos tools=no target=template_debug arch=x86_64 custom_modules="../spine_godot" --jobs=$cpus
 	scons platform=macos tools=no target=template_release arch=arm64 custom_modules="../spine_godot" --jobs=$cpus
 	scons platform=macos tools=no target=template_release arch=arm64 custom_modules="../spine_godot" --jobs=$cpus
 	scons platform=macos tools=no target=template_debug arch=arm64 custom_modules="../spine_godot" --jobs=$cpus
 	scons platform=macos tools=no target=template_debug arch=arm64 custom_modules="../spine_godot" --jobs=$cpus
-	lipo -create bin/godot.macos.template_release.x86_64 bin/godot.macos.template_release.arm64 -output bin/godot.macos.universal
-	lipo -create bin/godot.macos.template_debug.x86_64 bin/godot.macos.template_debug.arm64 -output bin/godot.macos.debug.universal
+	lipo -create "bin/godot.macos.template_release.x86_64$mono_extension" "bin/godot.macos.template_release.arm64$mono_extension" -output bin/godot.macos.universal
+	lipo -create "bin/godot.macos.template_debug.x86_64$mono_extension" "bin/godot.macos.template_debug.arm64$mono_extension" -output bin/godot.macos.debug.universal
 	strip -S -x bin/godot.macos.universal
 	strip -S -x bin/godot.macos.universal
 
 
 	pushd bin
 	pushd bin
@@ -60,10 +82,21 @@ elif [ "$platform" = "macos" ]; then
 	mkdir -p macos_template.app/Contents/MacOS
 	mkdir -p macos_template.app/Contents/MacOS
 	cp godot.macos.universal macos_template.app/Contents/MacOS/godot_macos_release.universal
 	cp godot.macos.universal macos_template.app/Contents/MacOS/godot_macos_release.universal
 	cp godot.macos.debug.universal macos_template.app/Contents/MacOS/godot_macos_debug.universal
 	cp godot.macos.debug.universal macos_template.app/Contents/MacOS/godot_macos_debug.universal
-	chmod +x macos_template.app/Contents/MacOS/godot_macos*		
+	chmod +x macos_template.app/Contents/MacOS/godot_macos*
 	rm -rf macos.zip
 	rm -rf macos.zip
 	zip -q -9 -r macos.zip macos_template.app
 	zip -q -9 -r macos.zip macos_template.app
 	popd
 	popd
+elif [ "$platform" = "linux" ]; then
+	# --- Linux ---
+	# generates linux_x11_64_release, linux_x11_64_debug
+	scons platform=linuxbsd tools=no target=template_release bits=64 custom_modules="../spine_godot" --jobs=$cpus
+	scons platform=linuxbsd tools=no target=template_debug bits=64 custom_modules="../spine_godot" --jobs=$cpus
+	strip bin/godot.linuxbsd.template_release.x86_64$mono_extension
+	strip bin/godot.linuxbsd.template_debug.x86_64$mono_extension
+	chmod a+x bin/godot.linuxbsd.template_release.x86_64$mono_extension
+	chmod a+x bin/godot.linuxbsd.template_debug.x86_64$mono_extension
+	cp bin/godot.linuxbsd.template_release.x86_64$mono_extension bin/linux_release.x86_64
+	cp bin/godot.linuxbsd.template_debug.x86_64$mono_extension bin/linux_debug.x86_64
 elif [ "$platform" = "ios" ]; then
 elif [ "$platform" = "ios" ]; then
 	# --- iOS --
 	# --- iOS --
 	# generates ios.zip
 	# generates ios.zip
@@ -77,19 +110,19 @@ elif [ "$platform" = "ios" ]; then
 	lipo -create bin/libgodot.ios.template_release.arm64.simulator.a bin/libgodot.ios.template_release.x86_64.simulator.a -output bin/libgodot.ios.template_release.simulator.a
 	lipo -create bin/libgodot.ios.template_release.arm64.simulator.a bin/libgodot.ios.template_release.x86_64.simulator.a -output bin/libgodot.ios.template_release.simulator.a
 	lipo -create bin/libgodot.ios.template_debug.arm64.simulator.a bin/libgodot.ios.template_debug.x86_64.simulator.a -output bin/libgodot.ios.template_debug.simulator.a
 	lipo -create bin/libgodot.ios.template_debug.arm64.simulator.a bin/libgodot.ios.template_debug.x86_64.simulator.a -output bin/libgodot.ios.template_debug.simulator.a
 	strip -S -x bin/libgodot.ios.template_release.arm64.a
 	strip -S -x bin/libgodot.ios.template_release.arm64.a
-	strip -S -x bin/libgodot.ios.template_release.simulator.a		
+	strip -S -x bin/libgodot.ios.template_release.simulator.a
 
 
 	pushd bin
 	pushd bin
-	cp -r ../misc/dist/ios_xcode .		
+	cp -r ../misc/dist/ios_xcode .
 	cp libgodot.ios.template_release.arm64.a ios_xcode/libgodot.ios.release.xcframework/ios-arm64/libgodot.a
 	cp libgodot.ios.template_release.arm64.a ios_xcode/libgodot.ios.release.xcframework/ios-arm64/libgodot.a
-	cp libgodot.ios.template_release.simulator.a ios_xcode/libgodot.ios.release.xcframework/ios-arm64_x86_64-simulator/libgodot.a	
+	cp libgodot.ios.template_release.simulator.a ios_xcode/libgodot.ios.release.xcframework/ios-arm64_x86_64-simulator/libgodot.a
 	cp libgodot.ios.template_debug.arm64.a ios_xcode/libgodot.ios.debug.xcframework/ios-arm64/libgodot.a
 	cp libgodot.ios.template_debug.arm64.a ios_xcode/libgodot.ios.debug.xcframework/ios-arm64/libgodot.a
-	cp libgodot.ios.template_debug.simulator.a ios_xcode/libgodot.ios.debug.xcframework/ios-arm64_x86_64-simulator/libgodot.a	
+	cp libgodot.ios.template_debug.simulator.a ios_xcode/libgodot.ios.debug.xcframework/ios-arm64_x86_64-simulator/libgodot.a
 	rm -rf ios.zip
 	rm -rf ios.zip
 	pushd ios_xcode
 	pushd ios_xcode
 	zip -q -9 -r ../ios.zip *
 	zip -q -9 -r ../ios.zip *
 	popd
 	popd
-	popd	
+	popd
 elif [ "$platform" = "web" ]; then
 elif [ "$platform" = "web" ]; then
 	# --- WEB ---
 	# --- WEB ---
 	# generates webassembly_debug.zip, webassembly_release.zip
 	# generates webassembly_debug.zip, webassembly_release.zip
@@ -109,17 +142,6 @@ elif [ "$platform" = "android" ]; then
 		chmod a+x gradlew
 		chmod a+x gradlew
 		./gradlew generateGodotTemplates
 		./gradlew generateGodotTemplates
 	popd
 	popd
-elif [ "$platform" = "linux" ]; then
-	# --- Linux ---
-	# generates linux_x11_64_release, linux_x11_64_debug
-	scons platform=linuxbsd tools=no target=template_release bits=64 custom_modules="../spine_godot" --jobs=$cpus
-	scons platform=linuxbsd tools=no target=template_debug bits=64 custom_modules="../spine_godot" --jobs=$cpus	
-	strip bin/godot.linuxbsd.template_release.x86_64
-	strip bin/godot.linuxbsd.template_debug.x86_64
-	chmod a+x bin/godot.linuxbsd.template_release.x86_64
-	chmod a+x bin/godot.linuxbsd.template_debug.x86_64
-	cp bin/godot.linuxbsd.template_release.x86_64 bin/linux_x11_64_release
-	cp bin/godot.linuxbsd.template_debug.x86_64 bin/linux_x11_64_debug
 else
 else
 	echo "Unknown platform: $platform"
 	echo "Unknown platform: $platform"
 	exit 1
 	exit 1

+ 72 - 16
spine-godot/build/build-v4.sh

@@ -11,47 +11,103 @@ fi
 
 
 target=""
 target=""
 dev="false"
 dev="false"
+mono="false"
+
+if [ $# -gt 0 ]; then
+	if [ $# -gt 1 ]; then
+		echo "Usage: $0 <mono:true|false>"
+		exit 1
+	else
+		if [ "$1" == "true" ] || [ "$1" == "false" ]; then
+			mono="$1"
+		else
+			echo "Invalid value for the 'mono' argument. It should be either 'true' or 'false'."
+			exit 1
+		fi
+	fi
+fi
+
 if [ -f "../godot/custom.py" ]; then
 if [ -f "../godot/custom.py" ]; then
 	dev="true"
 	dev="true"
 fi
 fi
 
 
+if [ -f "../godot/custom.py" ]; then
+	dev="true"
+fi
+
+mono_module=""
+mono_extension=""
+if [ $mono == "true" ]; then
+	mono_module="module_mono_enabled=yes"
+	mono_extension=".mono"
+	echo "Building Godot with C# support"
+else
+	echo "Building Godot without C# support"
+fi
+
+dev_extension=""
+if [ $dev == "true" ]; then
+	dev_extension=".dev"
+	target="$target dev_build=true"
+fi
+
 cpus=2
 cpus=2
-if [ "$OSTYPE" = "msys" ]; then
+if [ "$OSTYPE" == "msys" ]; then
+	os="windows"
 	cpus=$NUMBER_OF_PROCESSORS
 	cpus=$NUMBER_OF_PROCESSORS
-elif [[ "$OSTYPE" = "darwin"* ]]; then
+	target="vsproj=yes livepp=$LIVEPP"
+	godot_exe="godot.windows.editor$dev_extension.x86_64$mono_extension.exe"
+	godot_exe_host=$godot_exe
+elif [[ "$OSTYPE" == "darwin"* ]]; then
+	os="macos"
 	cpus=$(sysctl -n hw.logicalcpu)
 	cpus=$(sysctl -n hw.logicalcpu)
+	godot_exe="godot.macos.editor$dev_extension.x86_64$mono_extension"
+	godot_exe_arm="godot.macos.editor$dev_extension.arm64$mono_extension"
+	godot_exe_host=$godot_exe
+	if [ `uname -m` == "arm64" ]; then
+		godot_exe_host=$godot_exe_arm
+	fi
 else
 else
+	os="linux"
 	cpus=$(grep -c ^processor /proc/cpuinfo)
 	cpus=$(grep -c ^processor /proc/cpuinfo)
+	godot_exe="godot.linuxbsd.editor$dev_extension.x86_64$mono_extension"
+	godot_exe_host=$godot_exe
 fi
 fi
 
 
 echo "CPUS: $cpus"
 echo "CPUS: $cpus"
 
 
 pushd ../godot
 pushd ../godot
-if [ `uname` == 'Darwin' ] && [ $dev = "false" ]; then	
-	scons $target arch=x86_64 compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
-	scons $target arch=arm64 compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
-
+if [ "$os" == "macos" ] && [ $dev == "false" ]; then
+	scons $target $mono_module arch=x86_64 compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
+	scons $target $mono_module arch=arm64 compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
+	if [ $mono == "true" ]; then
+		echo "Building C# glue and assemblies."
+		"./bin/$godot_exe_host" --generate-mono-glue modules/mono/glue
+		./modules/mono/build_scripts/build_assemblies.py --godot-output-dir ./bin --push-nupkgs-local ../godot-spine-csharp
+	fi
 	pushd bin
 	pushd bin
 	cp -r ../misc/dist/macos_tools.app .
 	cp -r ../misc/dist/macos_tools.app .
 	mv macos_tools.app Godot.app
 	mv macos_tools.app Godot.app
 	mkdir -p Godot.app/Contents/MacOS
 	mkdir -p Godot.app/Contents/MacOS
-	lipo -create godot.macos.editor.arm64 godot.macos.editor.x86_64 -output Godot
+	lipo -create $godot_exe_arm $godot_exe -output Godot
 	strip -S -x Godot
 	strip -S -x Godot
 	cp Godot Godot.app/Contents/MacOS/Godot
 	cp Godot Godot.app/Contents/MacOS/Godot
 	chmod +x Godot.app/Contents/MacOS/Godot
 	chmod +x Godot.app/Contents/MacOS/Godot
+	if [ $mono == "true" ]; then
+		cp -r GodotSharp Godot.app/Contents/Resources
+	fi
 	popd
 	popd
 else
 else
-	if [ "$OSTYPE" = "msys" ]; then
-		target="vsproj=yes livepp=$LIVEPP"
-	fi
-	if [ "$dev" = "true" ]; then
-		target="$target dev_build=true"
+	scons $target $mono_module compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
+	if [ $mono == "true" ]; then
+		echo "Building C# glue and assemblies."
+		"./bin/$godot_exe_host" --generate-mono-glue modules/mono/glue
+		./modules/mono/build_scripts/build_assemblies.py --godot-output-dir ./bin --push-nupkgs-local ../godot-nuget
 	fi
 	fi
-	scons $target compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus	
 	cp compile_commands.json ../build
 	cp compile_commands.json ../build
-	if [ -f "bin/godot.linuxbsd.editor.x86_64" ]; then
-		strip bin/godot.linuxbsd.editor.x86_64
-		chmod a+x bin/godot.linuxbsd.editor.x86_64
+	if [ -f "bin/godot.linuxbsd.editor.x86_64$mono_extension" ]; then
+		strip bin/godot.linuxbsd.editor.x86_64$mono_extension
+		chmod a+x bin/godot.linuxbsd.editor.x86_64$mono_extension
 	fi
 	fi
 fi
 fi
 popd
 popd

+ 27 - 5
spine-godot/build/setup.sh

@@ -4,18 +4,36 @@ set -e
 dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 pushd "$dir" > /dev/null
 pushd "$dir" > /dev/null
 
 
-if [ ! "$#" -eq 2 ]; then
-	echo "Usage: ./setup.sh <Godot branch or tag> <dev:true|false>"
+if [ $# -lt 2 ] || [ $# -gt 3 ]; then
+	echo "Usage: ./setup.sh <Godot branch or tag> <dev:true|false> <mono:true|false>?"
 	echo
 	echo
 	echo "e.g.:"
 	echo "e.g.:"
-	echo "       ./setup.sh 3.4.4-stable true"
-	echo "       ./setup.sh master false"
-	echo		
+	echo "       ./setup.sh 3.5.2-stable true"
+	echo "       ./setup.sh master false true"
+	echo
+	echo "Note: the 'mono' parameter only works for Godot 4.x+!"
+
 	exit 1
 	exit 1
 fi
 fi
 
 
 branch=${1%/}
 branch=${1%/}
 dev=${2%/}
 dev=${2%/}
+mono=false
+
+if [[ $# -eq 3 && "$branch" != 3* ]]; then
+	mono=${3%/}
+fi
+
+if [ "$dev" != "true" ] && [ "$dev" != "false" ]; then
+	echo "Invalid value for the 'dev' argument. It should be either 'true' or 'false'."
+	exit 1
+fi
+
+if [ "$mono" != "true" ] && [ "$mono" != "false" ]; then
+	echo "Invalid value for the 'mono' argument. It should be either 'true' or 'false'."
+	exit 1
+fi
+
 
 
 pushd ..
 pushd ..
 rm -rf godot
 rm -rf godot
@@ -23,6 +41,10 @@ git clone --depth 1 https://github.com/godotengine/godot.git -b $branch
 if [ $dev = "true" ]; then
 if [ $dev = "true" ]; then
 	cp -r .idea godot
 	cp -r .idea godot
 	cp build/custom.py godot
 	cp build/custom.py godot
+	if [ "$mono" = "true" ]; then
+		echo "" >> godot/custom.py
+    	echo "module_mono_enabled=\"yes\"" >> godot/custom.py
+	fi
 	cp ../formatters/.clang-format .
 	cp ../formatters/.clang-format .
 	rm -rf example/.import
 	rm -rf example/.import
 	rm -rf example/.godot
 	rm -rf example/.godot

+ 74 - 0
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-DepthNormalsPass-URP.hlsl

@@ -0,0 +1,74 @@
+#ifndef SPRITES_DEPTH_NORMALS_PASS_URP_INCLUDED
+#define SPRITES_DEPTH_NORMALS_PASS_URP_INCLUDED
+
+#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
+#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
+
+struct AttributesSpine
+{
+	float4 positionOS   : POSITION;
+	float3 normalOS     : NORMAL;
+	float4 vertexColor : COLOR;
+	float2 texcoord     : TEXCOORD0;
+	UNITY_VERTEX_INPUT_INSTANCE_ID
+};
+
+struct VaryingsSpine
+{
+	float3 normalWS     : NORMAL;
+	float4 positionCS   : SV_POSITION;
+	float4 texcoordAndAlpha: TEXCOORD0;
+	UNITY_VERTEX_OUTPUT_STEREO
+};
+
+VaryingsSpine DepthNormalsVertex(AttributesSpine input)
+{
+	VaryingsSpine output = (VaryingsSpine)0;
+	UNITY_SETUP_INSTANCE_ID(input);
+	UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
+
+	half3 fixedNormal = half3(0, 0, -1);
+	half3 normalWS = normalize(mul((float3x3)unity_ObjectToWorld, fixedNormal));
+
+#ifdef _DOUBLE_SIDED_LIGHTING
+	// unfortunately we have to compute the sign here in the vertex shader
+	// instead of using VFACE in fragment shader stage.
+	half3 viewDirWS = UNITY_MATRIX_V[2].xyz;
+	half faceSign = sign(dot(viewDirWS, normalWS));
+	normalWS *= faceSign;
+#endif
+	output.normalWS = normalWS;
+
+	output.texcoordAndAlpha.xyz = float3(TRANSFORM_TEX(input.texcoord, _MainTex).xy, 0);
+	output.texcoordAndAlpha.a = input.vertexColor.a;
+	output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
+	return output;
+}
+
+void DepthNormalsFragment(VaryingsSpine input,
+	out half4 outNormalWS : SV_Target0
+#ifdef _WRITE_RENDERING_LAYERS
+	, out float4 outRenderingLayers : SV_Target1
+#endif
+	)
+{
+	fixed4 texureColor = tex2D(_MainTex, input.texcoordAndAlpha.xy);
+	clip(texureColor.a * input.texcoordAndAlpha.a - _Cutoff);
+
+	float3 normalWS = input.normalWS;
+#if defined(_GBUFFER_NORMALS_OCT)
+	float2 octNormalWS = PackNormalOctQuadEncode(normalWS);           // values between [-1, +1], must use fp32 on some platforms.
+	float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5);   // values between [ 0,  1]
+	half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS);      // values between [ 0,  1]
+	outNormalWS = half4(packedNormalWS, 0.0);
+#else
+	outNormalWS = half4(normalWS, 0.0);
+#endif
+
+#ifdef USE_WRITE_RENDERING_LAYERS
+	uint renderingLayers = GetMeshRenderingLayerBackwardsCompatible();
+	outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0);
+#endif
+}
+
+#endif

+ 7 - 0
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-DepthNormalsPass-URP.hlsl.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 803855a1999ecce4081f5e0fb18c6475
+ShaderIncludeImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 64 - 21
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Sprite-DepthNormalsPass-URP.hlsl

@@ -2,44 +2,87 @@
 #define SPRITES_DEPTH_NORMALS_PASS_URP_INCLUDED
 #define SPRITES_DEPTH_NORMALS_PASS_URP_INCLUDED
 
 
 #include "Include/Spine-Sprite-Common-URP.hlsl"
 #include "Include/Spine-Sprite-Common-URP.hlsl"
-#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
+#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
+#include "SpineCoreShaders/SpriteLighting.cginc"
+#include "SpineCoreShaders/Spine-Common.cginc"
+#include "Spine-Common-URP.hlsl"
 
 
-struct AttributesSprite
-{
-	float4 positionOS   : POSITION;
-	float3 normalOS     : NORMAL;
-	float4 vertexColor : COLOR;
-	float2 texcoord     : TEXCOORD0;
-	UNITY_VERTEX_INPUT_INSTANCE_ID
-};
+//#include "Include/Spine-Sprite-Common-URP.hlsl"
+//#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
 
 
 struct VaryingsSprite
 struct VaryingsSprite
 {
 {
-	float4 positionCS   : SV_POSITION;
-	float4 texcoordAndAlpha: TEXCOORD0;
-	float3 normalWS     : TEXCOORD1;
+	float4 pos : SV_POSITION;
+	fixed4 vertexColor : COLOR;
+	float3 texcoord : TEXCOORD0;
+
+#if defined(_NORMALMAP)
+	half4 normalWorld : TEXCOORD4;
+	half4 tangentWorld : TEXCOORD5;
+	half4 binormalWorld : TEXCOORD6;
+#else
+	half3 normalWorld : TEXCOORD4;
+#endif
 	UNITY_VERTEX_INPUT_INSTANCE_ID
 	UNITY_VERTEX_INPUT_INSTANCE_ID
 	UNITY_VERTEX_OUTPUT_STEREO
 	UNITY_VERTEX_OUTPUT_STEREO
 };
 };
 
 
-VaryingsSprite DepthNormalVertexSprite(AttributesSprite input)
+VaryingsSprite DepthNormalsVertexSprite(VertexInput input)
 {
 {
 	VaryingsSprite output = (VaryingsSprite)0;
 	VaryingsSprite output = (VaryingsSprite)0;
 	UNITY_SETUP_INSTANCE_ID(input);
 	UNITY_SETUP_INSTANCE_ID(input);
 	UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
 	UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
 
 
-	output.texcoordAndAlpha.xyz = float3(TRANSFORM_TEX(input.texcoord, _MainTex).xy, 0);
-	output.texcoordAndAlpha.a = input.vertexColor.a * _Color.a;
-	output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
-	output.normalWS = NormalizeNormalPerVertex(input.normalOS);
+	output.pos = calculateLocalPos(input.vertex);
+	output.vertexColor = calculateVertexColor(input.color);
+	output.texcoord = float3(calculateTextureCoord(input.texcoord), 0);
+
+	float backFaceSign = 1;
+#if defined(FIXED_NORMALS_BACKFACE_RENDERING)
+	backFaceSign = calculateBackfacingSign(positionWS.xyz);
+#endif
+
+	half3 normalWS = calculateSpriteWorldNormal(input, -backFaceSign);
+	output.normalWorld.xyz = normalWS;
+#if defined(_NORMALMAP)
+	output.tangentWorld.xyz = calculateWorldTangent(input.tangent);
+	output.binormalWorld.xyz = calculateSpriteWorldBinormal(input, output.normalWorld.xyz, output.tangentWorld.xyz, backFaceSign);
+#endif
+
 	return output;
 	return output;
 }
 }
 
 
-half4 DepthNormalFragmentSprite(VaryingsSprite input) : SV_TARGET
+void DepthNormalsFragmentSprite(VaryingsSprite input,
+	out half4 outNormalWS : SV_Target0
+#ifdef _WRITE_RENDERING_LAYERS
+	, out float4 outRenderingLayers : SV_Target1
+#endif
+	)
 {
 {
-	fixed4 texureColor = tex2D(_MainTex, input.texcoordAndAlpha.xy);
-	clip(texureColor.a * input.texcoordAndAlpha.a - _Cutoff);
-	return half4(PackNormalOctRectEncode(TransformWorldToViewDir(input.normalWS, true)), 0.0, 0.0);
+	UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
+
+	fixed4 texureColor = calculateTexturePixel(input.texcoord.xy);
+	ALPHA_CLIP(texureColor, input.vertexColor)
+
+#if defined(PER_PIXEL_LIGHTING) && defined(_NORMALMAP)
+	half3 normalWS = calculateNormalFromBumpMap(input.texcoord.xy, input.tangentWorld.xyz, input.binormalWorld.xyz, input.normalWorld.xyz);
+#else
+	half3 normalWS = input.normalWorld.xyz;
+#endif
+
+#if defined(_GBUFFER_NORMALS_OCT)
+	float2 octNormalWS = PackNormalOctQuadEncode(normalWS);           // values between [-1, +1], must use fp32 on some platforms.
+	float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5);   // values between [ 0,  1]
+	half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS);      // values between [ 0,  1]
+	outNormalWS = half4(packedNormalWS, 0.0);
+#else
+	outNormalWS = half4(normalWS, 0.0);
+#endif
+
+#ifdef USE_WRITE_RENDERING_LAYERS
+	uint renderingLayers = GetMeshRenderingLayerBackwardsCompatible();
+	outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0);
+#endif
 }
 }
 
 
 #endif
 #endif

+ 2 - 5
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Include/Spine-Sprite-DepthNormalsPass-URP.hlsl.meta

@@ -1,10 +1,7 @@
 fileFormatVersion: 2
 fileFormatVersion: 2
-guid: d056e751c0a21b446bd1120602271812
-ShaderImporter:
+guid: 5070c54df4a943a438cfe0a199b55657
+ShaderIncludeImporter:
   externalObjects: {}
   externalObjects: {}
-  defaultTextures: []
-  nonModifiableTextures: []
-  preprocessorOverride: 0
   userData: 
   userData: 
   assetBundleName: 
   assetBundleName: 
   assetBundleVariant: 
   assetBundleVariant: 

+ 35 - 1
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Spine-SkeletonLit-URP.shader

@@ -123,7 +123,7 @@
 			ENDHLSL
 			ENDHLSL
 		}
 		}
 
 
-			Pass
+		Pass
 		{
 		{
 			Name "DepthOnly"
 			Name "DepthOnly"
 			Tags{"LightMode" = "DepthOnly"}
 			Tags{"LightMode" = "DepthOnly"}
@@ -157,6 +157,40 @@
 			#include "Include/Spine-DepthOnlyPass-URP.hlsl"
 			#include "Include/Spine-DepthOnlyPass-URP.hlsl"
 			ENDHLSL
 			ENDHLSL
 		}
 		}
+
+		// This pass is used when drawing to a _CameraNormalsTexture texture
+		Pass
+		{
+			Name "DepthNormals"
+			Tags{"LightMode" = "DepthNormals"}
+
+			ZWrite On
+
+			HLSLPROGRAM
+			#pragma vertex DepthNormalsVertex
+			#pragma fragment DepthNormalsFragment
+
+			// -------------------------------------
+			// Material Keywords
+			#pragma shader_feature _ALPHATEST_ON
+			#pragma shader_feature _ _DOUBLE_SIDED_LIGHTING
+
+			// -------------------------------------
+			// Universal Pipeline keywords
+			#pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS
+
+			//--------------------------------------
+			// GPU Instancing
+			#pragma multi_compile_instancing
+
+			#define USE_URP
+			#define fixed4 half4
+			#define fixed3 half3
+			#define fixed half
+			#include "Include/Spine-Input-URP.hlsl"
+			#include "Include/Spine-DepthNormalsPass-URP.hlsl"
+			ENDHLSL
+		}
 	}
 	}
 
 
 	FallBack "Hidden/InternalErrorShader"
 	FallBack "Hidden/InternalErrorShader"

+ 36 - 0
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Spine-Sprite-URP.shader

@@ -248,6 +248,42 @@ Shader "Universal Render Pipeline/Spine/Sprite"
 			ENDHLSL
 			ENDHLSL
 		}
 		}
 
 
+		// This pass is used when drawing to a _CameraNormalsTexture texture
+		Pass
+		{
+			Name "DepthNormals"
+			Tags{"LightMode" = "DepthNormals"}
+
+			ZWrite On
+			Cull[_Cull]
+
+			HLSLPROGRAM
+			#pragma vertex DepthNormalsVertexSprite
+			#pragma fragment DepthNormalsFragmentSprite
+
+			// -------------------------------------
+			// Material Keywords
+			#pragma shader_feature _ _FIXED_NORMALS_VIEWSPACE _FIXED_NORMALS_VIEWSPACE_BACKFACE _FIXED_NORMALS_MODELSPACE _FIXED_NORMALS_MODELSPACE_BACKFACE _FIXED_NORMALS_WORLDSPACE
+			#pragma shader_feature _NORMALMAP
+			#pragma shader_feature _ALPHA_CLIP
+
+			// -------------------------------------
+			// Universal Pipeline keywords
+			#pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS
+
+			//--------------------------------------
+			// GPU Instancing
+			#pragma multi_compile_instancing
+
+			#define USE_URP
+			#define fixed4 half4
+			#define fixed3 half3
+			#define fixed half
+			#include "Include/Spine-Input-Sprite-URP.hlsl"
+			#include "Include/Spine-Sprite-DepthNormalsPass-URP.hlsl"
+			ENDHLSL
+		}
+
 		Pass
 		Pass
 		{
 		{
 			Name "Unlit"
 			Name "Unlit"

+ 1 - 1
spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/package.json

@@ -2,7 +2,7 @@
   "name": "com.esotericsoftware.spine.urp-shaders",
   "name": "com.esotericsoftware.spine.urp-shaders",
   "displayName": "Spine Universal RP Shaders",
   "displayName": "Spine Universal RP Shaders",
   "description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 4.2.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
   "description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 4.2.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
-  "version": "4.2.17",
+  "version": "4.2.18",
   "unity": "2019.3",
   "unity": "2019.3",
   "author": {
   "author": {
     "name": "Esoteric Software",
     "name": "Esoteric Software",