Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug solving in obj file export: material path as a relative path #1420

Merged
merged 3 commits into from Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -26,3 +26,4 @@ Jean-David Génevaux <jean-david.genevaux@liris.cnrs.fr>
Thomas Caissard <thomas.caissard@liris.cnrs.fr>
Boris Mansencal <boris.mansencal@labri.fr>
Raphael Lenain <raphael.lenain@univ-poitiers.fr>
Johanna Delanoy <johanna.delanoy@inria.fr>
1 change: 1 addition & 0 deletions ChangeLog.md
Expand Up @@ -27,6 +27,7 @@
English/French decimal point inconsistency between `atof` and
`boost::program_options` (Jacques-Olivier Lachaud,
[#1411](https://github.com/DGtal-team/DGtal/pull/1411))
- Fixing OBJ export: .mtl file written with relative path (Johanna Delanoy [#1420](https://github.com/DGtal-team/DGtal/pull/1420))

- *IO*
- Removing a `using namespace std;` in the Viewer3D hearder file. (David
Expand Down
5 changes: 4 additions & 1 deletion src/DGtal/helpers/Shortcuts.h
Expand Up @@ -1622,11 +1622,14 @@ namespace DGtal
{
mtlfile = objfile.substr(0, lastindex) + ".mtl";
}

std::ofstream output_obj( objfile.c_str() );
output_obj << "# OBJ format" << std::endl;
output_obj << "# DGtal::MeshHelpers::exportOBJwithFaceNormalAndColor" << std::endl;
output_obj << "o anObject" << std::endl;
output_obj << "mtllib " << mtlfile << std::endl;
//remove directory to write material
auto indexpath = objfile.find_last_of("/");
output_obj << "mtllib " << mtlfile.substr(indexpath+1) << std::endl;
std::ofstream output_mtl( mtlfile.c_str() );
output_mtl << "# MTL format"<< std::endl;
output_mtl << "# generated from MeshWriter from the DGTal library"<< std::endl;
Expand Down