Commit cb367312 authored by Martin Schultz's avatar Martin Schultz

Fixed ASK dialog for OFF File Plugin

* also removed outcommented code fragment from obj loader
parent 620fd69f
......@@ -532,19 +532,11 @@ bool FileOFFPlugin::readOFFFile(QString _filename, OFFImporter& _importer) {
case TYPEASK:
if( !OpenFlipper::Options::nogui() ) {
// Create message box
QMessageBox msgBox;
QPushButton *detectButton = msgBox.addButton(tr("Auto-Detect"), QMessageBox::ActionRole);
QPushButton *triButton = msgBox.addButton(tr("Open as triangle mesh"), QMessageBox::ActionRole);
QPushButton *polyButton = msgBox.addButton(tr("Open as poly mesh"), QMessageBox::ActionRole);
QMetaObject::invokeMethod(this,"handleTrimeshDialog",Qt::BlockingQueuedConnection);
msgBox.setWindowTitle( tr("Mesh types in file") );
msgBox.setText( tr("You are about to open a file containing one or more mesh types. \n\n Which mesh type should be used?") );
msgBox.setDefaultButton( detectButton );
msgBox.exec();
if (msgBox.clickedButton() == triButton)
if (trimeshOptions == OFFImporter::TRIMESH)
type = DATA_TRIANGLE_MESH;
else if (msgBox.clickedButton() == polyButton)
else if (trimeshOptions == OFFImporter::POLYMESH)
type = DATA_POLY_MESH;
else
type = _importer.isTriangleMesh() ? DATA_TRIANGLE_MESH : DATA_POLY_MESH;
......@@ -574,6 +566,24 @@ bool FileOFFPlugin::readOFFFile(QString _filename, OFFImporter& _importer) {
return _importer.isBinary() ? parseBinary(ifile, _importer, type, _filename) : parseASCII(ifile, _importer, type, _filename);
}
void FileOFFPlugin::handleTrimeshDialog()
{
QMessageBox msgBox;
QPushButton *detectButton = msgBox.addButton(tr("Auto-Detect"), QMessageBox::ActionRole);
QPushButton *triButton = msgBox.addButton(tr("Open as triangle mesh"), QMessageBox::ActionRole);
QPushButton *polyButton = msgBox.addButton(tr("Open as poly mesh"), QMessageBox::ActionRole);
msgBox.setWindowTitle( tr("Mesh types in file") );
msgBox.setText( tr("You are about to open a file containing one or more mesh types. \n\n Which mesh type should be used?") );
msgBox.setDefaultButton( detectButton );
msgBox.exec();
if (msgBox.clickedButton() == triButton)
trimeshOptions = OFFImporter::TRIMESH ;
else if (msgBox.clickedButton() == polyButton)
trimeshOptions = OFFImporter::POLYMESH ;
}
//-----------------------------------------------------------------------------------------------------
bool FileOFFPlugin::parseASCII(std::istream& _in, OFFImporter& _importer, DataType _type, QString& _objectName) {
......
......@@ -107,6 +107,8 @@ class FileOFFPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInte
void initializePlugin();
/// Displays a dialog to ask how to load the mesh (triangle, polymesh , autodetect)
void handleTrimeshDialog();
/// Slot called when user wants to save the given Load options as default
void slotLoadDefault();
......@@ -267,6 +269,7 @@ class FileOFFPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInte
bool forceTriangleMesh_;
bool forcePolyMesh_;
bool readColorComp_;
OFFImporter::ObjectOptionsE trimeshOptions;
};
#if defined(INCLUDE_TEMPLATES) && !defined(FILEOFFPLUGIN_C)
......
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