Commit 5330629f authored by Martin Schultz's avatar Martin Schultz
Browse files

fixed ASK option for OM files

parent bba78ffc
...@@ -187,18 +187,10 @@ int FileOMPlugin::loadObject(QString _filename) { ...@@ -187,18 +187,10 @@ int FileOMPlugin::loadObject(QString _filename) {
} }
// Note: If in non-gui mode, we will never enter this case branch // Note: If in non-gui mode, we will never enter this case branch
QMessageBox msgBox;
QPushButton *detectButton = msgBox.addButton(tr("Auto-Detect"), QMessageBox::ActionRole); QMetaObject::invokeMethod(this,"handleTrimeshDialog",Qt::BlockingQueuedConnection);
// QPushButton *triButton = msgBox.addButton(tr("Open as triangle mesh"), QMessageBox::ActionRole); if ((trimeshOptions == TYPEPOLY) ||
QPushButton *polyButton = msgBox.addButton(tr("Open as poly mesh"), QMessageBox::ActionRole); (trimeshOptions == TYPEASK && !triMesh)) {
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() == polyButton) ||
(msgBox.clickedButton() == detectButton && !triMesh)) {
PolyMeshObject* object(0); PolyMeshObject* object(0);
if(PluginFunctions::getObject( objectId, object )) { if(PluginFunctions::getObject( objectId, object )) {
...@@ -251,6 +243,24 @@ int FileOMPlugin::loadObject(QString _filename) { ...@@ -251,6 +243,24 @@ int FileOMPlugin::loadObject(QString _filename) {
return objectId; return objectId;
}; };
void FileOMPlugin::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 = TYPETRIANGLE ;
else if (msgBox.clickedButton() == polyButton)
trimeshOptions = TYPEPOLY ;
}
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------
/// load a triangle-mesh with given filename /// load a triangle-mesh with given filename
......
...@@ -98,7 +98,10 @@ class FileOMPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInter ...@@ -98,7 +98,10 @@ class FileOMPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInter
void noguiSupported( ) {} ; void noguiSupported( ) {} ;
void initializePlugin(); 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 /// Slot called when user wants to save the given Load options as default
void slotLoadDefault(); void slotLoadDefault();
...@@ -166,6 +169,7 @@ class FileOMPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInter ...@@ -166,6 +169,7 @@ class FileOMPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInter
QCheckBox* loadFaceColor_; QCheckBox* loadFaceColor_;
QCheckBox* loadFaceNormal_; QCheckBox* loadFaceNormal_;
QPushButton* loadDefaultButton_; QPushButton* loadDefaultButton_;
int trimeshOptions;
}; };
#endif //FILEOMPLUGIN_HH #endif //FILEOMPLUGIN_HH
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