소스 검색

Merge branch '4.1' into 4.2-beta

Mario Zechner 2 년 전
부모
커밋
5081519366

+ 2 - 2
.github/workflows/spine-godot.yml

@@ -350,8 +350,8 @@ jobs:
         run: |
           BRANCH=${GITHUB_REF#refs/heads/}
           echo "branch: $BRANCH"
-          mv godot.windows.opt.tools.64.s.exe godot-$BRANCH-$GODOT_TAG.exe
-          mv godot.x11.opt.tools.64s godot-$BRANCH-$GODOT_TAG
+          mv godot.windows.opt.tools.64.exe godot-$BRANCH-$GODOT_TAG.exe
+          mv godot.x11.opt.tools.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/

+ 2 - 0
.gitignore

@@ -186,3 +186,5 @@ spine-flutter/src/spine-cpp
 spine-godot/.clang-format
 
 spine-ts/spine-phaser/dist
+spine-godot/.cache
+spine-godot/build/compile_commands.json

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

@@ -0,0 +1,84 @@
+{
+    // Use IntelliSense to learn about possible attributes.
+    // Hover to view descriptions of existing attributes.
+    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "type": "cppvsdbg",
+            "request": "launch",
+            "name": "debug scene v4",
+            "program": "godot/bin/godot.windows.editor.dev.x86_64.exe",
+            "args": [
+                "--path",
+                "example-v4",
+                "examples/01-helloworld/helloworld.tscn"
+            ],
+            "cwd": "${workspaceFolder}",
+            "preLaunchTask": "build-v4"
+        },
+        {
+            "type": "cppvsdbg",
+            "request": "launch",
+            "name": "debug editor v4",
+            "program": "godot/bin/godot.windows.editor.dev.x86_64.exe",
+            "args": [
+                "-e",
+                "--path",
+                "example-v4",
+            ],
+            "cwd": "${workspaceFolder}",
+            "preLaunchTask": "build-v4"
+        },
+        {
+            "type": "cppvsdbg",
+            "request": "launch",
+            "name": "debug scene v3",
+            "cwd": "${workspaceFolder}",
+            "program": "godot/bin/godot.windows.tools.64.exe",
+            "args": [
+                "--path",
+                "example",
+                "examples/01-helloworld/helloworld.tscn"
+            ],
+            "preLaunchTask": "build-v3",
+            "linux": {
+                "type": "cppdbg",
+                "request": "launch",
+                "name": "debug scene v3",
+                "program": "godot/bin/godot.windows.tools.64.exe",
+            },
+            "osx": {
+                "type": "cppdbg",
+                "request": "launch",
+                "name": "debug scene v3",
+                "program": "godot/bin/godot.tools.64.exe",
+            },
+        },
+        {
+            "type": "cppvsdbg",
+            "request": "launch",
+            "name": "debug editor v3",
+            "program": "godot/bin/godot.windows.tools.64.exe",
+            "args": [
+                "-e",
+                "--path",
+                "example",
+            ],
+            "cwd": "${workspaceFolder}",
+            "preLaunchTask": "build-v3",
+            "linux": {
+                "type": "cppdbg",
+                "request": "launch",
+                "name": "debug editor v3",
+                "program": "godot/bin/godot.windows.tools.64.exe",
+            },
+            "osx": {
+                "type": "cppdbg",
+                "request": "launch",
+                "name": "debug editor v3",
+                "program": "godot/bin/godot.tools.64.exe",
+            },
+        },
+    ]
+}

+ 4 - 0
spine-godot/.vscode/settings.json

@@ -0,0 +1,4 @@
+{
+    "cmake.configureOnOpen": false,
+    "C_Cpp.intelliSenseEngine": "disabled",
+}

+ 57 - 0
spine-godot/.vscode/tasks.json

