mirror of https://github.com/axmolengine/axmol.git
Merge pull request #3687 from liamcindy/develop_action
limited action frame index
This commit is contained in:
commit
d38dee32a0
|
@ -362,6 +362,7 @@ void ActionNode::stopAction()
|
||||||
int ActionNode::getFirstFrameIndex()
|
int ActionNode::getFirstFrameIndex()
|
||||||
{
|
{
|
||||||
int frameindex = 99999;
|
int frameindex = 99999;
|
||||||
|
bool bFindFrame = false;
|
||||||
for (int n = 0; n < _frameArrayNum; n++)
|
for (int n = 0; n < _frameArrayNum; n++)
|
||||||
{
|
{
|
||||||
Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n));
|
Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n));
|
||||||
|
@ -369,7 +370,7 @@ int ActionNode::getFirstFrameIndex()
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
bFindFrame = true;
|
||||||
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(0));
|
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(0));
|
||||||
int iFrameIndex = frame->getFrameIndex();
|
int iFrameIndex = frame->getFrameIndex();
|
||||||
|
|
||||||
|
@ -378,13 +379,17 @@ int ActionNode::getFirstFrameIndex()
|
||||||
frameindex = iFrameIndex;
|
frameindex = iFrameIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!bFindFrame)
|
||||||
|
{
|
||||||
|
frameindex = 0;
|
||||||
|
}
|
||||||
return frameindex;
|
return frameindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ActionNode::getLastFrameIndex()
|
int ActionNode::getLastFrameIndex()
|
||||||
{
|
{
|
||||||
int frameindex = -1;
|
int frameindex = -1;
|
||||||
|
bool bFindFrame = false;
|
||||||
for (int n = 0; n < _frameArrayNum; n++)
|
for (int n = 0; n < _frameArrayNum; n++)
|
||||||
{
|
{
|
||||||
Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n));
|
Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n));
|
||||||
|
@ -392,6 +397,7 @@ int ActionNode::getLastFrameIndex()
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
bFindFrame = true;
|
||||||
int lastInex = cArray->count() - 1;
|
int lastInex = cArray->count() - 1;
|
||||||
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(lastInex));
|
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(lastInex));
|
||||||
int iFrameIndex = frame->getFrameIndex();
|
int iFrameIndex = frame->getFrameIndex();
|
||||||
|
@ -401,7 +407,10 @@ int ActionNode::getLastFrameIndex()
|
||||||
frameindex = iFrameIndex;
|
frameindex = iFrameIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!bFindFrame)
|
||||||
|
{
|
||||||
|
frameindex = 0;
|
||||||
|
}
|
||||||
return frameindex;
|
return frameindex;
|
||||||
}
|
}
|
||||||
bool ActionNode::updateActionToTimeLine(float fTime)
|
bool ActionNode::updateActionToTimeLine(float fTime)
|
||||||
|
|
|
@ -118,6 +118,7 @@ void ActionObject::addActionNode(ActionNode* node)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_actionNodeList->addObject(node);
|
_actionNodeList->addObject(node);
|
||||||
|
node->setUnitTime(_fUnitTime);
|
||||||
}
|
}
|
||||||
void ActionObject::removeActionNode(ActionNode* node)
|
void ActionObject::removeActionNode(ActionNode* node)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue