From d10d20f62f34e58b82da0dc2c01d7567832b0af8 Mon Sep 17 00:00:00 2001 From: Nathan Morse Date: Fri, 20 Jun 2014 15:08:29 -0700 Subject: [PATCH] Update ObjExporter.cpp In the OBJ spec ( http://www.martinreddy.net/gfx/3d/OBJ.spec ), in the section labeled "Referencing groups of vertices", there is no support for allowing a trailing slash with no valid vertex normal reference at the end. This commit modifies the vertex reference output code to prevent this behavior, as it has been causing compatibility issues with other software that parse OBJ files. --- code/ObjExporter.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/code/ObjExporter.cpp b/code/ObjExporter.cpp index ff9fa4b25..be6fa87bc 100644 --- a/code/ObjExporter.cpp +++ b/code/ObjExporter.cpp @@ -243,11 +243,8 @@ void ObjExporter :: WriteGeometryFile() if (fv.vt) { mOutput << fv.vt; } - if (f.kind == 'f') { - mOutput << '/'; - if (fv.vn) { - mOutput << fv.vn; - } + if (f.kind == 'f' && fv.vn) { + mOutput << '/' << fv.vn; } } }