improve obj export of mesh with colors

This commit is contained in:
wmayer
2016-09-06 17:00:34 +02:00
parent da92d338b7
commit 2c226343cb
6 changed files with 241 additions and 63 deletions

View File

@@ -354,9 +354,22 @@ void MeshObject::save(const char* file, MeshCore::MeshIO::Format f,
}
}
aWriter.SetGroups(groups);
if (mat && mat->library.empty()) {
Base::FileInfo fi(file);
const_cast<MeshCore::Material*>(mat)->library = fi.fileNamePure() + ".mtl";
}
aWriter.Transform(this->_Mtrx);
aWriter.SaveAny(file, f);
if (aWriter.SaveAny(file, f)) {
if (mat && f == MeshCore::MeshIO::OBJ) {
Base::FileInfo fi(file);
std::string fn = fi.dirPath() + "/" + mat->library;
fi.setFile(fn);
Base::ofstream str(fi, std::ios::out | std::ios::binary);
aWriter.SaveMTL(str);
str.close();
}
}
}
void MeshObject::save(std::ostream& str, MeshCore::MeshIO::Format f,