diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp
index 5d14a35363..5efee44637 100644
--- a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp
+++ b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp
@@ -839,7 +839,6 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree)
{
node = createNodeWithFlatBuffersFile(filePath);
action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
-
}
else
{
@@ -1171,9 +1170,8 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod
cocostudio::timeline::ActionTimeline* action = nullptr;
if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath))
{
- node = createNodeWithFlatBuffersFile(filePath);
- action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
-
+ node = createNodeWithFlatBuffersForSimulator(filePath);
+ action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator(filePath);
}
else
{
diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp
index 14921367a6..760f575d99 100644
--- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp
+++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp
@@ -34,7 +34,17 @@ Layer *CreateAnimationLayer(int index)
case TEST_TIMELINE_PERFORMACE:
pLayer = new (std::nothrow) TestTimelinePerformance();
break;
+ case TEST_TIMELINEACTION_ANIMATIONLIST:
+ pLayer = new (std::nothrow) TestTimelineAnimationList();
+ break;
+ case TEST_TIMELINEPROJECTNODE:
+ pLayer = new (std::nothrow) TestTimelineProjectNode();
+ break;
+ case TEST_PROJECTNODEFORSIMALATOR:
+ pLayer = new (std::nothrow) TestProjectNodeForSimulator;
+ break;
default:
+ CCLOG("NONE OF THIS TEST LAYER");
break;
}
@@ -185,7 +195,8 @@ void ActionTimelineTestLayer::nextCallback(Ref *pSender)
void ActionTimelineTestLayer::backCallback(Ref *pSender)
{
Scene *s = new (std::nothrow) ActionTimelineTestScene();
- s->addChild( BackAnimationTest() );
+ auto a = BackAnimationTest();
+ s->addChild( a);
Director::getInstance()->replaceScene(s);
s->release();
}
@@ -324,3 +335,73 @@ std::string TestTimelinePerformance::title() const
return "Test ActionTimeline performance";
}
+// TestTimelineAnimationList
+void TestTimelineAnimationList::onEnter()
+{
+ ActionTimelineTestLayer::onEnter();
+ Node* node = CSLoader::createNode("ActionTimeline/DemoPlayer.csb");
+ ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/DemoPlayer.csb");
+ cocostudio::timeline::AnimationInfo standinfo("stand", 0, 40);
+ cocostudio::timeline::AnimationInfo walkinfo("walk", 41, 81)
+ action->addAnimationInfo(standinfo);
+ action->addAnimationInfo(walkinfo);
+ node->runAction(action);
+ action->play("walk", true);
+
+ node->setScale(0.2f);
+ node->setPosition(150,100);
+ addChild(node);
+}
+
+std::string TestTimelineAnimationList::title() const
+{
+ return "Test ActionTimeline AnimationList";
+}
+
+
+//TestTimelineProjectNode
+//InnerActionFrame make InnerAction Play until action's duration or next InnerActionFrame
+void TestTimelineProjectNode::onEnter()
+{
+ ActionTimelineTestLayer::onEnter();
+ Node* node = CSLoader::createNode("ActionTimeline/TestAnimation.csb");
+ ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/TestAnimation.csb");
+
+ node->runAction(action);
+ action->gotoFrameAndPlay(0, true);
+
+ node->setPosition(-300, -300);
+ addChild(node);
+}
+
+std::string TestTimelineProjectNode::title() const
+{
+ return "Test ActionTimeline ProjectNode";
+}
+
+//TestProjectNodeForSimulator
+//InnerActionFrame make InnerAction Play until action's duration or next InnerActionFrame
+void TestProjectNodeForSimulator::onEnter()
+{
+ ActionTimelineTestLayer::onEnter();
+ Node* node = CSLoader::getInstance()->createNodeWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd");
+ ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd");
+
+ node->runAction(action);
+ action->gotoFrameAndPlay(0, true);
+
+ node->setPosition(-300, -300);
+ addChild(node);
+
+ // test for when ProjectNode file lost
+ Node* lackProjectNodefileNode = CSLoader::getInstance()->createNodeWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd");
+ ActionTimeline* lackProjectNodefileAction = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd");
+ lackProjectNodefileNode->runAction(lackProjectNodefileAction);
+ lackProjectNodefileAction->gotoFrameAndPlay(0);
+ addChild(lackProjectNodefileNode);
+}
+
+std::string TestProjectNodeForSimulator::title() const
+{
+ return "Test ProjectNode for Simalator";
+}
diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h
index 1e681aa4c4..141e60e296 100644
--- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h
+++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h
@@ -25,7 +25,10 @@ enum {
TEST_CHANGE_PLAY_SECTION,
// TEST_TIMELINE_FRAME_EVENT,
TEST_TIMELINE_PERFORMACE,
-
+ TEST_TIMELINEACTION_ANIMATIONLIST,
+ TEST_TIMELINEPROJECTNODE,
+ TEST_PROJECTNODEFORSIMALATOR,
+
TEST_ANIMATION_LAYER_COUNT
};
@@ -85,4 +88,25 @@ public:
virtual std::string title() const override;
};
+class TestTimelineAnimationList : public ActionTimelineTestLayer
+{
+public:
+ virtual void onEnter();
+ virtual std::string title() const override;
+};
+
+class TestTimelineProjectNode : public ActionTimelineTestLayer
+{
+public:
+ virtual void onEnter();
+ virtual std::string title() const override;
+};
+
+class TestProjectNodeForSimulator : public ActionTimelineTestLayer
+{
+public:
+ virtual void onEnter();
+ virtual std::string title() const override;
+};
+
#endif // __ANIMATION_SCENE_H__
diff --git a/tests/cpp-tests/Resources/ActionTimeline/Animation.csb b/tests/cpp-tests/Resources/ActionTimeline/Animation.csb
new file mode 100755
index 0000000000..f64ece32db
Binary files /dev/null and b/tests/cpp-tests/Resources/ActionTimeline/Animation.csb differ
diff --git a/tests/cpp-tests/Resources/ActionTimeline/Animation.csd b/tests/cpp-tests/Resources/ActionTimeline/Animation.csd
new file mode 100755
index 0000000000..f849e56513
--- /dev/null
+++ b/tests/cpp-tests/Resources/ActionTimeline/Animation.csd
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/cpp-tests/Resources/ActionTimeline/Default/Button_Disable.png b/tests/cpp-tests/Resources/ActionTimeline/Default/Button_Disable.png
new file mode 100755
index 0000000000..62ee840c40
Binary files /dev/null and b/tests/cpp-tests/Resources/ActionTimeline/Default/Button_Disable.png differ
diff --git a/tests/cpp-tests/Resources/ActionTimeline/Default/Sprite.png b/tests/cpp-tests/Resources/ActionTimeline/Default/Sprite.png
new file mode 100755
index 0000000000..115fa75667
Binary files /dev/null and b/tests/cpp-tests/Resources/ActionTimeline/Default/Sprite.png differ
diff --git a/tests/cpp-tests/Resources/ActionTimeline/TestAnimation.csb b/tests/cpp-tests/Resources/ActionTimeline/TestAnimation.csb
new file mode 100755
index 0000000000..4298c9039e
Binary files /dev/null and b/tests/cpp-tests/Resources/ActionTimeline/TestAnimation.csb differ
diff --git a/tests/cpp-tests/Resources/ActionTimeline/TestAnimation.csd b/tests/cpp-tests/Resources/ActionTimeline/TestAnimation.csd
new file mode 100755
index 0000000000..a349f0034a
--- /dev/null
+++ b/tests/cpp-tests/Resources/ActionTimeline/TestAnimation.csd
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/cpp-tests/Resources/ActionTimeline/TestNullProjectNode.csb b/tests/cpp-tests/Resources/ActionTimeline/TestNullProjectNode.csb
new file mode 100755
index 0000000000..f0b8800357
Binary files /dev/null and b/tests/cpp-tests/Resources/ActionTimeline/TestNullProjectNode.csb differ
diff --git a/tests/cpp-tests/Resources/ActionTimeline/TestNullProjectNode.csd b/tests/cpp-tests/Resources/ActionTimeline/TestNullProjectNode.csd
new file mode 100755
index 0000000000..7ef42efed8
--- /dev/null
+++ b/tests/cpp-tests/Resources/ActionTimeline/TestNullProjectNode.csd
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csb b/tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csb
new file mode 100755
index 0000000000..f64ece32db
Binary files /dev/null and b/tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csb differ
diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csd b/tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csd
new file mode 100755
index 0000000000..f849e56513
--- /dev/null
+++ b/tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csd
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Button_Disable.png b/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Button_Disable.png
new file mode 100755
index 0000000000..62ee840c40
Binary files /dev/null and b/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Button_Disable.png differ
diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Sprite.png b/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Sprite.png
new file mode 100755
index 0000000000..115fa75667
Binary files /dev/null and b/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Sprite.png differ