MCPcopy Create free account
hub / github.com/assimp/assimp / ExportSceneXFile

Function ExportSceneXFile

code/AssetLib/X/XFileExporter.cpp:71–97  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------ Worker function for exporting a scene to Collada. Prototyped and registered in Exporter.cpp

Source from the content-addressed store, hash-verified

69// ------------------------------------------------------------------------------------------------
70// Worker function for exporting a scene to Collada. Prototyped and registered in Exporter.cpp
71void ExportSceneXFile(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties)
72{
73 std::string path = DefaultIOSystem::absolutePath(std::string(pFile));
74 std::string file = DefaultIOSystem::completeBaseName(std::string(pFile));
75
76 // create/copy Properties
77 ExportProperties props(*pProperties);
78
79 // set standard properties if not set
80 if (!props.HasPropertyBool(AI_CONFIG_EXPORT_XFILE_64BIT)) props.SetPropertyBool(AI_CONFIG_EXPORT_XFILE_64BIT, false);
81
82 // invoke the exporter
83 XFileExporter iDoTheExportThing( pScene, pIOSystem, path, file, &props);
84
85 if (iDoTheExportThing.mOutput.fail()) {
86 throw DeadlyExportError("output data creation failed. Most likely the file became too large: " + std::string(pFile));
87 }
88
89 // we're still here - export successfully completed. Write result to the given IOSYstem
90 std::unique_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
91 if (outfile == nullptr) {
92 throw DeadlyExportError("could not open output .x file: " + std::string(pFile));
93 }
94
95 // XXX maybe use a small wrapper around IOStream that behaves like std::stringstream in order to avoid the extra copy.
96 outfile->Write( iDoTheExportThing.mOutput.str().c_str(), static_cast<size_t>(iDoTheExportThing.mOutput.tellp()),1);
97}
98
99} // end of namespace Assimp
100

Callers

nothing calls this directly

Calls 4

HasPropertyBoolMethod · 0.80
strMethod · 0.80
OpenMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected