zoukankan      html  css  js  c++  java
  • cocos2dx 2.2.1 骨骼动画释放

    2.2.1中骨骼动画释放不完全,需要更改源码进行手动释放,释放方法不能放在析构函数和onExit()函数中。

    第一步修改源码:文件位置:extensions/CocoStudio/Armature/utils/CCDataReaderHelper.cpp;

     if (pAsyncStruct->imagePath != "" && pAsyncStruct->plistPath != ""){
           pthread_mutex_lock(&s_GetFileDataMutex);                  
    (删除)CCArmatureDataManager::sharedArmatureDataManager()->addSpriteFrameFromFile(pAsyncStruct->plistPath.c_str(), pAsyncStruct->imagePath.c_str());
    (更改为)CCArmatureDataManager::sharedArmatureDataManager()->addSpriteFrameFromFile(pAsyncStruct->plistPath.c_str(), pAsyncStruct->imagePath.c_str(), pDataInfo->filename.c_str()); pthread_mutex_unlock(&s_GetFileDataMutex); } CCDataReaderHelper::addDataAsyncCallBack(float dt) { std::string configPath = pDataInfo->configFileQueue.front(); pthread_mutex_lock(&s_GetFileDataMutex); (删除)CCArmatureDataManager::sharedArmatureDataManager()->addSpriteFrameFromFile((pAsyncStruct->baseFilePath + configPath + ".plist").c_str(), (pAsyncStruct->baseFilePath + configPath + ".png").c_str()); (更改为)CCArmatureDataManager::sharedArmatureDataManager()->addSpriteFrameFromFile((pAsyncStruct->baseFilePath + configPath + ".plist").c_str(), (pAsyncStruct->baseFilePath + configPath + ".png").c_str(), pDataInfo->filename.c_str()); pthread_mutex_unlock(&s_GetFileDataMutex); pDataInfo->configFileQueue.pop(); }

    第二步在删除骨骼动画的函数中调用:

            armature->removeFromParent();
            CCArmatureDataManager::sharedArmatureDataManager()->removeArmatureFileInfo("Armature/123/123.ExportJson");
            CCTextureCache::sharedTextureCache()->removeAllTextures();

    骨骼动画释放完成。

  • 相关阅读:
    document.write("x3cx54")?是加密了吗?
    SQL中以count及sum为条件的查询
    给MyEclipse 10增加SVN功能
    iOS参考工具和资源
    Apple Developer参考资料
    [转]最常见的20个jQuery面试问题及答案
    丢掉鼠标-Mac神软Alfred使用手册
    jQuery执行进度提示窗口的实现(progressbar)
    [转]5个JavaScript面试题
    自己写的POIUtil,主要解决从不同的HSSFWorkbook复制sheet以及根据单元格插入图片等
  • 原文地址:https://www.cnblogs.com/android-qian/p/3818506.html
Copyright © 2011-2022 走看看