diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp index fc2227f5d1..a68d3af35b 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp @@ -481,6 +481,9 @@ InnerActionFrame::InnerActionFrame() void InnerActionFrame::onEnter(Frame *nextFrame, int currentFrameIndex) { auto innerActiontimeline = static_cast(_node->getActionByTag(_node->getTag())); + if( nullptr == innerActiontimeline) + return; + if (InnerActionType::SingleFrame == _innerActionType) { innerActiontimeline->gotoFrameAndPause(_singleFrameIndex); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp index 7fceedb098..5d14a35363 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp @@ -833,20 +833,24 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree) auto projectNodeOptions = (ProjectNodeOptions*)options->data(); std::string filePath = projectNodeOptions->fileName()->c_str(); CCLOG("filePath = %s", filePath.c_str()); + + cocostudio::timeline::ActionTimeline* action = nullptr; if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath)) { - node = createNodeWithFlatBuffersFile(filePath); - reader->setPropsWithFlatBuffers(node, options->data()); - - cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath); - if (action) - { - node->runAction(action); - action->gotoFrameAndPause(0); - } + action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath); } + else + { + node = Node::create(); + } + reader->setPropsWithFlatBuffers(node, options->data()); + if (action) + { + node->runAction(action); + action->gotoFrameAndPause(0); + } } else if (classname == "SimpleAudio") { @@ -1164,17 +1168,22 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod std::string filePath = projectNodeOptions->fileName()->c_str(); CCLOG("filePath = %s", filePath.c_str()); + cocostudio::timeline::ActionTimeline* action = nullptr; if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath)) { - node = createNodeWithFlatBuffersForSimulator(filePath); - reader->setPropsWithFlatBuffers(node, options->data()); + node = createNodeWithFlatBuffersFile(filePath); + action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath); - cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator(filePath); - if (action) - { - node->runAction(action); - action->gotoFrameAndPause(0); - } + } + else + { + node = Node::create(); + } + reader->setPropsWithFlatBuffers(node, options->data()); + if (action) + { + node->runAction(action); + action->gotoFrameAndPause(0); } } else if (classname == "SimpleAudio")