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

    骨骼动画释放完成。

  • 相关阅读:
    Spring Boot 自定义属性 以及 乱码问题
    IDEA 修改文件编码
    Gojs简单例子
    无法转换json问题 Error: Model.nodeDataArray value is not an instance of Array or NodeList or HTMLCollection
    java json转换
    git设置HTTP代理
    thymeleaf中的日期格式化
    thymeleaf:字符串Strings常见的使用方法
    thymeleaf+bootstrap,onclick传参实现模态框中遇到的错误
    Thymeleaf教程 (十二) 标签内,js中使用表达式
  • 原文地址:https://www.cnblogs.com/android-qian/p/3818506.html
Copyright © 2011-2022 走看看