From 3515a4f286e9782a0d96d13fa2f9ea9fda44eb1d Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 18 Sep 2013 16:36:16 +0800 Subject: [PATCH] limited action frame index --- extensions/CocoStudio/Action/CCActionNode.cpp | 15 ++++++++++++--- extensions/CocoStudio/Action/CCActionObject.cpp | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/extensions/CocoStudio/Action/CCActionNode.cpp b/extensions/CocoStudio/Action/CCActionNode.cpp index 9b92ccf016..6cadffdbcf 100644 --- a/extensions/CocoStudio/Action/CCActionNode.cpp +++ b/extensions/CocoStudio/Action/CCActionNode.cpp @@ -362,6 +362,7 @@ void ActionNode::stopAction() int ActionNode::getFirstFrameIndex() { int frameindex = 99999; + bool bFindFrame = false; for (int n = 0; n < _frameArrayNum; n++) { Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n)); @@ -369,7 +370,7 @@ int ActionNode::getFirstFrameIndex() { continue; } - + bFindFrame = true; ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(0)); int iFrameIndex = frame->getFrameIndex(); @@ -378,13 +379,17 @@ int ActionNode::getFirstFrameIndex() frameindex = iFrameIndex; } } - + if (!bFindFrame) + { + frameindex = 0; + } return frameindex; } int ActionNode::getLastFrameIndex() { int frameindex = -1; + bool bFindFrame = false; for (int n = 0; n < _frameArrayNum; n++) { Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n)); @@ -392,6 +397,7 @@ int ActionNode::getLastFrameIndex() { continue; } + bFindFrame = true; int lastInex = cArray->count() - 1; ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(lastInex)); int iFrameIndex = frame->getFrameIndex(); @@ -401,7 +407,10 @@ int ActionNode::getLastFrameIndex() frameindex = iFrameIndex; } } - + if (!bFindFrame) + { + frameindex = 0; + } return frameindex; } bool ActionNode::updateActionToTimeLine(float fTime) diff --git a/extensions/CocoStudio/Action/CCActionObject.cpp b/extensions/CocoStudio/Action/CCActionObject.cpp index f3ea0dc7e6..4456d805d0 100644 --- a/extensions/CocoStudio/Action/CCActionObject.cpp +++ b/extensions/CocoStudio/Action/CCActionObject.cpp @@ -118,6 +118,7 @@ void ActionObject::addActionNode(ActionNode* node) return; } _actionNodeList->addObject(node); + node->setUnitTime(_fUnitTime); } void ActionObject::removeActionNode(ActionNode* node) {