@@ -0,0 +1,57 @@
+{
+    "version": "2.0.0",
+    "tasks": [
+        {
+            "label": "build-v4",
+            "group": "build",
+            "type": "shell",
+            "command": "scons",
+            "options": {
+                "cwd": "${workspaceFolder}/godot"
+            },
+            "args": [
+                "-j",
+                "16",
+                "target=editor",
+                "dev_build=yes",
+                "custom_modules=\"${workspaceFolder}/spine_godot"
+            ],
+            "problemMatcher": "$msCompile",
+            "windows": {
+                "args": [
+                    "-j",
+                    "16",
+                    "target=editor",
+                    "dev_build=yes",
+                    "custom_modules=\"${workspaceFolder}/spine_godot",
+                    "livepp=${env:LIVEPP}"
+                ]
+            },
+        },
+        {
+            "label": "build-v3",
+            "group": "build",
+            "type": "shell",
+            "command": "scons",
+            "options": {
+                "cwd": "${workspaceFolder}/godot"
+            },
+            "args": [
+                "-j",
+                "16",
+                "target=debug",
+                "custom_modules=\"${workspaceFolder}/spine_godot"
+            ],
+            "windows": {
+                "args": [
+                    "-j",
+                    "16",
+                    "target=debug",
+                    "custom_modules=\"${workspaceFolder}/spine_godot",
+                    "livepp=${env:LIVEPP}"
+                ]
+            },
+            "problemMatcher": "$msCompile"
+        }
+    ]
+}

+ 127 - 0
spine-godot/build/build-templates-v4.sh

