limited action frame index

This commit is contained in:
Liam 2013-09-18 16:36:16 +08:00
parent 5a65ef7488
commit 3515a4f286
2 changed files with 13 additions and 3 deletions

View File

@ -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)

View File

@ -118,6 +118,7 @@ void ActionObject::addActionNode(ActionNode* node)
return;
}
_actionNodeList->addObject(node);
node->setUnitTime(_fUnitTime);
}
void ActionObject::removeActionNode(ActionNode* node)
{