From 7aa74fa9942f52aa6d022f642ae2a25d388e507c Mon Sep 17 00:00:00 2001 From: "Owen.Cai" <89424516@qq.com> Date: Wed, 8 Mar 2017 10:14:38 +0800 Subject: [PATCH] csbload error bug (#17465) * csbload error bug * csbload error bug * csbload error bug --- .../cocostudio/ActionTimeline/CSLoader.cpp | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp index 9edfbb85ef..84fc84ee73 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp @@ -951,7 +951,7 @@ Node* CSLoader::nodeWithFlatBuffersFile(const std::string &fileName, const ccNod std::string fullPath = FileUtils::getInstance()->fullPathForFilename(fileName); CC_ASSERT(FileUtils::getInstance()->isFileExist(fullPath)); - + Data buf = FileUtils::getInstance()->getDataFromFile(fullPath); if (buf.isNull()) @@ -1010,7 +1010,6 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree, const std::string classname = nodetree->classname()->c_str(); auto options = nodetree->options(); - auto tableOptions = const_cast((Table*)(&options)); if (classname == "ProjectNode") { @@ -1029,7 +1028,7 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree, const { node = Node::create(); } - reader->setPropsWithFlatBuffers(node, tableOptions); + reader->setPropsWithFlatBuffers(node, (const flatbuffers::Table*)options->data()); if (action) { action->setTimeSpeed(projectNodeOptions->innerActionSpeed()); @@ -1041,12 +1040,12 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree, const { node = Node::create(); auto reader = ComAudioReader::getInstance(); - Component* component = reader->createComAudioWithFlatBuffers(tableOptions); + Component* component = reader->createComAudioWithFlatBuffers((const flatbuffers::Table*)options->data()); if (component) { component->setName(PlayableFrame::PLAYABLE_EXTENTION); node->addComponent(component); - reader->setPropsWithFlatBuffers(node, tableOptions); + reader->setPropsWithFlatBuffers(node, (const flatbuffers::Table*)options->data()); } } else @@ -1062,7 +1061,7 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree, const NodeReaderProtocol* reader = dynamic_cast(ObjectFactory::getInstance()->createObject(readername)); if (reader) { - node = reader->createNodeWithFlatBuffers(tableOptions); + node = reader->createNodeWithFlatBuffers((const flatbuffers::Table*)options->data()); } Widget* widget = dynamic_cast(node); @@ -1358,7 +1357,6 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod std::string classname = nodetree->classname()->c_str(); auto options = nodetree->options(); - auto tableOptions = const_cast((Table*)(&options)); if (classname == "ProjectNode") { @@ -1376,7 +1374,7 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod { node = Node::create(); } - reader->setPropsWithFlatBuffers(node, tableOptions); + reader->setPropsWithFlatBuffers(node, (const flatbuffers::Table*)options->data()); if (action) { action->setTimeSpeed(projectNodeOptions->innerActionSpeed()); @@ -1388,11 +1386,11 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod { node = Node::create(); auto reader = ComAudioReader::getInstance(); - Component* component = reader->createComAudioWithFlatBuffers(tableOptions); + Component* component = reader->createComAudioWithFlatBuffers((const flatbuffers::Table*)options->data()); if (component) { node->addComponent(component); - reader->setPropsWithFlatBuffers(node, tableOptions); + reader->setPropsWithFlatBuffers(node, (const flatbuffers::Table*)options->data()); } } else @@ -1403,7 +1401,7 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod NodeReaderProtocol* reader = dynamic_cast(ObjectFactory::getInstance()->createObject(readername)); if (reader) { - node = reader->createNodeWithFlatBuffers(tableOptions); + node = reader->createNodeWithFlatBuffers((const flatbuffers::Table*)options->data()); } Widget* widget = dynamic_cast(node);