From f5caeacf0ce5ffc86a89d115a312a2185cfefd40 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Fri, 6 Oct 2023 11:15:21 +0200 Subject: [PATCH] [godot] Fix compilation errors with 3.5.3, fix const correctness. --- spine-godot/spine_godot/SpineAtlasResource.cpp | 2 ++ spine-godot/spine_godot/SpineAtlasResource.h | 8 +++++--- spine-godot/spine_godot/SpineSkeletonFileResource.cpp | 6 +++++- spine-godot/spine_godot/SpineSkeletonFileResource.h | 2 ++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/spine-godot/spine_godot/SpineAtlasResource.cpp b/spine-godot/spine_godot/SpineAtlasResource.cpp index e588ac7af..dbe3b747a 100644 --- a/spine-godot/spine_godot/SpineAtlasResource.cpp +++ b/spine-godot/spine_godot/SpineAtlasResource.cpp @@ -232,6 +232,7 @@ Error SpineAtlasResource::save_to_file(const String &path) { return OK; } +#if VERSION_MAJOR > 3 Error SpineAtlasResource::copy_from(const Ref &p_resource) { auto error = Resource::copy_from(p_resource); if (error != OK) return error; @@ -251,6 +252,7 @@ Error SpineAtlasResource::copy_from(const Ref &p_resource) { return OK; } +#endif #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) { diff --git a/spine-godot/spine_godot/SpineAtlasResource.h b/spine-godot/spine_godot/SpineAtlasResource.h index af27d6cd9..55807a58e 100644 --- a/spine-godot/spine_godot/SpineAtlasResource.h +++ b/spine-godot/spine_godot/SpineAtlasResource.h @@ -45,8 +45,8 @@ class SpineAtlasResource : public Resource { protected: static void _bind_methods(); - spine::Atlas *atlas; - GodotSpineTextureLoader *texture_loader; + mutable spine::Atlas *atlas; + mutable GodotSpineTextureLoader *texture_loader; String source_path; String atlas_data; @@ -69,7 +69,9 @@ public: Error save_to_file(const String &path);// .spatlas +#if VERSION_MAJOR > 3 virtual Error copy_from(const Ref &p_resource); +#endif String get_source_path(); @@ -77,7 +79,7 @@ public: Array get_normal_maps(); - const void clear_native_data() { + void clear_native_data() const { this->atlas = nullptr; this->texture_loader = nullptr; } diff --git a/spine-godot/spine_godot/SpineSkeletonFileResource.cpp b/spine-godot/spine_godot/SpineSkeletonFileResource.cpp index 0929ba5cf..7880d2a25 100644 --- a/spine-godot/spine_godot/SpineSkeletonFileResource.cpp +++ b/spine-godot/spine_godot/SpineSkeletonFileResource.cpp @@ -28,11 +28,13 @@ *****************************************************************************/ #include "SpineSkeletonFileResource.h" +#if VERSION_MAJOR > 3 #include "core/error/error_list.h" #include "core/error/error_macros.h" -#if VERSION_MAJOR > 3 #include "core/io/file_access.h" #else +#include "core/error_list.h" +#include "core/error_macros.h" #include "core/os/file_access.h" #endif #include @@ -160,6 +162,7 @@ Error SpineSkeletonFileResource::save_to_file(const String &path) { return OK; } +#if VERSION_MAJOR > 3 Error SpineSkeletonFileResource::copy_from(const Ref &p_resource) { auto error = Resource::copy_from(p_resource); if (error != OK) return error; @@ -169,6 +172,7 @@ Error SpineSkeletonFileResource::copy_from(const Ref &p_resource) { emit_signal(SNAME("skeleton_file_changed")); return OK; } +#endif #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) { diff --git a/spine-godot/spine_godot/SpineSkeletonFileResource.h b/spine-godot/spine_godot/SpineSkeletonFileResource.h index c3b35569c..94924d3f5 100644 --- a/spine-godot/spine_godot/SpineSkeletonFileResource.h +++ b/spine-godot/spine_godot/SpineSkeletonFileResource.h @@ -53,7 +53,9 @@ public: Error save_to_file(const String &path); +#if VERSION_MAJOR > 3 virtual Error copy_from(const Ref &p_resource); +#endif }; class SpineSkeletonFileResourceFormatLoader : public ResourceFormatLoader {