@@ -0,0 +1,127 @@
+#!/bin/bash
+set -e
+
+dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+pushd $dir > /dev/null
+
+if [ ! "$#" -eq 1 ]; then
+	echo "Usage: ./build-templates.sh <platform>"
+	echo
+	echo "e.g.:"
+	echo "       ./build-templates.sh windows"
+	echo "       ./build-templates.sh linux"
+	echo "       ./build-templates.sh macos"
+	echo "       ./build-templates.sh ios"
+	echo "       ./build-templates.sh android"
+	echo "       ./build-templates.sh web"
+	echo	
+	exit 1
+fi
+
+if [ ! -d ../godot ]; then
+	echo "No Godot clone found. Run ./setup.sh <Godot branch or tag> <dev> first."
+	exit 1
+fi
+
+platform=${1%/}
+
+cpus=2
+if [ "$OSTYPE" = "msys" ]; then
+	cpus=$NUMBER_OF_PROCESSORS
+elif [[ "$OSTYPE" = "darwin"* ]]; then
+	cpus=$(sysctl -n hw.logicalcpu)
+else
+	cpus=$(grep -c ^processor /proc/cpuinfo)
+fi
+
+pushd ../godot
+if [ "$platform" = "windows" ]; then
+	# --- Windows ---
+	#generates windows_64_debug.exe and windows_64_release.exe
+	scons platform=windows tools=no target=release custom_modules="../spine_godot" --jobs=$cpus
+	scons platform=windows tools=no target=release_debug custom_modules="../spine_godot" --jobs=$cpus
+	cp bin/godot.windows.opt.64.exe bin/windows_64_release.exe
+	cp bin/godot.windows.opt.debug.64.exe bin/windows_64_debug.exe
+
+elif [ "$platform" = "macos" ]; then
+	# --- macOS ---
+	# generates osx.zip
+
+	scons platform=osx tools=no target=release arch=x86_64 custom_modules="../spine_godot" --jobs=$cpus
+	scons platform=osx tools=no target=release_debug arch=x86_64 custom_modules="../spine_godot" --jobs=$cpus
+	scons platform=osx tools=no target=release arch=arm64 custom_modules="../spine_godot" --jobs=$cpus
+	scons platform=osx tools=no target=release_debug arch=arm64 custom_modules="../spine_godot" --jobs=$cpus
+	lipo -create bin/godot.osx.opt.x86_64 bin/godot.osx.opt.arm64 -output bin/godot.osx.opt.universal
+	lipo -create bin/godot.osx.opt.debug.x86_64 bin/godot.osx.opt.debug.arm64 -output bin/godot.osx.opt.debug.universal
+	strip -S -x bin/godot.osx.opt.universal
+
+	pushd bin
+	cp -r ../misc/dist/osx_template.app .
+	mkdir -p osx_template.app/Contents/MacOS
+	cp godot.osx.opt.universal osx_template.app/Contents/MacOS/godot_osx_release.64
+	cp godot.osx.opt.debug.universal osx_template.app/Contents/MacOS/godot_osx_debug.64
+	chmod +x osx_template.app/Contents/MacOS/godot_osx*		
+	rm -rf osx.zip
+	zip -q -9 -r osx.zip osx_template.app
+	popd
+elif [ "$platform" = "ios" ]; then
+	# --- iOS --
+	# generates iphone.zip
+
+	scons p=iphone tools=no target=release arch=arm64 custom_modules="../spine_godot" --jobs=$cpus
+	scons p=iphone tools=no target=release_debug arch=arm64 custom_modules="../spine_godot" --jobs=$cpus
+	scons p=iphone tools=no target=release arch=arm64 ios_simulator=yes custom_modules="../spine_godot" --jobs=$cpus
+	scons p=iphone tools=no target=release arch=x86_64 ios_simulator=yes custom_modules="../spine_godot" --jobs=$cpus
+	scons p=iphone tools=no target=release_debug arch=arm64 ios_simulator=yes custom_modules="../spine_godot" --jobs=$cpus
+	scons p=iphone tools=no target=release_debug arch=x86_64 ios_simulator=yes custom_modules="../spine_godot" --jobs=$cpus
+	lipo -create bin/libgodot.iphone.opt.arm64.simulator.a bin/libgodot.iphone.opt.x86_64.simulator.a -output bin/libgodot.iphone.opt.simulator.a
+	lipo -create bin/libgodot.iphone.opt.debug.arm64.simulator.a bin/libgodot.iphone.opt.debug.x86_64.simulator.a -output bin/libgodot.iphone.opt.debug.simulator.a
+	strip -S -x bin/libgodot.iphone.opt.arm64.a
+	strip -S -x bin/libgodot.iphone.opt.simulator.a		
+
+	pushd bin
+	cp -r ../misc/dist/ios_xcode .		
+	cp libgodot.iphone.opt.arm64.a ios_xcode/libgodot.iphone.release.xcframework/ios-arm64/libgodot.a
+	cp libgodot.iphone.opt.simulator.a ios_xcode/libgodot.iphone.release.xcframework/ios-arm64_x86_64-simulator/libgodot.a	
+	cp libgodot.iphone.opt.debug.arm64.a ios_xcode/libgodot.iphone.debug.xcframework/ios-arm64/libgodot.a
+	cp libgodot.iphone.opt.debug.simulator.a ios_xcode/libgodot.iphone.debug.xcframework/ios-arm64_x86_64-simulator/libgodot.a	
+	rm -rf iphone.zip
+	pushd ios_xcode
+	zip -q -9 -r ../iphone.zip *
+	popd
+	popd	
+elif [ "$platform" = "web" ]; then
+	# --- WEB ---
+	# generates webassembly_debug.zip, webassembly_release.zip
+	scons platform=javascript tools=no target=release custom_modules="../spine_godot" --jobs=$cpus
+	scons platform=javascript tools=no target=release_debug custom_modules="../spine_godot" --jobs=$cpus
+	mv bin/godot.javascript.opt.zip bin/webassembly_release.zip
+	mv bin/godot.javascript.opt.debug.zip bin/webassembly_debug.zip
+elif [ "$platform" = "android" ]; then
+	# --- ANROID ---
+	# generates android_release.apk, android_debug.apk, android_source.zip
+	scons platform=android target=release android_arch=armv7 custom_modules="../spine_godot" --jobs=$cpus
+	scons platform=android target=release_debug android_arch=armv7 custom_modules="../spine_godot" --jobs=$cpus
+	scons platform=android target=release android_arch=arm64v8 custom_modules="../spine_godot" --jobs=$cpus
+	scons platform=android target=release_debug android_arch=arm64v8 custom_modules="../spine_godot" --jobs=$cpus
+
+	pushd platform/android/java
+		chmod a+x gradlew
+		./gradlew generateGodotTemplates
+	popd
+elif [ "$platform" = "linux" ]; then
+	# --- Linix ---
+	# generates linux_x11_64_release, linux_x11_64_debug
+	scons platform=x11 tools=no target=release bits=64 custom_modules="../spine_godot" --jobs=$cpus
+	scons platform=x11 tools=no target=release_debug bits=64 custom_modules="../spine_godot" --jobs=$cpus
+	strip bin/godot.x11.opt.64	
+	strip bin/godot.x11.opt.debug.64
+	chmod a+x bin/godot.x11.opt.64
+	chmod a+x bin/godot.x11.opt.debug.64
+	cp bin/godot.x11.opt.64 bin/linux_x11_64_release
+	cp bin/godot.x11.opt.debug.64 bin/linux_x11_64_debug
+else
+	echo "Unknown platform: $platform"
+	exit 1
+fi
+popd

+ 75 - 0
spine-godot/build/build-v4.sh

