OBJ Exporter: No "g" lines with empty names
In the OBJ spec ( http://www.martinreddy.net/gfx/3d/OBJ.spec ), in the section labeled "Grouping" -> "Syntax", the structure of the "g" group statement is defined. Though this statement allows multiple names on a single line, it is unclear whether there must be at least one name on the line. However, the examples don't show any "g" group statements with no names. So, let's be conservative and not write out a "g" group statement that doesn't have a name. These empty "g" statements were prompting an error message from the three.js OBJ loader code.pull/301/head
parent
1c4a8e9017
commit
77faf04aa3
|
@ -228,7 +228,9 @@ void ObjExporter :: WriteGeometryFile()
|
||||||
// now write all mesh instances
|
// now write all mesh instances
|
||||||
BOOST_FOREACH(const MeshInstance& m, meshes) {
|
BOOST_FOREACH(const MeshInstance& m, meshes) {
|
||||||
mOutput << "# Mesh \'" << m.name << "\' with " << m.faces.size() << " faces" << endl;
|
mOutput << "# Mesh \'" << m.name << "\' with " << m.faces.size() << " faces" << endl;
|
||||||
|
if (!m.name.empty()) {
|
||||||
mOutput << "g " << m.name << endl;
|
mOutput << "g " << m.name << endl;
|
||||||
|
}
|
||||||
mOutput << "usemtl " << m.matname << endl;
|
mOutput << "usemtl " << m.matname << endl;
|
||||||
|
|
||||||
BOOST_FOREACH(const Face& f, m.faces) {
|
BOOST_FOREACH(const Face& f, m.faces) {
|
||||||
|
|
Loading…
Reference in New Issue