Skip to content

Commit 055d6f2

Browse files
committed
[godot] Fix Godot 4.7 raw Spine asset loading
Closes #3138.
1 parent 560d2ff commit 055d6f2

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@
325325
- Fixed GDExtension animation mix editing in the Godot inspector.
326326
- Fixed `SpineBoneNode` and `SpineSlotNode` transforms when bones use negative scale or shear, and applied `SpineBoneNode` Drive mode before world transforms are computed.
327327
- Fixed `SpineSlotNode` and global bone transforms exposing the runtime Y-down coordinate conversion as negative Godot Node2D Y scale.
328+
- Fixed Godot 4.7 GDExtension resource loading for raw `.skel`, `.spine-json`, and `.atlas` Spine asset files.
328329
- Updated Godot 4.x CI builds to Godot 4.6.2.
329330
- Fixed Godot 4.6 Windows editor CI builds by installing Direct3D 12 SDK dependencies before building Godot.
330331
- Fixed Godot 4.6 GDExtension builds with the latest `godot-cpp` by including the required `Ref` support header in `SpineCommon.h`, updated `SpineEventData` for the `EventData.setupPose` API change, and refreshed vendored `spine-cpp` sources during clean setup.

‎spine-godot/spine_godot/SpineAtlasResource.cpp‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,10 @@ RES SpineAtlasResourceFormatLoader::load(const String &path, const String &origi
445445
#endif
446446
#endif
447447
Ref<SpineAtlasResource> atlas = memnew(SpineAtlasResource);
448-
atlas->load_from_file(path);
448+
if (path.ends_with(".atlas"))
449+
atlas->load_from_atlas_file(path);
450+
else
451+
atlas->load_from_file(path);
449452
#ifndef SPINE_GODOT_EXTENSION
450453
if (error) *error = OK;
451454
#endif
@@ -457,11 +460,14 @@ RES SpineAtlasResourceFormatLoader::load(const String &path, const String &origi
457460
PackedStringArray SpineAtlasResourceFormatLoader::_get_recognized_extensions() {
458461
PackedStringArray extensions;
459462
extensions.push_back("spatlas");
463+
extensions.push_back("atlas");
460464
return extensions;
461465
}
462466
#else
463467
void SpineAtlasResourceFormatLoader::get_recognized_extensions(List<String> *extensions) const {
464-
const char atlas_ext[] = "spatlas";
468+
const char spatlas_ext[] = "spatlas";
469+
if (!extensions->find(spatlas_ext)) extensions->push_back(spatlas_ext);
470+
const char atlas_ext[] = "atlas";
465471
if (!extensions->find(atlas_ext)) extensions->push_back(atlas_ext);
466472
}
467473
#endif

‎spine-godot/spine_godot/SpineSkeletonFileResource.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,16 @@ PackedStringArray SpineSkeletonFileResourceFormatLoader::_get_recognized_extensi
223223
PackedStringArray extensions;
224224
extensions.push_back("spjson");
225225
extensions.push_back("spskel");
226+
extensions.push_back("spine-json");
227+
extensions.push_back("skel");
226228
return extensions;
227229
}
228230
#else
229231
void SpineSkeletonFileResourceFormatLoader::get_recognized_extensions(List<String> *extensions) const {
230232
extensions->push_back("spjson");
231233
extensions->push_back("spskel");
234+
extensions->push_back("spine-json");
235+
extensions->push_back("skel");
232236
}
233237
#endif
234238

0 commit comments

Comments
 (0)