Commit d070e9b4 authored by Martin Schultz's avatar Martin Schultz

fixed ASK option for ply files

* also added initialisation for om type autodetect which was missing
parent 457da237
......@@ -249,18 +249,9 @@ int FilePLYPlugin::loadObject(QString _filename) {
else if (triMeshControl == TYPEASK) {
// If Ask is selected -> show dialog
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() == polyButton) ||
(msgBox.clickedButton() == detectButton && !isTriMesh)) {
QMetaObject::invokeMethod(this,"handleTrimeshDialog",Qt::BlockingQueuedConnection);
if ((trimeshOptions == TYPEPOLY) ||
(trimeshOptions == TYPEASK && !isTriMesh)) {
PolyMeshObject* object(0);
if(PluginFunctions::getObject( objectId, object )) {
......@@ -313,6 +304,26 @@ int FilePLYPlugin::loadObject(QString _filename) {
return objectId;
};
void FilePLYPlugin::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 ;
else
trimeshOptions = TYPEASK;
}
//-----------------------------------------------------------------------------------------------------
/// load a triangle-mesh with given filename
......
......@@ -103,6 +103,9 @@ class FilePLYPlugin : 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();
......@@ -172,6 +175,7 @@ class FilePLYPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInte
QCheckBox* loadFaceNormal_;
QCheckBox* loadFaceColor_;
QPushButton* loadDefaultButton_;
int trimeshOptions;
};
#if defined(INCLUDE_TEMPLATES) && !defined(FILEPLYPLUGIN_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