Commit ec7a79c8 authored by Mike Kremer's avatar Mike Kremer
Browse files

Changed procedure of asking the user whether a file should be opened as poly...

Changed procedure of asking the user whether a file should be opened as poly or trimesh. Log and object->show() are now called after the final mesh has been loaded.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8339 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b0f7b329
......@@ -128,18 +128,25 @@ int FileOMPlugin::loadObject(QString _filename) {
// Check if it is a triangle. If not, this is really a poly mesh
if ( count != 3 ) {
emit openedFile( objectId );
PolyMeshObject* object(0);
if(PluginFunctions::getObject( objectId, object )) {
object->show();
emit log(LOGINFO,object->getObjectinfo());
emit openedFile( objectId );
}
return objectId;
}
}
} else if (triMeshControl == TYPEASK ) {
///\todo Really ask, what should be done! Not only if a triangle mesh is loaded as poly mesh! Ask what should be loaded!
// If Ask is selected -> show dialog
objectId = loadPolyMeshObject(_filename);
bool triMesh = true;
PolyMeshObject *object = 0;
if(!PluginFunctions::getObject(objectId, object))
return -1;
......@@ -152,25 +159,34 @@ int FileOMPlugin::loadObject(QString _filename) {
++count;
// Check if it is a triangle. If not, this is really a poly mesh
if (count != 3 ) {
emit openedFile( objectId );
return objectId;
if ( count != 3 ) {
triMesh = false;
break;
}
if(triMesh == false) break;
}
QMessageBox::StandardButton result = QMessageBox::question ( 0,
tr("TriMesh loaded as PolyMesh"),
tr("You opened the mesh as a poly mesh but actually its a triangle mesh. \nShould it be opened as a triangle mesh?"),
(QMessageBox::Yes | QMessageBox::No ),
QMessageBox::Yes );
// User decided not to reload as triangle mesh
if ( result == QMessageBox::No ) {
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 && !triMesh)) {
emit openedFile( objectId );
PolyMeshObject* object(0);
if(PluginFunctions::getObject( objectId, object )) {
object->show();
emit log(LOGINFO,object->getObjectinfo());
emit openedFile( objectId );
}
return objectId;
}
......@@ -179,7 +195,13 @@ int FileOMPlugin::loadObject(QString _filename) {
objectId = loadPolyMeshObject(_filename);
emit openedFile( objectId );
PolyMeshObject* object(0);
if(PluginFunctions::getObject( objectId, object )) {
object->show();
emit log(LOGINFO,object->getObjectinfo());
emit openedFile( objectId );
}
return objectId;
} else {
......@@ -187,7 +209,13 @@ int FileOMPlugin::loadObject(QString _filename) {
objectId = loadTriMeshObject(_filename);
emit openedFile( objectId );
TriMeshObject* object(0);
if(PluginFunctions::getObject( objectId, object )) {
object->show();
emit log(LOGINFO,object->getObjectinfo());
emit openedFile( objectId );
}
return objectId;
}
......@@ -197,7 +225,13 @@ int FileOMPlugin::loadObject(QString _filename) {
objectId = loadTriMeshObject(_filename);
emit openedFile( objectId );
TriMeshObject* object(0);
if(PluginFunctions::getObject( objectId, object )) {
object->show();
emit log(LOGINFO,object->getObjectinfo());
emit openedFile( objectId );
}
return objectId;
};
......@@ -269,10 +303,6 @@ int FileOMPlugin::loadTriMeshObject(QString _filename){
object->update();
object->show();
emit log(LOGINFO,object->getObjectinfo());
return object->id();
} else {
......@@ -349,10 +379,6 @@ int FileOMPlugin::loadPolyMeshObject(QString _filename){
object->update();
object->show();
emit log(LOGINFO,object->getObjectinfo());
return object->id();
} else {
......
Supports Markdown
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