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): the timeline counter was the debug constant I read it with

esengine74afee3ff807
diff --git a/sdk/tests/spine-pose-stages.test.ts b/sdk/tests/spine-pose-stages.test.ts
index 453899295..c1c487829 100644
--- a/sdk/tests/spine-pose-stages.test.ts
+++ b/sdk/tests/spine-pose-stages.test.ts
@@ -165,7 +165,10 @@ describe.skipIf(!HAS_ASSETS)('the staged pose is the shipped pose', () => {
expect(c.tracks).toBe(1);
expect(c.entries).toBe(1);
- expect(c.timelines, 'a playing track carries no timelines').toBeGreaterThan(0);
+ // Exact, not "more than none": a counter wired to a constant satisfies
+ // every inequality that could be written about it, and one of these was
+ // shipped reading 0xAAAA for two commits before a survey read it back.
+ expect(c.timelines, "walk's timelines").toBe(38);
expect(c.bones).toBe(64);
expect(c.ikConstraints).toBe(7);
expect(c.transformConstraints).toBe(7);
@@ -199,6 +202,7 @@ describe.skipIf(!HAS_ASSETS)('the staged pose is the shipped pose', () => {
expect(mixing.tracks, 'a mix is one track').toBe(1);
expect(mixing.entries, 'the entry it is mixing out of did not apply').toBe(2);
- expect(mixing.timelines).toBeGreaterThan(solo.timelines);
+ expect(solo.timelines, "walk's timelines").toBe(38);
+ expect(mixing.timelines, "run's 41 on top of walk's 38").toBe(79);
});
});
diff --git a/src/esengine/bindings/modules/spine/SpineRuntimeC.cpp b/src/esengine/bindings/modules/spine/SpineRuntimeC.cpp
index 52ddc9400..21c88445e 100644
--- a/src/esengine/bindings/modules/spine/SpineRuntimeC.cpp
+++ b/src/esengine/bindings/modules/spine/SpineRuntimeC.cpp
@@ -304,7 +304,7 @@ namespace {
void countTrack(spTrackEntry* entry, PoseCounts& counts) {
for (; entry; entry = entry->mixingFrom) {
++counts.entries;
- counts.timelines += entry->animation ? 0xAAAAu : 0xBBBBu;
+ if (entry->animation) counts.timelines += static_cast<std::uint32_t>(entry->animation->timelinesCount);
}
}