我使用的是2.2.2,异步加载的骨骼动画,在移除后还是材质的引用计数还是很大。
经调试发现 骨骼数据被缓存起来的Key是空字符串
修改如下:
1.把骨骼文件名绑定进入
CCDataReaderHelper.cpp
552:
旧: CCArmatureDataManager::sharedArmatureDataManager()->addSpriteFrameFromFile(
pAsyncStruct->plistPath.c_str(),
pAsyncStruct->imagePath.c_str());
新 CCArmatureDataManager::sharedArmatureDataManager()->addSpriteFrameFromFile(
pAsyncStruct->plistPath.c_str(),
pAsyncStruct->imagePath.c_str(),
pAsyncStruct->filename.c_str());
560:
旧: 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(),
pAsyncStruct->filename.c_str());
4. 这句移除骨骼数据时,也移除对应的材质
CCArmatureDataManager
135
//添加
std::string texturePath = i->c_str();
texturePath = texturePath.erase(texturePath.find_last_of("."));
texturePath= texturePath + “.png”;
CCTextureCache::sharedTextureCache()->removeTextureForKey(texturePath.c_str());
//end