Commit 75a9684d authored by Mike Kremer's avatar Mike Kremer
Browse files

Consider options if file is loaded as poly mesh, too.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7936 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 10ca4e9e
......@@ -109,8 +109,39 @@ int FileOFFPlugin::loadObject(QString _filename) {
std::string filename = std::string( _filename.toUtf8() );
//set options
OpenMesh::IO::Options opt = OpenMesh::IO::Options::Default;
if ( !OpenFlipper::Options::loadingSettings() &&
!OpenFlipper::Options::loadingRecentFile() && loadOptions_ != 0){
if (loadVertexColor_->isChecked())
opt += OpenMesh::IO::Options::VertexColor;
if (loadFaceColor_->isChecked())
opt += OpenMesh::IO::Options::FaceColor;
// ColorAlpha is only checked if loading binary off's
if (loadAlpha_->isChecked())
opt += OpenMesh::IO::Options::ColorAlpha;
if (loadNormals_->isChecked())
opt += OpenMesh::IO::Options::VertexNormal;
if (loadTexCoords_->isChecked())
opt += OpenMesh::IO::Options::VertexTexCoord;
} else {
// Let openmesh try to read everything it can
opt += OpenMesh::IO::Options::VertexColor;
opt += OpenMesh::IO::Options::FaceColor;
opt += OpenMesh::IO::Options::VertexNormal;
opt += OpenMesh::IO::Options::VertexTexCoord;
}
// load file
bool ok = OpenMesh::IO::read_mesh( (*object->mesh()) , filename );
bool ok = OpenMesh::IO::read_mesh( (*object->mesh()) , filename, opt );
if (!ok)
{
std::cerr << "Plugin FileOFF : Read error for Poly Mesh\n";
......@@ -295,8 +326,39 @@ int FileOFFPlugin::loadPolyMeshObject(QString _filename){
std::string filename = std::string( _filename.toUtf8() );
//set options
OpenMesh::IO::Options opt = OpenMesh::IO::Options::Default;
if ( !OpenFlipper::Options::loadingSettings() &&
!OpenFlipper::Options::loadingRecentFile() && loadOptions_ != 0){
if (loadVertexColor_->isChecked())
opt += OpenMesh::IO::Options::VertexColor;
if (loadFaceColor_->isChecked())
opt += OpenMesh::IO::Options::FaceColor;
// ColorAlpha is only checked if loading binary off's
if (loadAlpha_->isChecked())
opt += OpenMesh::IO::Options::ColorAlpha;
if (loadNormals_->isChecked())
opt += OpenMesh::IO::Options::VertexNormal;
if (loadTexCoords_->isChecked())
opt += OpenMesh::IO::Options::VertexTexCoord;
} else {
// Let openmesh try to read everything it can
opt += OpenMesh::IO::Options::VertexColor;
opt += OpenMesh::IO::Options::FaceColor;
opt += OpenMesh::IO::Options::VertexNormal;
opt += OpenMesh::IO::Options::VertexTexCoord;
}
// load file
bool ok = OpenMesh::IO::read_mesh( (*object->mesh()) , filename );
bool ok = OpenMesh::IO::read_mesh( (*object->mesh()) , filename, opt );
if (!ok)
{
std::cerr << "Plugin FileOFF : Read error for Poly Mesh\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment