void CommandConvertScene::Execute() { DVASSERT(CheckExtension(String(".dae")) && "Wrong extension"); SceneValidator::Instance()->CreateDefaultDescriptors(EditorSettings::Instance()->GetDataSourcePath()); eColladaErrorCodes code = ConvertDaeToSce(filePathname); if(code == COLLADA_OK) { // load sce to scene object String path = FileSystem::Instance()->ReplaceExtension(filePathname, ".sce"); Scene * scene = new Scene(); Entity *rootNode = scene->GetRootNode(path); scene->AddNode(rootNode); scene->BakeTransforms(); // Export to *.sc2 path = FileSystem::Instance()->ReplaceExtension(path, ".sc2"); SceneFileV2 * file = new SceneFileV2(); file->EnableDebugLog(true); file->SaveScene(path.c_str(), scene); SafeRelease(file); SafeRelease(scene); } else if(code == COLLADA_ERROR_OF_ROOT_NODE) { ShowErrorDialog(String("Can't convert from DAE. Looks like one of materials has same name as root node.")); } else { ShowErrorDialog(String("Can't convert from DAE.")); } }
DAVA::Scene * DAEConvertAction::CreateSceneFromSce() const { FilePath scePath = FilePath::CreateWithNewExtension(daePath, ".sce"); Scene *scene = new Scene(); Entity *rootNode = scene->GetRootNode(scePath); if(rootNode) { rootNode = rootNode->Clone(); scene->AddNode(rootNode); scene->BakeTransforms(); rootNode->Release(); } return scene; }
void CommandConvertScene::Execute() { DVASSERT(CheckExtension(String(".dae")) && "Wrong extension"); // TextureDescriptorUtils::CreateDescriptorsForFolder(EditorSettings::Instance()->GetDataSourcePath()); DVASSERT(false) eColladaErrorCodes code = ConvertDaeToSce(filePathname); if(code == COLLADA_OK) { // load sce to scene object FilePath path = FilePath::CreateWithNewExtension(filePathname, ".sce"); Scene * scene = new Scene(); Entity *rootNode = scene->GetRootNode(path); if(rootNode) { rootNode = rootNode->Clone(); scene->AddNode(rootNode); rootNode->Release(); } scene->BakeTransforms(); // Export to *.sc2 path.ReplaceExtension(".sc2"); scene->Save(path); SafeRelease(scene); } else if(code == COLLADA_ERROR_OF_ROOT_NODE) { ShowErrorDialog(String("Can't convert from DAE. Looks like one of materials has same name as root node.")); } else { ShowErrorDialog(String("Can't convert from DAE.")); } }