From 2c36e2f7a2cda2877d7077395cd5ca650e73154c Mon Sep 17 00:00:00 2001 From: 2youyouo2 <501251991@qq.com> Date: Wed, 13 Jul 2016 16:31:23 +0800 Subject: [PATCH] should init AnimationStates if clips not contains AnimationState's clip --- cocos2d/core/components/CCAnimation.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cocos2d/core/components/CCAnimation.js b/cocos2d/core/components/CCAnimation.js index 907e39a424..86e66b3a6b 100644 --- a/cocos2d/core/components/CCAnimation.js +++ b/cocos2d/core/components/CCAnimation.js @@ -346,7 +346,7 @@ var Animation = cc.Class({ this._init(); var state = this._nameToState[name]; - if (CC_EDITOR && !state) { + if (CC_EDITOR && (!state || !cc.js.array.contains(this._clips, state.clip))) { this._didInit = false; if (this.animator) { @@ -488,6 +488,8 @@ var Animation = cc.Class({ }, _createStates: function() { + this._nameToState = {}; + // create animation states var state = null; var defaultClipState = false;