[fixed]OBJ writer has two bugs: name and location

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

[fixed]OBJ writer has two bugs: name and location

Post by hendu »

The OBJ writer had two bugs: regardless of the target dir, it wrote the mtl file to the current dir, and it used the mesh's original name, not the new name.

Examples for each:

1) You are in /some/random/dir. You tell irr to write to /tmp/dest.obj. The mtl file goes to the current dir still, I expect it to go next to the obj file.
2) Say you load orig.ply and write to newfile.obj. The mtl file is not named newfile.mtl, but orig.mtl.

The patch fixes both.

Patch posted: https://sourceforge.net/tracker/?func=d ... tid=540678


Before you complain about the use of C, it would have been longer & slower with the stringc methods, since there is no "remove extension without removing path components" call.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: OBJ writer has two bugs: name and location

Post by hendu »

BTW, these bugs are present in all three versions: 1.7, 1.8 and trunk.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: OBJ writer has two bugs: name and location

Post by hendu »

It also has a third bug: the face line has an unnecessary trailing space, making obj files bigger than needed ;)

Code: Select all

    obj writer: remove ugly trailing whitespace from face lines
 
diff --git a/source/Irrlicht/COBJMeshWriter.cpp b/source/Irrlicht/COBJMeshWriter.cpp
index 1b3a500..93a68ac 100644
--- a/source/Irrlicht/COBJMeshWriter.cpp
+++ b/source/Irrlicht/COBJMeshWriter.cpp
@@ -173,7 +173,6 @@ bool COBJMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 fla
                                file->write(num.c_str(), num.size());
                                file->write("/",1);
                                file->write(num.c_str(), num.size());
-                               file->write(" ",1);
 
                                file->write("\n",1);
                        }
 
Post Reply