mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 01:06:00 +08:00
[godot] Fix 4.5 compat, build 4.5.1 and 4.4.1 on GH
This commit is contained in:
parent
880f3c59f5
commit
43ce791931
@ -14,8 +14,8 @@ jobs:
|
||||
matrix:
|
||||
version:
|
||||
[
|
||||
{"tag": "4.5.1-stable", "version": "4.5.1.stable", "dev": false},
|
||||
{"tag": "4.4.1-stable", "version": "4.4.1.stable", "dev": false},
|
||||
{"tag": "4.3-stable", "version": "4.3.stable", "dev": false},
|
||||
]
|
||||
uses: ./.github/workflows/spine-godot-extension-v4.yml
|
||||
with:
|
||||
|
||||
4
.github/workflows/spine-godot-v4-all.yml
vendored
4
.github/workflows/spine-godot-v4-all.yml
vendored
@ -14,10 +14,10 @@ jobs:
|
||||
matrix:
|
||||
version:
|
||||
[
|
||||
{"tag": "4.5.1-stable", "version": "4.5.1.stable", "mono": false},
|
||||
{"tag": "4.5.1-stable", "version": "4.5.1.stable", "mono": true},
|
||||
{"tag": "4.4.1-stable", "version": "4.4.1.stable", "mono": false},
|
||||
{"tag": "4.4.1-stable", "version": "4.4.1.stable", "mono": true},
|
||||
{"tag": "4.3-stable", "version": "4.3.stable", "mono": false},
|
||||
{"tag": "4.3-stable", "version": "4.3.stable", "mono": true},
|
||||
]
|
||||
uses: ./.github/workflows/spine-godot-v4.yml
|
||||
with:
|
||||
|
||||
@ -300,7 +300,8 @@ Error SpineAtlasResource::load_from_atlas_file_internal(const String &path, bool
|
||||
clear();
|
||||
texture_loader = new GodotSpineTextureLoader(&textures, &normal_maps, &specular_maps, normal_map_prefix, specular_map_prefix, is_importing);
|
||||
auto atlas_utf8 = atlas_data.utf8();
|
||||
atlas = new spine::Atlas(atlas_utf8, atlas_utf8.length(), source_path.get_base_dir().utf8(), texture_loader);
|
||||
auto dir_utf8 = source_path.get_base_dir().utf8();
|
||||
atlas = new spine::Atlas(atlas_utf8.ptr(), atlas_utf8.length(), dir_utf8.ptr(), texture_loader);
|
||||
if (atlas) return OK;
|
||||
|
||||
clear();
|
||||
@ -343,7 +344,8 @@ Error SpineAtlasResource::load_from_file(const String &path) {
|
||||
clear();
|
||||
texture_loader = new GodotSpineTextureLoader(&textures, &normal_maps, &specular_maps, normal_map_prefix, specular_map_prefix, false);
|
||||
auto utf8 = atlas_data.utf8();
|
||||
atlas = new spine::Atlas(utf8.ptr(), utf8.size(), source_path.get_base_dir().utf8(), texture_loader);
|
||||
auto dir_utf8 = source_path.get_base_dir().utf8();
|
||||
atlas = new spine::Atlas(utf8.ptr(), utf8.size(), dir_utf8.ptr(), texture_loader);
|
||||
if (atlas) return OK;
|
||||
|
||||
clear();
|
||||
|
||||
@ -109,8 +109,8 @@ using namespace godot;
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#define SPINE_STRING(x) spine::String((x).utf8())
|
||||
#define SPINE_STRING_TMP(x) spine::String((x).utf8(), true, false)
|
||||
#define SPINE_STRING(x) spine::String((x).utf8().ptr())
|
||||
#define SPINE_STRING_TMP(x) spine::String((x).utf8().ptr(), true, false)
|
||||
|
||||
// Can't do template classes with Godot's object model :(
|
||||
class SpineObjectWrapper : public REFCOUNTED {
|
||||
|
||||
@ -27,8 +27,6 @@
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#define VERSION_MAJOR 4
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "SpineEditorPlugin.h"
|
||||
#include "SpineAtlasResource.h"
|
||||
|
||||
@ -44,9 +44,14 @@
|
||||
#include <godot_cpp/classes/editor_property.hpp>
|
||||
#else
|
||||
#include "editor/editor_node.h"
|
||||
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
|
||||
#include "editor/inspector/editor_properties.h"
|
||||
#include "editor/inspector/editor_properties_array_dict.h"
|
||||
#else
|
||||
#include "editor/editor_properties.h"
|
||||
#include "editor/editor_properties_array_dict.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class SpineAtlasResourceImportPlugin : public EditorImportPlugin {
|
||||
GDCLASS(SpineAtlasResourceImportPlugin, EditorImportPlugin)
|
||||
|
||||
@ -85,7 +85,7 @@ String SpineEvent::get_string_value() {
|
||||
|
||||
void SpineEvent::set_string_value(const String &v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setStringValue(spine::String(v.utf8()));
|
||||
get_spine_object()->setStringValue(spine::String(v.utf8().ptr()));
|
||||
}
|
||||
|
||||
float SpineEvent::get_volume() {
|
||||
|
||||
@ -84,7 +84,7 @@ String SpineEventData::get_string_value() {
|
||||
|
||||
void SpineEventData::set_string_value(const String &v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setStringValue(spine::String(v.utf8()));
|
||||
get_spine_object()->setStringValue(spine::String(v.utf8().ptr()));
|
||||
}
|
||||
|
||||
String SpineEventData::get_audio_path() {
|
||||
@ -94,7 +94,7 @@ String SpineEventData::get_audio_path() {
|
||||
|
||||
void SpineEventData::set_audio_path(const String &v) {
|
||||
SPINE_CHECK(get_spine_object(), )
|
||||
get_spine_object()->setAudioPath(spine::String(v.utf8()));
|
||||
get_spine_object()->setAudioPath(spine::String(v.utf8().ptr()));
|
||||
}
|
||||
|
||||
float SpineEventData::get_volume() {
|
||||
|
||||
@ -52,9 +52,13 @@
|
||||
#ifdef SPINE_GODOT_EXTENSION
|
||||
#include <godot_cpp/classes/editor_file_system.hpp>
|
||||
#else
|
||||
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
|
||||
#include "editor/file_system/editor_file_system.h"
|
||||
#else
|
||||
#include "editor/editor_file_system.h"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void SpineAnimationMix::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_from", "from"),
|
||||
@ -339,7 +343,7 @@ void SpineSkeletonDataResource::load_resources(spine::Atlas *atlas,
|
||||
spine::SkeletonData *data;
|
||||
if (!EMPTY(json)) {
|
||||
spine::SkeletonJson skeletonJson(atlas);
|
||||
data = skeletonJson.readSkeletonData(json.utf8());
|
||||
data = skeletonJson.readSkeletonData(json.utf8().ptr());
|
||||
if (!data) {
|
||||
ERR_PRINT(String("Error while loading skeleton data: ") + get_path());
|
||||
ERR_PRINT(String("Error message: ") + skeletonJson.getError().buffer());
|
||||
|
||||
@ -135,7 +135,7 @@ Error SpineSkeletonFileResource::load_from_file(const String &path) {
|
||||
json = FileAccess::get_file_as_string(path, &error);
|
||||
if (error != OK) return error;
|
||||
#endif
|
||||
if (!checkJson(json.utf8())) return ERR_INVALID_DATA;
|
||||
if (!checkJson(json.utf8().ptr())) return ERR_INVALID_DATA;
|
||||
} else {
|
||||
#ifdef SPINE_GODOT_EXTENSION
|
||||
binary = FileAccess::get_file_as_bytes(path);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user