@@ -0,0 +1,75 @@
+#!/bin/bash
+set -e
+
+dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+pushd $dir > /dev/null
+
+if [ ! "$#" -eq 1 ]; then
+	echo "Usage: ./build-v4.sh <target>"
+	echo
+	echo "e.g.:"
+	echo "       ./build.sh editor"
+	echo "       ./build.sh template_debug"
+	echo	
+	exit 1
+fi
+
+if [ ! -d ../godot ]; then
+	echo "No Godot clone found. Run ./setup.sh <Godot branch or tag> <dev> first."
+	exit 1
+fi
+
+target="target=${1%/}"
+dev="false"
+if [ -f "../godot/custom.py" ]; then
+	dev="true"
+fi
+
+cpus=2
+if [ "$OSTYPE" = "msys" ]; then
+	cpus=$NUMBER_OF_PROCESSORS
+elif [[ "$OSTYPE" = "darwin"* ]]; then
+	cpus=$(sysctl -n hw.logicalcpu)
+else
+	cpus=$(grep -c ^processor /proc/cpuinfo)
+fi
+
+echo "CPUS: $cpus"
+
+pushd ../godot
+if [ `uname` == 'Darwin' ] && [ $dev = "false" ]; then	
+	scons $target arch=x86_64 compiledb=yes custom_modules="../spine_godot" --jobs=$cpus
+	scons $target arch=arm64 compiledb=yes custom_modules="../spine_godot" --jobs=$cpus
+
+	pushd bin
+	cp -r ../misc/dist/osx_tools.app .
+	mv osx_tools.app Godot.app
+	mkdir -p Godot.app/Contents/MacOS
+	if [ "$target" = "debug" ]; then
+		lipo -create godot.osx.tools.x86_64 godot.osx.tools.arm64 -output godot.osx.tools.universal
+		strip -S -x godot.osx.tools.universal
+		cp godot.osx.tools.universal Godot.app/Contents/MacOS/Godot
+	else
+		lipo -create godot.osx.opt.tools.x86_64 godot.osx.opt.tools.arm64 -output godot.osx.opt.tools.universal
+		strip -S -x godot.osx.opt.tools.universal
+		cp godot.osx.opt.tools.universal Godot.app/Contents/MacOS/Godot
+	fi	
+	chmod +x Godot.app/Contents/MacOS/Godot	
+	popd
+else
+	if [ "$OSTYPE" = "msys" ]; then
+		target="$target vsproj=yes livepp=$LIVEPP"
+	fi
+	if [ "$dev" = "true" ]; then
+		target="$target dev_build=true"
+	fi
+	scons $target compiledb=yes custom_modules="../spine_godot" --jobs=$cpus	
+	cp compile_commands.json ../build
+	if [ -f "bin/godot.x11.opt.tools.64" ]; then
+		strip bin/godot.x11.opt.tools.64
+		chmod a+x bin/godot.x11.opt.tools.64
+	fi
+fi
+popd
+
+popd > /dev/null

+ 1 - 0
spine-godot/build/build.sh

@@ -61,6 +61,7 @@ else
 		target="$target vsproj=yes livepp=$LIVEPP"
 	fi
 	scons $target compiledb=yes custom_modules="../spine_godot" --jobs=$cpus	
+	cp compile_commands.json ../build
 	if [ -f "bin/godot.x11.opt.tools.64" ]; then
 		strip bin/godot.x11.opt.tools.64
 		chmod a+x bin/godot.x11.opt.tools.64

+ 27 - 24
spine-godot/build/livepp-v4.patch

@@ -1,58 +1,60 @@
 diff --git a/methods.py b/methods.py
-index fe84641e9d0625b4f0c4d90a65839337d6120ff8..51ef8550d3a9def0a2ff88a2fde4fa096c085de9 100644
+index 7ede259..4e0b2e6 100644
 --- a/methods.py
 +++ b/methods.py
-@@ -734,6 +734,7 @@ def generate_vs_project(env, num_jobs):
+@@ -809,6 +809,7 @@ def generate_vs_project(env, num_jobs):
+                     "platform=windows",
                      f"target={configuration_getter}",
                      "progress=no",
-                     "tools=!tools!",
 +                    "livepp=%s" % env["livepp"],
                      "-j%s" % num_jobs,
                  ]
  
 diff --git a/platform/windows/detect.py b/platform/windows/detect.py
-index 0b18fb74fb145e4d2e88ee91abe99f8f39312a46..04880a8fa8209c4002b49f964d86227974ce9ca8 100644
+index 1b55574..8bc0fb1 100644
 --- a/platform/windows/detect.py
 +++ b/platform/windows/detect.py
-@@ -44,7 +44,7 @@ def can_build():
+@@ -164,7 +164,7 @@ def detect_build_env_arch():
  
  
  def get_opts():
 -    from SCons.Variables import BoolVariable, EnumVariable
 +    from SCons.Variables import BoolVariable, EnumVariable, PathVariable
  
-     mingw32 = ""
-     mingw64 = ""
-@@ -73,6 +73,7 @@ def get_opts():
-         BoolVariable("use_thinlto", "Use ThinLTO", False),
+     mingw = os.getenv("MINGW_PREFIX", "")
+ 
+@@ -189,6 +189,7 @@ def get_opts():
          BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True),
          BoolVariable("use_asan", "Use address sanitizer (ASAN)", False),
+         BoolVariable("debug_crt", "Compile with MSVC's debug CRT (/MDd)", False),
 +        PathVariable("livepp", "Path to the Live++ installation", "", PathVariable.PathAccept),
      ]
  
  
-@@ -310,6 +311,19 @@ def configure_msvc(env, manual_msvc_config):
+@@ -458,6 +459,21 @@ def configure_msvc(env, vcvars_msvc_config):
  
      env.AppendUnique(LINKFLAGS=["/STACK:" + str(STACK_SIZE)])
  
 +    # Check if LIVEPP_PATH is set and add #define. Perform
 +    # some sanity checks.
 +    if env.get("livepp"):
-+        if env["target"] == "release_debug" or env["target"] == "debug":
-+            print("Found Live++ at %s" % env.get("livepp"))
-+            env.AppendUnique(CPPDEFINES=["LIVEPP_PATH=%s" % env.get("livepp")])
-+            env.AppendUnique(CPPPATH=[env.get("livepp")])
-+            env.AppendUnique(LINKFLAGS=["/FUNCTIONPADMIN"])
++        if env["target"] == "editor":
++            if os.path.exists(env.get("livepp")):
++                print("Found Live++ at %s" % env.get("livepp"))
++                env.AppendUnique(CPPDEFINES=["LIVEPP_PATH=%s" % env.get("livepp")])
++                env.AppendUnique(CPPPATH=[env.get("livepp")])
++                env.AppendUnique(LINKFLAGS=["/FUNCTIONPADMIN"])
++            else:
++                printf("Specified Live++ path does not exist")
 +        else:
-+            print("Live++ can only be used with targets 'debug' and 'release_debug'")
++            print("Live++ can only be used with targets 'editor'")
 +    else:
 +        print("No Live++ specified.")
-+
  
  def configure_mingw(env):
      # Workaround for MinGW. See:
 diff --git a/platform/windows/godot_windows.cpp b/platform/windows/godot_windows.cpp
-index 8de3ef294a99c6f02f6f1380e331e4bb598864ce..8e4c15dd66d1b640a352ed826b25b23917f72cc4 100644
+index a26d3ba..8b8e2a8 100644
 --- a/platform/windows/godot_windows.cpp
 +++ b/platform/windows/godot_windows.cpp
 @@ -34,6 +34,11 @@
@@ -67,7 +69,7 @@ index 8de3ef294a99c6f02f6f1380e331e4bb598864ce..8e4c15dd66d1b640a352ed826b25b239
  // For export templates, add a section; the exporter will patch it to enclose
  // the data appended to the executable (bundled PCK)
  #ifndef TOOLS_ENABLED
