mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Merge branch 'master' into performance_improvements
# Conflicts: # src/ifcexpressparser/implementation.py # src/ifcgeom/IfcGeomFunctions.cpp # src/ifcparse/Ifc4.cpp
This commit is contained in:
@@ -378,12 +378,13 @@ int main(int argc, char** argv) {
|
||||
|
||||
GeometrySerializer* serializer;
|
||||
if (output_extension == ".obj") {
|
||||
const std::string mtl_temp_filename = change_extension(output_filename, "mtl") + TEMP_FILE_EXTENSION;
|
||||
// Do not use temp file for MTL as it's such a small file.
|
||||
const std::string mtl_filename = change_extension(output_filename, "mtl");
|
||||
if (!use_world_coords) {
|
||||
Logger::Message(Logger::LOG_NOTICE, "Using world coords when writing WaveFront OBJ files");
|
||||
settings.set(IfcGeom::IteratorSettings::USE_WORLD_COORDS, true);
|
||||
}
|
||||
serializer = new WaveFrontOBJSerializer(output_temp_filename, mtl_temp_filename, settings);
|
||||
serializer = new WaveFrontOBJSerializer(output_temp_filename, mtl_filename, settings);
|
||||
#ifdef WITH_OPENCOLLADA
|
||||
} else if (output_extension == ".dae") {
|
||||
serializer = new ColladaSerializer(output_temp_filename, settings);
|
||||
@@ -506,12 +507,11 @@ int main(int argc, char** argv) {
|
||||
serializer->finalize();
|
||||
delete serializer;
|
||||
|
||||
rename_file(output_temp_filename, output_filename);
|
||||
|
||||
if (output_extension == ".obj") {
|
||||
std::string mtl_filename = change_extension(output_filename, "mtl");
|
||||
std::string mtl_tmp_filename = mtl_filename + TEMP_FILE_EXTENSION;
|
||||
rename_file(mtl_tmp_filename, mtl_filename);
|
||||
// Renaming might fail (e.g. maybe the existing file was open in a viewer application)
|
||||
// Do not remove the temp file as user can salvage the conversion result from it.
|
||||
bool successful = rename_file(output_temp_filename, output_filename);
|
||||
if (!successful) {
|
||||
Logger::Message(Logger::LOG_ERROR, "Unable to write output file '" + output_filename + "");
|
||||
}
|
||||
|
||||
write_log();
|
||||
@@ -535,7 +535,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
Logger::Status(msg.str());
|
||||
|
||||
return 0;
|
||||
return successful ? 0 : 1;
|
||||
}
|
||||
|
||||
void write_log() {
|
||||
|
||||
Reference in New Issue
Block a user