diff --git a/cocos2d/core/base-ui/CCWidgetManager.js b/cocos2d/core/base-ui/CCWidgetManager.js index 1d6a731e5d..9879db527d 100644 --- a/cocos2d/core/base-ui/CCWidgetManager.js +++ b/cocos2d/core/base-ui/CCWidgetManager.js @@ -274,15 +274,21 @@ function refreshScene () { animationState.previewing = nowPreviewing; if (nowPreviewing) { animationState.animatedSinceLastFrame = true; - animationState.time = AnimUtils.Cache.animation.time; + let component = cc.engine.getInstanceById(AnimUtils.Cache.component); + let animation = component.getAnimationState(AnimUtils.Cache.animation); + animationState.time = animation.time; } else { animationState.animatedSinceLastFrame = false; } } - else if (nowPreviewing && animationState.time !== AnimUtils.Cache.animation.time) { - animationState.animatedSinceLastFrame = true; - animationState.time = AnimUtils.Cache.animation.time; + else if (nowPreviewing) { + let component = cc.engine.getInstanceById(AnimUtils.Cache.component); + let animation = component.getAnimationState(AnimUtils.Cache.animation); + if (animationState.time !== animation.time) { + animationState.animatedSinceLastFrame = true; + animationState.time = AnimUtils.Cache.animation.time; + } } } } @@ -301,7 +307,7 @@ function refreshScene () { if (CC_EDITOR && (AnimUtils = Editor.require('scene://utils/animation')) && AnimUtils.Cache.animation) { - var editingNode = AnimUtils.Cache.rNode; + var editingNode = cc.engine.getInstanceById(AnimUtils.Cache.rNode); for (i = activeWidgets.length - 1; i >= 0; i--) { widget = activeWidgets[i]; var node = widget.node;