Skip to content

Commit

Permalink
[godot] Fix compilation errors with 3.5.3, fix const correctness.
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Oct 6, 2023
1 parent 97fb551 commit f5caeac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions spine-godot/spine_godot/SpineAtlasResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
8 changes: 5 additions & 3 deletions spine-godot/spine_godot/SpineAtlasResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -69,15 +69,17 @@ class SpineAtlasResource : public Resource {

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();

Array get_textures();

Array get_normal_maps();

const void clear_native_data() {
void clear_native_data() const {
this->atlas = nullptr;
this->texture_loader = nullptr;
}
Expand Down
6 changes: 5 additions & 1 deletion spine-godot/spine_godot/SpineSkeletonFileResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions spine-godot/spine_godot/SpineSkeletonFileResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ class SpineSkeletonFileResource : public Resource {

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 {
Expand Down

0 comments on commit f5caeac

Please sign in to comment.