// ------------------------------------------------------------------------------------------------ // Worker function for exporting a scene to Collada. Prototyped and registered in Exporter.cpp void ExportSceneXFile(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene) { std::string path = ""; std::string file = pFile; // We need to test both types of folder separators because pIOSystem->getOsSeparator() is not reliable. // Moreover, the path given by some applications is not even consistent with the OS specific type of separator. const char* end_path = std::max(strrchr(pFile, '\\'), strrchr(pFile, '/')); if(end_path != NULL) { path = std::string(pFile, end_path + 1 - pFile); file = file.substr(end_path + 1 - pFile, file.npos); std::size_t pos = file.find_last_of('.'); if(pos != file.npos) { file = file.substr(0, pos); } } // invoke the exporter XFileExporter iDoTheExportThing( pScene, pIOSystem, path, file); // we're still here - export successfully completed. Write result to the given IOSYstem std::unique_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt")); if(outfile == NULL) { throw DeadlyExportError("could not open output .dae file: " + std::string(pFile)); } // XXX maybe use a small wrapper around IOStream that behaves like std::stringstream in order to avoid the extra copy. outfile->Write( iDoTheExportThing.mOutput.str().c_str(), static_cast<size_t>(iDoTheExportThing.mOutput.tellp()),1); }
// ------------------------------------------------------------------------------------------------ // Worker function for exporting a scene to Collada. Prototyped and registered in Exporter.cpp void ExportSceneCollada(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene) { // invoke the exporter ColladaExporter iDoTheExportThing( pScene); // we're still here - export successfully completed. Write result to the given IOSYstem boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt")); // XXX maybe use a small wrapper around IOStream that behaves like std::stringstream in order to avoid the extra copy. outfile->Write( iDoTheExportThing.mOutput.str().c_str(), iDoTheExportThing.mOutput.tellp(),1); }
// ------------------------------------------------------------------------------------------------ // Worker function for exporting a scene to Collada. Prototyped and registered in Exporter.cpp void ExportSceneCollada(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties) { std::string path = DefaultIOSystem::absolutePath(std::string(pFile)); std::string file = DefaultIOSystem::completeBaseName(std::string(pFile)); // invoke the exporter ColladaExporter iDoTheExportThing( pScene, pIOSystem, path, file); // we're still here - export successfully completed. Write result to the given IOSYstem boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt")); if(outfile == NULL) { throw DeadlyExportError("could not open output .dae file: " + std::string(pFile)); } // XXX maybe use a small wrapper around IOStream that behaves like std::stringstream in order to avoid the extra copy. outfile->Write( iDoTheExportThing.mOutput.str().c_str(), static_cast<size_t>(iDoTheExportThing.mOutput.tellp()),1); }
// ------------------------------------------------------------------------------------------------ // Worker function for exporting a scene to Collada. Prototyped and registered in Exporter.cpp void ExportSceneXFile(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties) { std::string path = DefaultIOSystem::absolutePath(std::string(pFile)); std::string file = DefaultIOSystem::completeBaseName(std::string(pFile)); // create/copy Properties ExportProperties props(*pProperties); // set standard properties if not set if (!props.HasPropertyBool(AI_CONFIG_EXPORT_XFILE_64BIT)) props.SetPropertyBool(AI_CONFIG_EXPORT_XFILE_64BIT, false); // invoke the exporter XFileExporter iDoTheExportThing( pScene, pIOSystem, path, file, &props); // we're still here - export successfully completed. Write result to the given IOSYstem std::unique_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt")); if(outfile == NULL) { throw DeadlyExportError("could not open output .x file: " + std::string(pFile)); } // XXX maybe use a small wrapper around IOStream that behaves like std::stringstream in order to avoid the extra copy. outfile->Write( iDoTheExportThing.mOutput.str().c_str(), static_cast<size_t>(iDoTheExportThing.mOutput.tellp()),1); }