Spine Atlas文件出错

时间:2014-07-25 02:49:24

标签: cocos2d-x-2.x

我使用cocos2d-x 2.2.3和spine 1.9.07。 我已经导出" seller.atlas"," seller.json"和" seller.png"通过Spine将它们放在我项目的Resource文件夹中。然后,在init()方法中,我添加这些代码以使用骨架动画

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);

但它会抛出这样的错误

    void CCObject::release(void)
{
    CCAssert(m_uReference > 0, "reference count should greater than 0");
    --m_uReference;

    if (m_uReference == 0)
    {
        delete this;
    }
}

这意味着skeletonNode为NULL,因此它必须与atlas文件有关。 但我不知道它有什么不对:(

任何帮助将不胜感激! :d

1 个答案:

答案 0 :(得分:0)

这是因为cocos2dx 2.2.3正在使用旧的脊柱解析器。 Spine 1.9以不同的格式生成atlas文件。还有一行"大小:xxx,xxx"。 要解决此特定问题,请添加 readLine(0,end,& str); 在Atlas.cpp 之前 if(!readValue(end,& str))return abortAtlas(self);

请注意,自从Spine 1.9使用新格式后,您可能遇到其他问题,例如未知附件类型网格/蒙皮网格。您需要更新2.2.3中的脊柱代码以修复所有问题。