3.0rc0 的CCArmature用setMovementEventCallFunc

3.0rc0 的CCArmature用setMovementEventCallFunc,播放结束后删除动画,ArmatureAnimation里的update提示event事件为空。怎么回事哦?

您好,请问您是如何添加的监听呢?setMovementEventCallFunc直接用update并不合适。希望您能提供更完整的代码段以便我们帮助您解决问题。感谢您对cocostudio的支持。

void HeroUpgradeUI::effectUpLoaded(float percent){
if (percent >= 1){
auto armaSkill = CCArmature::create(“levelup_level”);
armaSkill->getAnimation()->playByIndex(0);
armaSkill->getAnimation()->setSpeedScale(0.5);
_heroBg->addNode(armaSkill,10);
armaSkill->getAnimation()->setMovementEventCallFunc(CC_CALLBACK_0(HeroUpgradeUI::effectUpEnd,this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
}
}

void HeroUpgradeUI::effectUpEnd(Armature *armature, MovementEventType movementType, const std::string& movementID){
if (movementType == COMPLETE)
{
armature->stopAllActions();
_heroBg->removeNode(armature);
ArmatureDataManager::getInstance()->removeArmatureFileInfo(“skill/levelup_level.ExportJson”);
armature=nullotr;
}
}

啊哦,怎么没声音啦。顶上来先,3.0b2是正常的呢,同样的代码

请尝试使用如下方法添加监听:

armature->getAnimation()->setMovementEventCallFunc(this, movementEvent_selector(TestAnimationEvent::animationEvent));

如果失败请您提供具体的示例,我们将帮助您查找问题原因,感谢您对cocostudio的支持。

还是不行呢,纠结。。。。

是不是需要1.3动画编辑器重新导一次?

建议您重新导出一次,每一次版本升级都需要编辑器与引擎同步。感谢您对cocostudio的支持,如果仍然失败欢迎您与我们联系,我们将协助您查找失败原因。

我怀疑是不是ui控件移除CCArmature,移除的不够干净,重新导了没用呢,我重新在heroworld里面直接在scene添加和移除试了一下没问题呢

用removeNode后,Armature的update继续执行,但是_armature为空了,然后就提示内存溢出了。。而且这个症状是随机发生的

问题解决了,使用armature->removeFromParentAndCleanup(true);删除动画就行了呢

刚才试了 还是不行啊 无论是removeChild() 还是 removeFromParentAndCleanup 方法 只要已删除Armature 都会报内存泄露 2.2.2是好的

检查下引用计数,并使用delete方法删除(CC_SAFE_DELETE)。

remove以后,马上在add一个ui ,就随机出现错误了。也CC_SAFE_DELETE了
Armature 的this变成了Text了

你好,你这个是在3.0才出现的问题么?今天有测试,确实在3.0有问题。

是滴的呢,rc1开始就这样了。

3.1这个问题还是没解决呢

同样的问题,请问有解决掉么

遇到同样问题 这是什么问题呢 求解答

我在3.1里面也碰到这个问题了。请问怎么解决。。。快疯了
动画播放完毕。不管怎么remove都会再跑一遍 update();