diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp index 25c4d460f3..406bb50859 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp @@ -480,27 +480,27 @@ InnerActionFrame::InnerActionFrame() void InnerActionFrame::onEnter(Frame *nextFrame, int currentFrameIndex) { - int start = _startFrameIndex; - int end = _endFrameIndex; - auto actiontimeline = static_cast(_node->getActionByTag(_node->getTag())); + auto innerActiontimeline = static_cast(_node->getActionByTag(_node->getTag())); if (InnerActionType::SingleFrame == _innerActionType) { - actiontimeline->gotoFrameAndPause(_singleFrameIndex); + innerActiontimeline->gotoFrameAndPause(_singleFrameIndex); return; } + int innerStart = _startFrameIndex; + int innerEnd = _endFrameIndex; if (_enterWithName) { if (_animationName == AnimationAllName) { - start = 0; - end = actiontimeline->getDuration(); + innerStart = 0; + innerEnd = innerActiontimeline->getDuration(); } - else if(actiontimeline->IsAnimationInfoExists(_animationName)) + else if(innerActiontimeline->IsAnimationInfoExists(_animationName)) { - AnimationInfo info = actiontimeline->getAnimationInfo(_animationName); - start = info.startIndex; - end = info.endIndex; + AnimationInfo info = innerActiontimeline->getAnimationInfo(_animationName); + innerStart = info.startIndex; + innerEnd = info.endIndex; } else { @@ -509,19 +509,19 @@ void InnerActionFrame::onEnter(Frame *nextFrame, int currentFrameIndex) } int duration = _timeline->getActionTimeline()->getDuration(); - int odddiff = duration - _frameIndex - end + start; + int odddiff = duration - _frameIndex - innerEnd + innerStart; if (odddiff < 0) { - end += odddiff; + innerEnd += odddiff; } if (InnerActionType::NoLoopAction == _innerActionType) { - actiontimeline->gotoFrameAndPlay(start, end, false); + innerActiontimeline->gotoFrameAndPlay(innerStart, innerEnd, false); } else if (InnerActionType::LoopAction == _innerActionType) { - actiontimeline->gotoFrameAndPlay(start, end, true); + innerActiontimeline->gotoFrameAndPlay(innerStart, innerEnd, true); } }