diff --git a/extensions/CCBReader/CCBAnimationManager.cpp b/extensions/CCBReader/CCBAnimationManager.cpp index bd30b0a168..7526e4d0a3 100644 --- a/extensions/CCBReader/CCBAnimationManager.cpp +++ b/extensions/CCBReader/CCBAnimationManager.cpp @@ -262,6 +262,14 @@ CCBSequence* CCBAnimationManager::getSequence(int nSequenceId) return NULL; } +float CCBAnimationManager::getSequenceDuration(const char *pSequenceName) +{ + int id = getSequenceId(pSequenceName); + if (id != -1) + return getSequence(id)->getDuration(); + return 0; +} + void CCBAnimationManager::moveAnimationsFromNode(Node* fromNode, Node* toNode) { diff --git a/extensions/CCBReader/CCBAnimationManager.h b/extensions/CCBReader/CCBAnimationManager.h index d630ae545d..b43276ff40 100644 --- a/extensions/CCBReader/CCBAnimationManager.h +++ b/extensions/CCBReader/CCBAnimationManager.h @@ -87,10 +87,15 @@ public: Object* actionForCallbackChannel(CCBSequenceProperty* channel); Object* actionForSoundChannel(CCBSequenceProperty* channel); + + // return -1 if timeline not exsit + int getSequenceId(const char* pSequenceName); + + // get timeline duration + float getSequenceDuration(const char* pSequenceName); private: Object* getBaseValue(Node *pNode, const char* propName); - int getSequenceId(const char* pSequenceName); CCBSequence* getSequence(int nSequenceId); ActionInterval* getAction(CCBKeyframe *pKeyframe0, CCBKeyframe *pKeyframe1, const char *propName, Node *pNode); void setAnimatedProperty(const char *propName, Node *pNode, Object *pValue, float fTweenDuraion);