Browse Source

[godot] Fix compatibility with Godot 3.6, make it default build for 3.x. Closes #2647

Mario Zechner 9 tháng trước cách đây
mục cha
commit
c58d4c7522

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

@@ -12,8 +12,8 @@ env:
   AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
   AWS_EC2_METADATA_DISABLED: true
   EM_VERSION: 3.1.14
-  GODOT_TAG: 3.5.3-stable
-  GODOT_VERSION: 3.5.3.stable
+  GODOT_TAG: 3.6-stable
+  GODOT_VERSION: 3.6.stable
 
 jobs:
   godot-editor-windows:

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

@@ -257,7 +257,11 @@ Error SpineAtlasResource::copy_from(const Ref<Resource> &p_resource) {
 #if VERSION_MAJOR > 3
 RES SpineAtlasResourceFormatLoader::load(const String &path, const String &original_path, Error *error, bool use_sub_threads, float *progress, CacheMode cache_mode) {
 #else
+#if VERSION_MINOR > 5
+RES SpineAtlasResourceFormatLoader::load(const String &path, const String &original_path, Error *error, bool p_no_subresource_cache) {
+#else
 RES SpineAtlasResourceFormatLoader::load(const String &path, const String &original_path, Error *error) {
+#endif
 #endif
 	Ref<SpineAtlasResource> atlas = memnew(SpineAtlasResource);
 	atlas->load_from_file(path);

+ 4 - 0
spine-godot/spine_godot/SpineAtlasResource.h

@@ -91,8 +91,12 @@ class SpineAtlasResourceFormatLoader : public ResourceFormatLoader {
 public:
 #if VERSION_MAJOR > 3
 	RES load(const String &path, const String &original_path, Error *error, bool use_sub_threads, float *progress, CacheMode cache_mode) override;
+#else
+#if VERSION_MINOR > 5
+	RES load(const String &path, const String &original_path, Error *error, bool no_subresource_cache = false) override;
 #else
 	RES load(const String &path, const String &original_path, Error *error) override;
+#endif
 #endif
 
 	void get_recognized_extensions(List<String> *extensions) const override;

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

@@ -177,7 +177,11 @@ Error SpineSkeletonFileResource::copy_from(const Ref<Resource> &p_resource) {
 #if VERSION_MAJOR > 3
 RES SpineSkeletonFileResourceFormatLoader::load(const String &path, const String &original_path, Error *error, bool use_sub_threads, float *progress, CacheMode cache_mode) {
 #else
+#if MINOR_VERSION > 5
+RES SpineSkeletonFileResourceFormatLoader::load(const String &path, const String &original_path, Error *error, bool no_subresource_cache) {
+#else
 RES SpineSkeletonFileResourceFormatLoader::load(const String &path, const String &original_path, Error *error) {
+#endif
 #endif
 	Ref<SpineSkeletonFileResource> skeleton_file = memnew(SpineSkeletonFileResource);
 	skeleton_file->load_from_file(path);

+ 6 - 2
spine-godot/spine_godot/SpineSkeletonFileResource.h

@@ -65,7 +65,11 @@ public:
 #if VERSION_MAJOR > 3
 	RES load(const String &path, const String &original_path, Error *error, bool use_sub_threads, float *progress, CacheMode cache_mode);
 #else
-	RES load(const String &path, const String &original_path, Error *error) override;
+#if VERSION_MINOR > 5
+	RES load(const String &path, const String &original_path, Error *error, bool no_subresource_cache = false);
+#else
+	RES load(const String &path, const String &original_path, Error *error);
+#endif
 #endif
 
 	void get_recognized_extensions(List<String> *extensions) const override;
@@ -82,7 +86,7 @@ public:
 #if VERSION_MAJOR > 3
 	Error save(const RES &resource, const String &path, uint32_t flags) override;
 #else
-	Error save(const String &path, const RES &resource, uint32_t flags) override;
+	Error save(const String &path, const RES &resource, uint32_t flags);
 #endif
 
 	void get_recognized_extensions(const RES &resource, List<String> *p_extensions) const override;