[godot] Fix compilation errors with 3.5.3, fix const correctness.

This commit is contained in:
Mario Zechner 2023-10-06 11:15:21 +02:00
parent 97fb551cee
commit f5caeacf0c
4 changed files with 14 additions and 4 deletions

View File

@ -232,6 +232,7 @@ Error SpineAtlasResource::save_to_file(const String &path) {
return OK;
}
#if VERSION_MAJOR > 3
Error SpineAtlasResource::copy_from(const Ref<Resource> &p_resource) {
auto error = Resource::copy_from(p_resource);
if (error != OK) return error;
@ -251,6 +252,7 @@ Error SpineAtlasResource::copy_from(const Ref<Resource> &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) {

View File

@ -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<Resource> &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;
}

View File

@ -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 <spine/Json.h>
@ -160,6 +162,7 @@ Error SpineSkeletonFileResource::save_to_file(const String &path) {
return OK;
}
#if VERSION_MAJOR > 3
Error SpineSkeletonFileResource::copy_from(const Ref<Resource> &p_resource) {
auto error = Resource::copy_from(p_resource);
if (error != OK) return error;
@ -169,6 +172,7 @@ Error SpineSkeletonFileResource::copy_from(const Ref<Resource> &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) {

View File

@ -53,7 +53,9 @@ public:
Error save_to_file(const String &path);
#if VERSION_MAJOR > 3
virtual Error copy_from(const Ref<Resource> &p_resource);
#endif
};
class SpineSkeletonFileResourceFormatLoader : public ResourceFormatLoader {