Commit 0e5682a2 authored by Johannes Lenzen's avatar Johannes Lenzen

Suppress too many warn or error log messages

Patch by: Shaun Song <sxsong1207@qq.com>
parent 80e3e547
......@@ -111,7 +111,7 @@ FileOBJPlugin::FileOBJPlugin()
//-----------------------------------------------------------------------------------------------------
void FileOBJPlugin::initializePlugin() {
void FileOBJPlugin::initializePlugin() {
}
//-----------------------------------------------------------------------------------------------------
......@@ -676,6 +676,11 @@ void FileOBJPlugin::readOBJFile(QByteArray& _bufferedFile, QString _filename, OB
// Now add all meshes for every group (if exists)
createAllGroupObjects(_importer);
bool bSuppNoVertCoord = false;
bool bSuppTooManyTexCoord = false;
bool bSuppTooManyNormal = false;
bool bSuppErrorSettingTexCoord = false;
while( !input.atEnd() )
{
line=input.readLine();
......@@ -923,15 +928,20 @@ void FileOBJPlugin::readOBJFile(QByteArray& _bufferedFile, QString _filename, OB
// As obj counts from 1 and not zero add +1
value = currentTextureCoordCount + value + 1;
}
if (vhandles.empty())
{
emit log (LOGWARN, tr("Texture coordinates defined, but no vertex coordinates found!"));
if(!bSuppNoVertCoord) {
emit log (LOGWARN, tr("Texture coordinates defined, but no vertex coordinates found!"));
bSuppNoVertCoord=true;
}
break;
}
if ((unsigned int)(value-1) >= _importer.n_texCoords())
{
emit log (LOGWARN, tr("Too many texcoords defined, skipping the rest"));
if(!bSuppTooManyTexCoord) {
emit log(LOGWARN, tr("Too many texcoords defined, skipping the rest"));
bSuppTooManyTexCoord=true;
}
break;
}
......@@ -939,8 +949,9 @@ void FileOBJPlugin::readOBJFile(QByteArray& _bufferedFile, QString _filename, OB
// Obj counts from 1 and not zero .. array counts from zero therefore -1
_importer.setVertexTexCoord( vhandles.back(), value-1 );
face_texcoords.push_back( value-1 );
} else {
} else if(bSuppErrorSettingTexCoord){
emit log( LOGERR, tr("Error setting Texture coordinates") );
bSuppErrorSettingTexCoord=true;
}
break;
......@@ -955,13 +966,20 @@ void FileOBJPlugin::readOBJFile(QByteArray& _bufferedFile, QString _filename, OB
if (vhandles.empty())
{
emit log (LOGWARN, tr("Texture coordinates defined, but no vertex coordinates found!"));
if(!bSuppNoVertCoord) {
emit log (LOGWARN, tr("Texture coordinates defined, but no vertex coordinates found!"));
bSuppNoVertCoord=true;
}
break;
}
if ((unsigned int)(value-1) >= _importer.n_normals())
{
emit log (LOGWARN, tr("Too many normals defined, skipping the rest"));
if(!bSuppTooManyNormal)
{
emit log (LOGWARN, tr("Too many normals defined, skipping the rest"));
bSuppTooManyNormal=true;
}
break;
}
......@@ -1765,7 +1783,7 @@ void FileOBJPlugin::checkTypes(QByteArray& _bufferedFile, QString _filename, OBJ
// If we do not have a gui, we will always use the last default
// If we need a gui and the triMeshHandling box is not generated (==0) we also use the last default
if ( OpenFlipper::Options::gui() && triMeshHandling_ != 0 ){
if ( OpenFlipper::Options::gui() && triMeshHandling_ != 0 ){
switch( triMeshHandling_->currentIndex() ){
case TYPEAUTODETECT : //Detect
......
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