Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(spine): 4.1 moved the timeline list into an array type

esengine847680eb0d1e
diff --git a/src/esengine/bindings/modules/spine/SpineRuntimeC.cpp b/src/esengine/bindings/modules/spine/SpineRuntimeC.cpp
index 21c88445e..0e36435b1 100644
--- a/src/esengine/bindings/modules/spine/SpineRuntimeC.cpp
+++ b/src/esengine/bindings/modules/spine/SpineRuntimeC.cpp
@@ -304,7 +304,13 @@ namespace {
void countTrack(spTrackEntry* entry, PoseCounts& counts) {
for (; entry; entry = entry->mixingFrom) {
++counts.entries;
- if (entry->animation) counts.timelines += static_cast<std::uint32_t>(entry->animation->timelinesCount);
+ if (!entry->animation) continue;
+#if ES_SPINE_VERSION >= 41
+ // 4.1 moved the timeline list into an array type; 3.8 counts them itself.
+ counts.timelines += static_cast<std::uint32_t>(entry->animation->timelines->size);
+#else
+ counts.timelines += static_cast<std::uint32_t>(entry->animation->timelinesCount);
+#endif
}
}