-@@ -147,6 +152,16 @@ char *wc_to_utf8(const wchar_t *wc) {
+@@ -149,6 +154,16 @@ char *wc_to_utf8(const wchar_t *wc) {
  }
  
  int widechar_main(int argc, wchar_t **argv) {
@@ -84,7 +86,7 @@ index 8de3ef294a99c6f02f6f1380e331e4bb598864ce..8e4c15dd66d1b640a352ed826b25b239
  	OS_Windows os(nullptr);
  
  	setlocale(LC_CTYPE, "");
-@@ -179,6 +194,11 @@ int widechar_main(int argc, wchar_t **argv) {
+@@ -185,6 +200,11 @@ int widechar_main(int argc, wchar_t **argv) {
  	}
  	delete[] argv_utf8;
  
@@ -97,12 +99,12 @@ index 8de3ef294a99c6f02f6f1380e331e4bb598864ce..8e4c15dd66d1b640a352ed826b25b239
  }
  
 diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
-index 8755bc65dce7e4b88fd509d0cbdbec576356c5f5..50e0d8d0b06bf76d5f4d085d010cf6a683a9e64f 100644
+index 08299d9..362de3b 100644
 --- a/platform/windows/os_windows.cpp
 +++ b/platform/windows/os_windows.cpp
-@@ -53,6 +53,11 @@
- #include <regstr.h>
+@@ -55,6 +55,11 @@
  #include <shlobj.h>
+ #include <wbemcli.h>
  
 +#ifdef LIVEPP_PATH
 +#include "API/LPP_API.h"
@@ -112,10 +114,11 @@ index 8755bc65dce7e4b88fd509d0cbdbec576356c5f5..50e0d8d0b06bf76d5f4d085d010cf6a6
  extern "C" {
  __declspec(dllexport) DWORD NvOptimusEnablement = 1;
  __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
-@@ -677,6 +682,9 @@ void OS_Windows::run() {
+@@ -1296,6 +1301,10 @@ void OS_Windows::run() {
  		if (Main::iteration()) {
  			break;
  		}
++
 +#ifdef LIVEPP_PATH
 +		lpp::lppSyncPoint(livePP);
 +#endif

+ 24 - 20
spine-godot/build/livepp.patch

@@ -1,17 +1,17 @@
 diff --git a/methods.py b/methods.py
-index 9b8cb38c0c1c0fd4ba2917815fdfb7efafb4b646..874e10bcc637632db26b4ac062a5359cd44eaa25 100644
+index 436fe63..d6c81b9 100644
 --- a/methods.py
 +++ b/methods.py
-@@ -688,6 +688,7 @@ def generate_vs_project(env, num_jobs):
-                 "target=$(Configuration)",
-                 "progress=no",
-                 "tools=!tools!",
-+                "livepp=%s" % env["livepp"],
-                 "-j%s" % num_jobs,
-             ]
+@@ -782,6 +782,7 @@ def generate_vs_project(env, num_jobs):
+                     f"target={configuration_getter}",
+                     "progress=no",
+                     "tools=!tools!",
++                    "livepp=%s" % env["livepp"],
+                     "-j%s" % num_jobs,
+                 ]
  
 diff --git a/platform/windows/detect.py b/platform/windows/detect.py
-index e4facad816b7584fe38dc760356310e0a3937288..2d9da3df65cd3a0b0882ace984002320ebf6c3fc 100644
+index e6829ae..3a7e38d 100644
 --- a/platform/windows/detect.py
 +++ b/platform/windows/detect.py
 @@ -44,7 +44,7 @@ def can_build():
@@ -23,7 +23,7 @@ index e4facad816b7584fe38dc760356310e0a3937288..2d9da3df65cd3a0b0882ace984002320
  
      mingw32 = ""
      mingw64 = ""
-@@ -72,6 +72,7 @@ def get_opts():
+@@ -73,6 +73,7 @@ def get_opts():
          BoolVariable("use_thinlto", "Use ThinLTO", False),
          BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True),
          BoolVariable("use_asan", "Use address sanitizer (ASAN)", False),
@@ -31,7 +31,7 @@ index e4facad816b7584fe38dc760356310e0a3937288..2d9da3df65cd3a0b0882ace984002320
      ]
  
  
-@@ -296,6 +297,18 @@ def configure_msvc(env, manual_msvc_config):
+@@ -305,6 +306,22 @@ def configure_msvc(env, manual_msvc_config):
  
      env.AppendUnique(LINKFLAGS=["/STACK:" + str(STACK_SIZE)])
  
@@ -39,19 +39,23 @@ index e4facad816b7584fe38dc760356310e0a3937288..2d9da3df65cd3a0b0882ace984002320
 +    # some sanity checks.
 +    if env.get("livepp"):
 +        if env["target"] == "release_debug" or env["target"] == "debug":
-+            print("Found Live++ at %s" % env.get("livepp"))
-+            env.AppendUnique(CPPDEFINES=["LIVEPP_PATH=%s" % env.get("livepp")])
-+            env.AppendUnique(CPPPATH=[env.get("livepp")])
-+            env.AppendUnique(LINKFLAGS=["/FUNCTIONPADMIN"])
++            if os.path.exists(env.get("livepp")):
++                print("Found Live++ at %s" % env.get("livepp"))
++                env.AppendUnique(CPPDEFINES=["LIVEPP_PATH=%s" % env.get("livepp")])
++                env.AppendUnique(CPPPATH=[env.get("livepp")])
++                env.AppendUnique(LINKFLAGS=["/FUNCTIONPADMIN"])
++            else:
++                printf("Specified Live++ path does not exist")
 +        else:
 +            print("Live++ can only be used with targets 'debug' and 'release_debug'")
 +    else:
 +        print("No Live++ specified.")
++
  
  def configure_mingw(env):
      # Workaround for MinGW. See:
 diff --git a/platform/windows/godot_windows.cpp b/platform/windows/godot_windows.cpp
-index d7d9e4eace00a696abbb47cb9632f40e183a4ec4..e362320e51c725cd01f292887bd93442752c1c48 100644
+index ef70c33..957158e 100644
 --- a/platform/windows/godot_windows.cpp
 +++ b/platform/windows/godot_windows.cpp
 @@ -34,6 +34,11 @@
@@ -66,7 +70,7 @@ index d7d9e4eace00a696abbb47cb9632f40e183a4ec4..e362320e51c725cd01f292887bd93442
  // For export templates, add a section; the exporter will patch it to enclose
  // the data appended to the executable (bundled PCK)
  #ifndef TOOLS_ENABLED
-@@ -136,6 +141,16 @@ char *wc_to_utf8(const wchar_t *wc) {
+@@ -147,6 +152,16 @@ char *wc_to_utf8(const wchar_t *wc) {
  }
  
  __declspec(dllexport) int widechar_main(int argc, wchar_t **argv) {
@@ -83,7 +87,7 @@ index d7d9e4eace00a696abbb47cb9632f40e183a4ec4..e362320e51c725cd01f292887bd93442
  	OS_Windows os(NULL);
  
  	setlocale(LC_CTYPE, "");
-@@ -170,6 +185,11 @@ __declspec(dllexport) int widechar_main(int argc, wchar_t **argv) {
+@@ -180,6 +195,11 @@ __declspec(dllexport) int widechar_main(int argc, wchar_t **argv) {
  	}
  	delete[] argv_utf8;
  
@@ -96,7 +100,7 @@ index d7d9e4eace00a696abbb47cb9632f40e183a4ec4..e362320e51c725cd01f292887bd93442
  };
  
 diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
-index 8b28cbf1f23d6574aac41a3676fea64ddf786fc4..0124d4ac9652df9ba682ab8cc18b4008461d74cf 100644
+index 4977d11..6642be9 100644
 --- a/platform/windows/os_windows.cpp
 +++ b/platform/windows/os_windows.cpp
 @@ -53,6 +53,11 @@
@@ -111,7 +115,7 @@ index 8b28cbf1f23d6574aac41a3676fea64ddf786fc4..0124d4ac9652df9ba682ab8cc18b4008
  static const WORD MAX_CONSOLE_LINES = 1500;
  
  extern "C" {
-@@ -3371,6 +3376,9 @@ void OS_Windows::run() {
+@@ -3542,6 +3547,9 @@ void OS_Windows::run() {
  		process_events(); // get rid of pending events
  		if (Main::iteration())
  			break;

+ 7 - 2
spine-godot/build/setup.sh

@@ -29,8 +29,13 @@ if [ $dev = "true" ]; then
 
 	if [ "$OSTYPE" = "msys" ]; then
 		pushd godot
-		git apply ../build/livepp.patch
-		git apply ../build/livepp-v4.patch
+		if [[ $branch == 3* ]]; then
+			echo "Applying V3 Live++ patch"
+			git apply ../build/livepp.patch
+		else
+			echo "Applying V4 Live++ patch"
+			git apply ../build/livepp-v4.patch
+		fi
 		popd
 	fi
 

+ 4 - 0
spine-godot/spine_godot/GodotSpineExtension.cpp

@@ -61,7 +61,11 @@ void GodotSpineExtension::_free(void *mem, const char *file, int line) {
 
 char *GodotSpineExtension::_readFile(const spine::String &path, int *length) {
 	Error error;
+#if VERSION_MAJOR > 3
+	auto res = FileAccess::get_file_as_bytes(String(path.buffer()), &error);
+#else
 	auto res = FileAccess::get_file_as_array(String(path.buffer()), &error);
+#endif
 	if (error != OK) {
 		if (length) *length = 0;
 		return NULL;

+ 9 - 0
spine-godot/spine_godot/SpineEditorPlugin.cpp

@@ -33,6 +33,7 @@
 #include "SpineSkeletonFileResource.h"
 
 #if VERSION_MAJOR > 3
+#include "editor/editor_undo_redo_manager.h"
 Error SpineAtlasResourceImportPlugin::import(const String &source_file, const String &save_path, const HashMap<StringName, Variant> &options, List<String> *platform_variants, List<String> *gen_files, Variant *metadata) {
 #else
 Error SpineAtlasResourceImportPlugin::import(const String &source_file, const String &save_path, const Map<StringName, Variant> &options, List<String> *platform_variants, List<String> *gen_files, Variant *metadata) {
@@ -253,7 +254,11 @@ void SpineEditorPropertyAnimationMix::_bind_methods() {
 void SpineEditorPropertyAnimationMix::data_changed(const String &property, const Variant &value, const String &name, bool changing) {
 	auto mix = Object::cast_to<SpineAnimationMix>(get_edited_object()->get(get_edited_property()));
 
+#if VERSION_MAJOR > 3
+	auto undo_redo = EditorUndoRedoManager::get_singleton();
+#else
 	auto undo_redo = EditorNode::get_undo_redo();
+#endif
 	undo_redo->create_action("Set mix property " + property);
 	undo_redo->add_do_property(mix, property, value);
 	undo_redo->add_undo_property(mix, property, mix->get(property));
@@ -273,7 +278,11 @@ void SpineEditorPropertyAnimationMix::update_property() {
 
 	if (container) {
 		memdelete(container);
+#if VERSION_MAJOR > 3
+		SceneTree::get_singleton()->queue_delete(container);
+#else
 		container->queue_delete();
+#endif
 		container = nullptr;
 	}
 

+ 3 - 0
spine-godot/spine_godot/SpineEditorPlugin.h

@@ -32,6 +32,9 @@
 #ifdef TOOLS_ENABLED
 #include "SpineCommon.h"
 #include "SpineSprite.h"
+#if VERSION_MAJOR > 3
+#include "editor/import/editor_import_plugin.h"
+#endif
 #include "editor/editor_node.h"
 #include "editor/editor_properties.h"
 #include "editor/editor_properties_array_dict.h"

+ 4 - 0
spine-godot/spine_godot/SpineSkeletonFileResource.cpp

@@ -122,7 +122,11 @@ Error SpineSkeletonFileResource::load_from_file(const String &path) {
 		if (error != OK) return error;
 		if (!checkJson(json.utf8())) return ERR_INVALID_DATA;
 	} else {
+#if VERSION_MAJOR > 3
+		binary = FileAccess::get_file_as_bytes(path, &error);
+#else
 		binary = FileAccess::get_file_as_array(path, &error);
+#endif
 		if (error != OK) return error;
 		if (!checkBinary((const char *) binary.ptr(), binary.size())) return ERR_INVALID_DATA;
 	}

+ 13 - 3
spine-godot/spine_godot/register_types.cpp

@@ -28,6 +28,7 @@
  *****************************************************************************/
 
 #include "SpineCommon.h"
+#include "modules/register_module_types.h"
 #include "register_types.h"
 #include "SpineAtlasResource.h"
 #include "SpineSkeletonFileResource.h"
@@ -70,12 +71,20 @@ static void editor_init_callback() {
 
 #if VERSION_MAJOR > 3
 void initialize_spine_godot_module(ModuleInitializationLevel level) {
+	if (level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
+#ifdef TOOLS_ENABLED
+		EditorNode::add_init_callback(editor_init_callback);
+		GDREGISTER_CLASS(SpineEditorPropertyAnimationMixes);
+		return;
+#endif
+	}
+	if (level != MODULE_INITIALIZATION_LEVEL_CORE) return;
 #else
 void register_spine_godot_types() {
-#endif
 #ifdef TOOLS_ENABLED
 	EditorNode::add_init_callback(editor_init_callback);
 	GDREGISTER_CLASS(SpineEditorPropertyAnimationMixes);
+#endif
 #endif
 	spine::Bone::setYDown(true);
 	GDREGISTER_CLASS(SpineObjectWrapper);
@@ -140,13 +149,14 @@ void register_spine_godot_types() {
 
 #if VERSION_MAJOR > 3
 void uninitialize_spine_godot_module(ModuleInitializationLevel level) {
+	if (level != MODULE_INITIALIZATION_LEVEL_CORE) return;
 #else
 void unregister_spine_godot_types() {
 #endif
-	ResourceLoader::remove_resource_format_loader(atlas_loader);
+	/*ResourceLoader::remove_resource_format_loader(atlas_loader);
 	ResourceSaver::remove_resource_format_saver(atlas_saver);
 	ResourceLoader::remove_resource_format_loader(skeleton_file_loader);
-	ResourceSaver::remove_resource_format_saver(skeleton_file_saver);
+	ResourceSaver::remove_resource_format_saver(skeleton_file_saver);*/
 
 	/*memdelete(atlas_loader);
 	memdelete(atlas_saver);