SkeletonData.getRuntimeData is not a function (bug?)

I originally posted in this other thread since it’s sort of related:


but breaking off into a new thread.

When I do this.getComponent(sp.Skeleton).skeletonData.getRuntimeData() in the browser, it works fine, but in the “Simulator” it gives
Simulator: TypeError: [...].getRuntimeData is not a function at a: "[...].getRuntimeData()"

In my game I want to do getRuntimeData() to get .width and .height members from it for scaling Spine skeletons at runtime dynamically.
I’m on Cocos Creator version 1.5.1.

In the browser, skeleton.skeletonData returns a sp.spine.SkeletonData type object (like the documentation says it should). We can verify this by logging with JSON.stringify() and getting a circular reference error, and when we don’t log, everything just works. Also, normal debugging inspection on Chrome.

However, in the simulator, it returns what looks like the SkeletonData.skeletonJson (NOT the sp.spine.SkeletonData parent that it should be returning), or at least a version of SkeletonData without the method. I’m using JSON.stringify() to log this out since I’m not aware of any other ways to debug this “simulator”.

In the meantime, I’ve found a functional work-around.

skeleton.skeletonData._skeletonJson.skeleton. {width / height}