Commit bb18c4cd authored by Dirk Wilden's avatar Dirk Wilden

moved check for triangle-meshes to filePolyMesh

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7715 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 91b49f3a
......@@ -332,8 +332,7 @@ void Core::slotLoad(QString _filename, int _pluginID) {
// An object has been added. Get it and do some processing!
if ( id > 0 ) {
/// \todo Move this code to polymesh plugin and do the check there!
BaseObjectData* object;
PluginFunctions::getObject(id,object);
......@@ -344,50 +343,6 @@ void Core::slotLoad(QString _filename, int _pluginID) {
// Get the objects type
type = object->dataType();
// Check if it is a polymesh
if ( object != 0 && type == DATA_POLY_MESH ) {
PolyMeshObject* poly = 0;
PluginFunctions::getObject(id,poly);
if ( poly != 0 ) {
PolyMesh& mesh = *poly->mesh();
bool isTriangleMesh = true;
for ( PolyMesh::FaceIter f_it = mesh.faces_begin(); f_it != mesh.faces_end() ; ++f_it) {
// Count number of vertices for the current face
uint count = 0;
for ( PolyMesh::FaceVertexIter fv_it( mesh,f_it); fv_it; ++fv_it )
++count;
// Check if it is a triangle. If not, this is really a poly mesh
if ( count != 3 ) {
isTriangleMesh = false;
break;
}
}
// Mesh loaded as polymesh is actually a triangle mesh. Ask the user to reload as triangle mesh or keep it as poly mesh.
if ( isTriangleMesh ) {
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 to reload as triangle mesh
if ( result == QMessageBox::Yes ) {
slotDeleteObject(id);
id = loadObject(DATA_TRIANGLE_MESH ,_filename);
type = DATA_TRIANGLE_MESH;
}
}
}
}
}
// If the id was greater than zero, add the file to the recent files.
......@@ -400,50 +355,6 @@ void Core::slotLoad(QString _filename, int _pluginID) {
void Core::slotLoad(QString _filename, DataType _type, int& _id) {
_id = loadObject(_type,_filename);
// Check if it is a polymesh
if ( _type == DATA_POLY_MESH ) {
PolyMeshObject* poly = 0;
PluginFunctions::getObject(_id,poly);
if ( poly != 0 ) {
/// \todo Move this code to polymesh plugin and do the check there!
PolyMesh& mesh = *poly->mesh();
bool isTriangleMesh = true;
for ( PolyMesh::FaceIter f_it = mesh.faces_begin(); f_it != mesh.faces_end() ; ++f_it) {
// Count number of vertices for the current face
uint count = 0;
for ( PolyMesh::FaceVertexIter fv_it( mesh,f_it); fv_it; ++fv_it )
++count;
// Check if it is a triangle. If not, this is really a poly mesh
if ( count != 3 ) {
isTriangleMesh = false;
break;
}
}
// Mesh loaded as polymesh is actually a triangle mesh. Ask the user to reload as triangle mesh or keep it as poly mesh.
if ( isTriangleMesh ) {
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 to reload as triangle mesh
if ( result == QMessageBox::Yes ) {
slotDeleteObject(_id);
_id = loadObject(DATA_TRIANGLE_MESH ,_filename);
_type = DATA_TRIANGLE_MESH;
}
}
}
}
if ( _id < 0 )
_id = -1;
else
......
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