i'm using cocos2d-x 2.2.3 and spine 1.9.07. I've exported "seller.atlas", "seller.json" and "seller.png" by Spine and put them in Resource folder of my project. Then, in init() method I add these code to use skeleton animation
skeletonNode = CCSkeletonAnimation::createWithFile("spine/seller.json", "spine/seller.atlas");
skeletonNode->debugSlots = true;
skeletonNode->timeScale = 0.5f;
skeletonNode->setAnimation("walk", true);
skeletonNode->debugBones = true;
CCSize windowSize = CCDirector::sharedDirector()->getWinSize();
skeletonNode->setPosition(ccp(windowSize.width / 2, 50));
addChild(skeletonNode);
but It throws out an error like this
void CCObject::release(void)
{
CCAssert(m_uReference > 0, "reference count should greater than 0");
--m_uReference;
if (m_uReference == 0)
{
delete this;
}
}
It means that skeletonNode is NULL so it must be something wrong with the atlas file. But I don't know what wrong is it :(
Any help would be appreciated! :D
It's because cocos2dx 2.2.3 is using an old spine parser. Spine 1.9 generates atlas files in a different format. there is an extra line of "size: xxx,xxx". To address this specific problem, add readLine(0, end, &str); in Atlas.cpp before if (!readValue(end, &str)) return abortAtlas(self);
Note you might run into other problems such as unknown attachment type mesh/skinned mesh since Spine 1.9 using new format. You need to update spine code in 2.2.3 to fix all.