IOPlugins use exceptions to open meshes

This commit is contained in:
alemuntoni 2021-03-18 11:52:48 +01:00
parent 14a24eb855
commit da754d323f
29 changed files with 257 additions and 298 deletions

View File

@ -126,7 +126,7 @@ public:
int& defaultBits) const = 0;
/// callback used to actually load a mesh from a file
virtual bool open(
virtual void open(
const QString &format, /// the extension of the format e.g. "PLY"
const QString &fileName, /// The name of the file to be opened
MeshModel &m, /// The mesh that is filled with the file content
@ -144,6 +144,16 @@ public:
vcg::CallBackPos *cb = 0,
QWidget *parent = 0) = 0;
void wrongOpenFormat(const QString& format)
{
throw MLException("Internal error: unknown open format " + format + " to " + pluginName() + " plugin.");
};
void wrongSaveFormat(const QString& format)
{
throw MLException("Internal error: unknown save format " + format + " to " + pluginName() + " plugin.");
};
/// This function is invoked by the framework when the import/export plugin fails to give some info to the user about the failure
/// io plugins should avoid using QMessageBox for reporting errors.
/// Failure should put some meaningful information inside the errorMessage string.

View File

@ -2216,9 +2216,14 @@ bool MainWindow::loadMesh(const QString& fileName, IOMeshPlugin *pCurrentIOPlugi
meshDoc()->setBusy(true);
pCurrentIOPlugin->setLog(&meshDoc()->Log);
if (!pCurrentIOPlugin->open(extension, fileNameSansDir, *mm ,mask,*prePar,QCallBack,this /*gla*/))
{
QMessageBox::warning(this, tr("Opening Failure"), QString("While opening: '%1'\n\n").arg(fileName)+pCurrentIOPlugin->errorMsg()); // text+
try {
pCurrentIOPlugin->open(extension, fileNameSansDir, *mm ,mask,*prePar,QCallBack,this /*gla*/);
}
catch(const MLException& e) {
QMessageBox::warning(
this,
tr("Opening Failure"),
"While opening: " + fileName + "\n\n" + e.what());
pCurrentIOPlugin->clearErrorString();
meshDoc()->setBusy(false);
QDir::setCurrent(origDir); // undo the change of directory before leaving

View File

@ -177,35 +177,44 @@ std::list<FileFormat> FilterSSynth::exportFormats() const
return formats ;
}
bool FilterSSynth::open(const QString &/*formatName*/, const QString &fileName, MeshModel &m, int& mask, const RichParameterList & par, CallBackPos *cb, QWidget *parent)
void FilterSSynth::open(
const QString& formatName,
const QString& fileName,
MeshModel &m,
int& mask,
const RichParameterList & par,
CallBackPos *cb,
QWidget *parent)
{
this->seed=par.getInt("seed");
int maxrec=par.getInt("maxrec");
int sphereres=par.getInt("sphereres");
int maxobj=par.getInt("maxobj");
this->renderTemplate=GetTemplate(sphereres);
if(this->renderTemplate!= ""){
QFile grammar(fileName);
grammar.open(QFile::ReadOnly|QFile::Text);
QString gcontent(grammar.readAll());
grammar.close();
if(maxrec>0)ParseGram(&gcontent,maxrec,tr("set maxdepth"));
if(maxobj>0)ParseGram(&gcontent,maxobj,tr("set maxobjects"));
QString x3dfile(FilterSSynth::ssynth(gcontent,maxrec,this->seed,cb));
if(QFile::exists(x3dfile)){
openX3D(x3dfile,m,mask,cb);
QFile x3df(x3dfile);
x3df.remove();
return true;
}
else{
errorMessage = "Error: " + QString("An error occurred during the mesh generation: ").append(x3dfile);
return false;
}
}
else{
errorMessage = "Error: Sphere resolution must be between 1 and 4";
return false;
if (formatName.toUpper() == tr("ES")){
this->seed=par.getInt("seed");
int maxrec=par.getInt("maxrec");
int sphereres=par.getInt("sphereres");
int maxobj=par.getInt("maxobj");
this->renderTemplate=GetTemplate(sphereres);
if(this->renderTemplate!= ""){
QFile grammar(fileName);
grammar.open(QFile::ReadOnly|QFile::Text);
QString gcontent(grammar.readAll());
grammar.close();
if(maxrec>0)ParseGram(&gcontent,maxrec,tr("set maxdepth"));
if(maxobj>0)ParseGram(&gcontent,maxobj,tr("set maxobjects"));
QString x3dfile(FilterSSynth::ssynth(gcontent,maxrec,this->seed,cb));
if(!QFile::exists(x3dfile)){
throw MLException("An error occurred during the mesh generation: " + x3dfile);
}
else{
openX3D(x3dfile,m,mask,cb);
QFile x3df(x3dfile);
x3df.remove();
}
}
else{
throw MLException("Error: Sphere resolution must be between 1 and 4");
}
}
else {
wrongOpenFormat(formatName);
}
}

View File

@ -60,7 +60,7 @@ class FilterSSynth : public QObject, public IOMeshPlugin, public FilterPlugin{
virtual void exportMaskCapability(const QString &format, int &capability, int &defaultBits) const;
void initPreOpenParameter(const QString &formatName, RichParameterList &parlst);
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
void open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList &, vcg::CallBackPos *cb, QWidget *parent);
FilterPlugin::FilterArity filterArity(const QAction *) const {return NONE;}
private:

View File

@ -84,10 +84,11 @@ void ExtraMeshIOPlugin::initPreOpenParameter(
}
}
bool ExtraMeshIOPlugin::open(
void ExtraMeshIOPlugin::open(
const QString &formatName,
const QString &fileName,
MeshModel &m, int& mask,
MeshModel &m,
int& mask,
const RichParameterList& params,
CallBackPos *cb,
QWidget*)
@ -104,19 +105,16 @@ bool ExtraMeshIOPlugin::open(
string filename = QFile::encodeName(fileName).constData ();
//string filename = fileName.toUtf8().data();
if (formatName.toUpper() == tr("3DS"))
{
if (formatName.toUpper() == tr("3DS")) {
vcg::tri::io::_3dsInfo info;
info.cb = cb;
Lib3dsFile *file = NULL;
file = lib3ds_file_load(filename.c_str());
if (!file)
{
if (!file) {
int result = vcg::tri::io::Importer3DS<CMeshO>::E_CANTOPEN;
errorMessage = errorMsgFormat.arg(fileName, vcg::tri::io::Importer3DS<CMeshO>::ErrorMsg(result));
return false;
throw MLException(errorMsgFormat.arg(fileName, vcg::tri::io::Importer3DS<CMeshO>::ErrorMsg(result)));
}
// No nodes? Fabricate nodes to display all the meshes.
@ -134,8 +132,9 @@ bool ExtraMeshIOPlugin::open(
}
}
if( !file->nodes)
return false;
if( !file->nodes) {
throw MLException("Malformed file.");
}
lib3ds_file_eval(file, 0);
@ -202,9 +201,8 @@ bool ExtraMeshIOPlugin::open(
int result = vcg::tri::io::Importer3DS<CMeshO>::Load(m.cm, file, 0, info);
if (result != vcg::tri::io::Importer3DS<CMeshO>::E_NOERROR)
{
errorMessage = "3DS Opening Error: " + errorMsgFormat.arg(fileName, vcg::tri::io::Importer3DS<CMeshO>::ErrorMsg(result));
lib3ds_file_free(file);
return false;
throw MLException("3DS Opening Error: " + errorMsgFormat.arg(fileName, vcg::tri::io::Importer3DS<CMeshO>::ErrorMsg(result)));
}
if(info.mask & vcg::tri::io::Mask::IOM_WEDGNORMAL)
@ -240,10 +238,10 @@ bool ExtraMeshIOPlugin::open(
// freeing memory
lib3ds_file_free(file);
return true;
}
return false;
else {
wrongOpenFormat(formatName);
}
}
bool ExtraMeshIOPlugin::save(

View File

@ -48,7 +48,7 @@ public:
const QString& format,
RichParameterList& parameters);
bool open(const QString &formatName,
void open(const QString &formatName,
const QString &fileName,
MeshModel &m,
int& mask,

View File

@ -85,21 +85,20 @@ void BaseMeshIOPlugin::initPreOpenParameter(const QString &formatName, RichParam
}
}
bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &parlst, CallBackPos *cb, QWidget * /*parent*/)
void BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &parlst, CallBackPos *cb, QWidget * /*parent*/)
{
//bool normalsUpdated = false;
QString errorMsgFormat = "Error encountered while loading file:\n\"%1\"\n\nError details: %2";
//bool normalsUpdated = false;
QString errorMsgFormat = "Error encountered while loading file:\n\"%1\"\n\nError details: %2";
if(!QFile::exists(fileName))
{
errorMessage = errorMsgFormat.arg(fileName, "File does not exist");
return false;
}
if(!QFile::exists(fileName)) {
throw MLException(errorMsgFormat.arg(fileName, "File does not exist"));
}
// initializing mask
mask = 0;
// initializing progress bar status
if (cb != NULL) (*cb)(0, "Loading...");
if (cb != NULL)
(*cb)(0, "Loading...");
//string filename = fileName.toUtf8().data();
@ -118,8 +117,7 @@ bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName,
{
if (tri::io::ImporterPLY<CMeshO>::ErrorCritical(result))
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterPLY<CMeshO>::ErrorMsg(result));
return false;
throw MLException(errorMsgFormat.arg(fileName, tri::io::ImporterPLY<CMeshO>::ErrorMsg(result)));
}
}
}
@ -127,15 +125,13 @@ bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName,
{
if (!tri::io::ImporterSTL<CMeshO>::LoadMask(filename.c_str(), mask))
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterSTL<CMeshO>::ErrorMsg(tri::io::ImporterSTL<CMeshO>::E_MALFORMED));
return false;
throw MLException(errorMsgFormat.arg(fileName, tri::io::ImporterSTL<CMeshO>::ErrorMsg(tri::io::ImporterSTL<CMeshO>::E_MALFORMED)));
}
m.Enable(mask);
int result = tri::io::ImporterSTL<CMeshO>::Open(m.cm, filename.c_str(), mask, cb);
if (result != 0) // all the importers return 0 on success
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterSTL<CMeshO>::ErrorMsg(result));
return false;
throw MLException(errorMsgFormat.arg(fileName, tri::io::ImporterSTL<CMeshO>::ErrorMsg(result)));
}
bool stluinf = parlst.getBool(stlUnifyParName());
@ -150,19 +146,19 @@ bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName,
{
tri::io::ImporterOBJ<CMeshO>::Info oi;
oi.cb = cb;
if (!tri::io::ImporterOBJ<CMeshO>::LoadMask(filename.c_str(), oi))
return false;
if (!tri::io::ImporterOBJ<CMeshO>::LoadMask(filename.c_str(), oi)){
throw MLException("Error while loading OBJ mask.");
}
m.Enable(oi.mask);
int result = tri::io::ImporterOBJ<CMeshO>::Open(m.cm, filename.c_str(), oi);
if (result != tri::io::ImporterOBJ<CMeshO>::E_NOERROR)
{
if (result & tri::io::ImporterOBJ<CMeshO>::E_NON_CRITICAL_ERROR)
if (result & tri::io::ImporterOBJ<CMeshO>::E_NON_CRITICAL_ERROR) {
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterOBJ<CMeshO>::ErrorMsg(result));
else
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterOBJ<CMeshO>::ErrorMsg(result));
return false;
}
else {
throw MLException(errorMsgFormat.arg(fileName, tri::io::ImporterOBJ<CMeshO>::ErrorMsg(result)));
}
}
@ -198,8 +194,7 @@ bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName,
int result = tri::io::ImporterPTX<CMeshO>::Open(m.cm, filename.c_str(), importparams, cb);
if (result == 1)
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterPTX<CMeshO>::ErrorMsg(result));
return false;
throw MLException(errorMsgFormat.arg(fileName, tri::io::ImporterPTX<CMeshO>::ErrorMsg(result)));
}
// update mask
@ -210,37 +205,36 @@ bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName,
int loadMask;
if (!tri::io::ImporterOFF<CMeshO>::LoadMask(filename.c_str(), loadMask))
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterOFF<CMeshO>::ErrorMsg(tri::io::ImporterOFF<CMeshO>::InvalidFile));
return false;
throw MLException(errorMsgFormat.arg(fileName, tri::io::ImporterOFF<CMeshO>::ErrorMsg(tri::io::ImporterOFF<CMeshO>::InvalidFile)));
}
m.Enable(loadMask);
int result = tri::io::ImporterOFF<CMeshO>::Open(m.cm, filename.c_str(), mask, cb);
if (result != 0) // OFFCodes enum is protected
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterOFF<CMeshO>::ErrorMsg(result));
return false;
throw MLException(errorMsgFormat.arg(fileName, tri::io::ImporterOFF<CMeshO>::ErrorMsg(result)));
}
}
else if (formatName.toUpper() == tr("VMI"))
{
int loadMask;
if (!tri::io::ImporterVMI<CMeshO>::LoadMask(filename.c_str(), loadMask))
return false;
if (!tri::io::ImporterVMI<CMeshO>::LoadMask(filename.c_str(), loadMask)) {
throw MLException("Error while loading VMI mask.");
}
m.Enable(loadMask);
int result = tri::io::ImporterVMI<CMeshO>::Open(m.cm, filename.c_str(), mask, cb);
if (result != 0)
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterOFF<CMeshO>::ErrorMsg(result));
return false;
throw MLException(errorMsgFormat.arg(fileName, tri::io::ImporterOFF<CMeshO>::ErrorMsg(result)));
}
}
else if (formatName.toUpper() == tr("GTS"))
{
int loadMask;
if (!tri::io::ImporterGTS<CMeshO>::LoadMask(filename.c_str(), loadMask))
return false;
if (!tri::io::ImporterGTS<CMeshO>::LoadMask(filename.c_str(), loadMask)){
throw MLException("Error while loading GTS mask.");
}
m.Enable(loadMask);
tri::io::ImporterGTS<CMeshO>::Options opt;
@ -249,34 +243,31 @@ bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName,
int result = tri::io::ImporterGTS<CMeshO>::Open(m.cm, filename.c_str(), mask, opt, cb);
if (result != 0)
{
errorMessage = errorMsgFormat.arg(fileName, vcg::tri::io::ImporterGTS<CMeshO>::ErrorMsg(result));
return false;
throw MLException(errorMsgFormat.arg(fileName, vcg::tri::io::ImporterGTS<CMeshO>::ErrorMsg(result)));
}
}
else if (formatName.toUpper() == tr("FBX"))
{
m.Enable(tri::io::Mask::IOM_WEDGTEXCOORD);
int result = tri::io::ImporterFBX<CMeshO>::Open(m.cm, filename.c_str(),cb);
if(m.cm.textures.empty())
m.clearDataMask(tri::io::Mask::IOM_WEDGTEXCOORD);
if (result != 0)
{
errorMessage = errorMsgFormat.arg(fileName, vcg::tri::io::ImporterFBX<CMeshO>::ErrorMsg(result));
return false;
}
}else
{
assert(0); // Unknown File type
return false;
else if (formatName.toUpper() == tr("FBX"))
{
m.Enable(tri::io::Mask::IOM_WEDGTEXCOORD);
int result = tri::io::ImporterFBX<CMeshO>::Open(m.cm, filename.c_str(),cb);
if(m.cm.textures.empty())
m.clearDataMask(tri::io::Mask::IOM_WEDGTEXCOORD);
if (result != 0)
{
throw MLException(errorMsgFormat.arg(fileName, vcg::tri::io::ImporterFBX<CMeshO>::ErrorMsg(result)));
}
}
else {
wrongOpenFormat(formatName);
}
// Add a small pass to convert backslash into forward slash
for(auto i = m.cm.textures.begin();i!=m.cm.textures.end();++i)
{
std::replace(i->begin(), i->end(), '\\', '/');
}
// Add a small pass to convert backslash into forward slash
for(auto i = m.cm.textures.begin();i!=m.cm.textures.end();++i)
{
std::replace(i->begin(), i->end(), '\\', '/');
}
// verify if texture files are present
QString missingTextureFilesMsg = "The following texture files were not found:\n";
bool someTextureNotFound = false;
@ -293,8 +284,6 @@ bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName,
log("Missing texture files: %s", qUtf8Printable(missingTextureFilesMsg));
if (cb != NULL) (*cb)(99, "Done");
return true;
}
bool BaseMeshIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList & par, CallBackPos *cb, QWidget * /*parent*/)

View File

@ -43,7 +43,7 @@ public:
void exportMaskCapability(const QString& format, int &capability, int &defaultBits) const;
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList & par, vcg::CallBackPos *cb = 0, QWidget *parent = 0);
void open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList & par, vcg::CallBackPos *cb = 0, QWidget *parent = 0);
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList & par, vcg::CallBackPos *cb = 0, QWidget *parent = 0);
//void initOpenParameter(const QString &format, MeshModel &/*m*/, RichParameterSet & par);
//void applyOpenParameter(const QString &format, MeshModel &m, const RichParameterSet &par);

View File

@ -131,20 +131,19 @@ void BreMeshIOPlugin::initPreOpenParameter(const QString &formatName, RichParame
}
bool BreMeshIOPlugin::open(const QString &/*formatName*/, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &parlst, CallBackPos *cb, QWidget * /*parent*/)
void BreMeshIOPlugin::open(const QString &/*formatName*/, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &parlst, CallBackPos *cb, QWidget * /*parent*/)
{
// initializing progress bar status
if (cb != NULL) (*cb)(0, "Loading...");
mask = 0;
QString errorMsgFormat = "Error encountered while loading file:\n\"%1\"\n\nError details: %2";
bool points = parlst.getBool("pointsonly");
int result = vcg::tri::io::ImporterBRE<CMeshO>::Open(m, m.cm, mask, fileName,points, cb);
if (result != 0) // all the importers return 0 on success
// initializing progress bar status
if (cb != NULL)
(*cb)(0, "Loading...");
mask = 0;
QString errorMsgFormat = "Error encountered while loading file:\n\"%1\"\n\nError details: %2";
bool points = parlst.getBool("pointsonly");
int result = vcg::tri::io::ImporterBRE<CMeshO>::Open(m, m.cm, mask, fileName,points, cb);
if (result != 0) // all the importers return 0 on success
{
errorMessage = errorMsgFormat.arg(fileName, ErrorMsg(result));
return false;
throw MLException(errorMsgFormat.arg(fileName, ErrorMsg(result)));
}
return true;
}
bool BreMeshIOPlugin::save(const QString & /*formatName*/,const QString & /*fileName*/, MeshModel &, const int /*mask*/, const RichParameterList & /*par*/, CallBackPos *, QWidget * /*parent*/)

View File

@ -166,7 +166,7 @@ public:
void exportMaskCapability(const QString &format, int &capability, int &defaultBits) const;
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const RichParameterList & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
void open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const RichParameterList & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList & par, vcg::CallBackPos *cb=0, QWidget *parent= 0);
virtual void initOpenParameter(const QString &format, MeshModel &/*m*/, RichParameterList & par);
virtual void applyOpenParameter(const QString &format, MeshModel &m, const RichParameterList &par);

View File

@ -101,52 +101,53 @@
using namespace std;
using namespace vcg;
bool ColladaIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, CallBackPos *cb, QWidget * /*parent*/)
void ColladaIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, CallBackPos *cb, QWidget * /*parent*/)
{
// initializing mask
mask = 0;
mask = 0;
// initializing progress bar status
if (cb != NULL) (*cb)(0, "Loading...");
QString errorMsgFormat = "Error encountered while loading file:\n\"%1\"\n\nError details: %2";
string filename = QFile::encodeName(fileName).constData ();
//std::string filename = fileName.toUtf8().data();
//std::string filename = fileName.toUtf8().data();
bool normalsUpdated = false;
if(formatName.toUpper() == tr("DAE"))
{
//m.addinfo = NULL;
tri::io::InfoDAE info;
if (!tri::io::ImporterDAE<CMeshO>::LoadMask(filename.c_str(), info))
return false;
tri::io::InfoDAE info;
if (!tri::io::ImporterDAE<CMeshO>::LoadMask(filename.c_str(), info)){
throw MLException("Error while loading DAE mask.");
}
m.Enable(info.mask);
// for(unsigned int tx = 0; tx < info->texturefile.size();++tx)
// m.cm.textures.push_back(info->texturefile[tx].toStdString());
m.Enable(info.mask);
// for(unsigned int tx = 0; tx < info->texturefile.size();++tx)
// m.cm.textures.push_back(info->texturefile[tx].toStdString());
int result = vcg::tri::io::ImporterDAE<CMeshO>::Open(m.cm, filename.c_str(),info);
if (result != vcg::tri::io::ImporterDAE<CMeshO>::E_NOERROR)
{
errorMessage = "DAE Opening Error" + QString(vcg::tri::io::ImporterDAE<CMeshO>::ErrorMsg(result));
return false;
throw MLException("DAE Opening Error" + QString(vcg::tri::io::ImporterDAE<CMeshO>::ErrorMsg(result)));
}
else _mp.push_back(&m);
if(info.mask & vcg::tri::io::Mask::IOM_WEDGNORMAL)
if(info.mask & vcg::tri::io::Mask::IOM_WEDGNORMAL)
normalsUpdated = true;
mask = info.mask;
mask = info.mask;
vcg::tri::UpdateBounding<CMeshO>::Box(m.cm); // updates bounding box
if (!normalsUpdated)
vcg::tri::UpdateNormal<CMeshO>::PerVertex(m.cm); // updates normals
if (cb != NULL) (*cb)(99, "Done");
}
else {
wrongOpenFormat(formatName);
}
vcg::tri::UpdateBounding<CMeshO>::Box(m.cm); // updates bounding box
if (!normalsUpdated)
vcg::tri::UpdateNormal<CMeshO>::PerVertex(m.cm); // updates normals
if (cb != NULL) (*cb)(99, "Done");
return true;
}
bool ColladaIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList &, vcg::CallBackPos * /*cb*/, QWidget * /*parent*/)

View File

@ -62,7 +62,7 @@ class ColladaIOPlugin : public QObject, public IOMeshPlugin
std::list<FileFormat> exportFormats() const;
void exportMaskCapability(const QString &format, int &capability, int &defaultBits) const;
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &par, vcg::CallBackPos *cb=0, QWidget *parent=0);
void open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &par, vcg::CallBackPos *cb=0, QWidget *parent=0);
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList &, vcg::CallBackPos *cb=0, QWidget *parent= 0);
};

View File

@ -36,16 +36,14 @@
using namespace vcg;
bool IOMPlugin::open(const QString & /*formatName*/, const QString &fileName, MeshModel &m, int& mask,const RichParameterList & /*par*/, CallBackPos *cb, QWidget * /*parent*/)
void IOMPlugin::open(const QString & /*formatName*/, const QString &fileName, MeshModel &m, int& mask,const RichParameterList & /*par*/, CallBackPos *cb, QWidget * /*parent*/)
{
QString errorMsgFormat = "Error encountered while loading file:\n\"%1\"\n\nError details: %2";
int result = tri::io::ImporterCTM<CMeshO>::Open(m.cm, qUtf8Printable(fileName), mask, cb);
if (result != 0) // all the importers return 0 on success
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterCTM<CMeshO>::ErrorMsg(result));
return false;
}
return true;
QString errorMsgFormat = "Error encountered while loading file:\n\"%1\"\n\nError details: %2";
int result = tri::io::ImporterCTM<CMeshO>::Open(m.cm, qUtf8Printable(fileName), mask, cb);
if (result != 0) // all the importers return 0 on success
{
throw MLException(errorMsgFormat.arg(fileName, tri::io::ImporterCTM<CMeshO>::ErrorMsg(result)));
}
}
bool IOMPlugin::save(const QString & /*formatName*/, const QString &fileName, MeshModel &m, const int mask,const RichParameterList & par, vcg::CallBackPos * /*cb*/, QWidget *parent)

View File

@ -49,7 +49,7 @@ public:
virtual void exportMaskCapability(const QString &format, int &capability, int &defaultBits) const;
void initSaveParameter(const QString &/*format*/, MeshModel &/*m*/, RichParameterList & /*par*/);
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const RichParameterList & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
void open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const RichParameterList & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask,const RichParameterList & par, vcg::CallBackPos *cb, QWidget *parent);
};

View File

@ -38,7 +38,7 @@ using namespace vcg;
bool ExpeIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList & /*parlst*/, CallBackPos *cb, QWidget*/*parent*/)
void ExpeIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList & /*parlst*/, CallBackPos *cb, QWidget*/*parent*/)
{
// initializing mask
mask = 0;
@ -57,26 +57,25 @@ bool ExpeIOPlugin::open(const QString &formatName, const QString &fileName, Mesh
if (!vcg::tri::io::ImporterExpePTS<CMeshO>::LoadMask(filename.c_str(),loadMask))
{
useXYZ=true;
if (!vcg::tri::io::ImporterXYZ<CMeshO>::LoadMask(filename.c_str(),loadMask))
return false;
}
if (!vcg::tri::io::ImporterXYZ<CMeshO>::LoadMask(filename.c_str(),loadMask)){
throw MLException("Error while loading [A]PTS mask.");
}
}
m.Enable(loadMask);
int result;
if(useXYZ) {
result = vcg::tri::io::ImporterXYZ<CMeshO>::Open(m.cm, filename.c_str(), mask, cb);
result = vcg::tri::io::ImporterXYZ<CMeshO>::Open(m.cm, filename.c_str(), mask, cb);
if (result != 0)
{
errorMessage = errorMsgFormat.arg(fileName, vcg::tri::io::ImporterXYZ<CMeshO>::ErrorMsg(result));
return false;
throw MLException(errorMsgFormat.arg(fileName, vcg::tri::io::ImporterXYZ<CMeshO>::ErrorMsg(result)));
}
}
else
{
result = vcg::tri::io::ImporterExpePTS<CMeshO>::Open(m.cm, filename.c_str(), mask, cb);
result = vcg::tri::io::ImporterExpePTS<CMeshO>::Open(m.cm, filename.c_str(), mask, cb);
if (result != 0)
{
errorMessage = errorMsgFormat.arg(fileName, vcg::tri::io::ImporterExpePTS<CMeshO>::ErrorMsg(result));
return false;
throw MLException(errorMsgFormat.arg(fileName, vcg::tri::io::ImporterExpePTS<CMeshO>::ErrorMsg(result)));
}
}
@ -84,16 +83,16 @@ bool ExpeIOPlugin::open(const QString &formatName, const QString &fileName, Mesh
else if (formatName.toLower() == tr("xyz"))
{
int loadMask;
if (!vcg::tri::io::ImporterXYZ<CMeshO>::LoadMask(filename.c_str(),loadMask))
return false;
if (!vcg::tri::io::ImporterXYZ<CMeshO>::LoadMask(filename.c_str(),loadMask)) {
throw MLException("Error while loading XYZ mask.");
}
m.Enable(loadMask);
int result = vcg::tri::io::ImporterXYZ<CMeshO>::Open(m.cm, filename.c_str(), mask, cb);
if (result != 0)
{
errorMessage = errorMsgFormat.arg(fileName, vcg::tri::io::ImporterXYZ<CMeshO>::ErrorMsg(result));
return false;
throw MLException(errorMsgFormat.arg(fileName, vcg::tri::io::ImporterXYZ<CMeshO>::ErrorMsg(result)));
}
}
@ -101,8 +100,6 @@ bool ExpeIOPlugin::open(const QString &formatName, const QString &fileName, Mesh
if (cb != NULL)
(*cb)(99, "Done");
return true;
}
bool ExpeIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList &, vcg::CallBackPos * /*cb*/, QWidget *parent)

View File

@ -44,7 +44,7 @@ public:
virtual void exportMaskCapability(const QString &format, int &capability, int &defaultBits) const;
// void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, RichParameterSet & /*par*/);
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, vcg::CallBackPos *cb=0, QWidget *parent=0);
void open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, vcg::CallBackPos *cb=0, QWidget *parent=0);
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList &, vcg::CallBackPos *cb, QWidget *parent);
};

View File

@ -45,16 +45,9 @@ QString JSONIOPlugin::pluginName() const
return "IOJson";
}
bool JSONIOPlugin::open(const QString & formatName, const QString & fileName, MeshModel & m, int & mask, const RichParameterList & parlst, vcg::CallBackPos * cb, QWidget * /*parent*/)
void JSONIOPlugin::open(const QString & formatName, const QString &, MeshModel &, int &, const RichParameterList &, vcg::CallBackPos *, QWidget * /*parent*/)
{
(void)formatName;
(void)fileName;
(void)m;
(void)mask;
(void)parlst;
(void)cb;
return false;
wrongOpenFormat(formatName);
}
bool JSONIOPlugin::save(const QString & formatName,const QString & fileName, MeshModel & m, const int mask, const RichParameterList & par, vcg::CallBackPos * cb, QWidget * parent)

View File

@ -44,7 +44,7 @@ public:
void exportMaskCapability(const QString & format, int & capability, int & defaultBits) const;
bool open(const QString & formatName, const QString & fileName, MeshModel & m, int & mask, const RichParameterList & par, vcg::CallBackPos * cb = 0, QWidget * parent = 0);
void open(const QString & formatName, const QString & fileName, MeshModel & m, int & mask, const RichParameterList & par, vcg::CallBackPos * cb = 0, QWidget * parent = 0);
bool save(const QString & formatName, const QString & fileName, MeshModel & m, const int mask, const RichParameterList & par, vcg::CallBackPos * cb = 0, QWidget * parent = 0);
};

View File

@ -64,7 +64,7 @@ void PDBIOPlugin::initPreOpenParameter(const QString &formatName, RichParameterL
}
}
bool PDBIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &parlst, CallBackPos *cb, QWidget * /*parent*/)
void PDBIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &parlst, CallBackPos *cb, QWidget * /*parent*/)
{
//bool normalsUpdated = false;
@ -72,63 +72,25 @@ bool PDBIOPlugin::open(const QString &formatName, const QString &fileName, MeshM
mask = 0;
// initializing progress bar status
if (cb != NULL) (*cb)(0, "Loading...");
if (cb != NULL)
(*cb)(0, "Loading...");
QString errorMsgFormat = "Error encountered while loading file:\n\"%1\"\n\nError details: %2";
//string filename = fileName.toUtf8().data();
string filename = QFile::encodeName(fileName).constData ();
if (formatName.toUpper() == tr("PDB"))
if (formatName.toUpper() == tr("PDB"))
{
mask |= vcg::tri::io::Mask::IOM_VERTCOLOR;
m.Enable(mask);
return parsePDB(qUtf8Printable(fileName), m.cm, parlst, cb);
/*
tri::io::ImporterPTX<CMeshO>::Info importparams;
importparams.meshnum = parlst.getInt("meshindex");
importparams.anglecull =parlst.getBool("anglecull");
importparams.angle = parlst.getFloat("angle");
importparams.savecolor = parlst.getBool("usecolor");
importparams.pointcull = parlst.getBool("pointcull");
importparams.pointsonly = parlst.getBool("pointsonly");
importparams.switchside = parlst.getBool("switchside");
importparams.flipfaces = parlst.getBool("flipfaces");
// if color, add to mesh
if(importparams.savecolor)
importparams.mask |= tri::io::Mask::IOM_VERTCOLOR;
// reflectance is stored in quality
importparams.mask |= tri::io::Mask::IOM_VERTQUALITY;
m.Enable(importparams.mask);
int result = tri::io::ImporterPTX<CMeshO>::Open(m.cm, filename.c_str(), importparams, cb);
if (result == 1)
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterPTX<CMeshO>::ErrorMsg(result));
return false;
}
// update mask
mask = importparams.mask;
*/
if (!parsePDB(qUtf8Printable(fileName), m.cm, parlst, cb))
throw MLException("Error while opening PDB file");
if (cb != NULL)
(*cb)(99, "Done");
}
else
{
assert(0); // Unknown File type
return false;
else {
wrongOpenFormat(formatName);
}
if (cb != NULL) (*cb)(99, "Done");
return true;
}
bool PDBIOPlugin::save(const QString & /*formatName*/,const QString & /*fileName*/, MeshModel & /*m*/, const int /*mask*/, const RichParameterList & /*par*/, CallBackPos * /*cb*/, QWidget * /*parent*/)

View File

@ -42,9 +42,9 @@ public:
void exportMaskCapability(const QString &format, int &capability, int &defaultBits) const;
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const RichParameterList & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
void open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const RichParameterList & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList & par, vcg::CallBackPos *cb=0, QWidget *parent= 0);
virtual void initOpenParameter(const QString &format, MeshModel &/*m*/, RichParameterList & par);
virtual void initOpenParameter(const QString &format, MeshModel &/*m*/, RichParameterList & par);
virtual void applyOpenParameter(const QString &format, MeshModel &m, const RichParameterList &par);
void initPreOpenParameter(const QString &formatName, RichParameterList &parlst);

View File

@ -44,30 +44,30 @@ void TriIOPlugin::initPreOpenParameter(const QString &format, RichParameterList
}
}
bool TriIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &parlst, CallBackPos *cb, QWidget *)
void TriIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &parlst, CallBackPos *cb, QWidget *)
{
if(formatName.toUpper() == tr("TRI"))
{
mask |= vcg::tri::io::Mask::IOM_WEDGTEXCOORD;
m.Enable(mask);
if (!parseTRI(qUtf8Printable(fileName), m.cm))
throw MLException("Error while opening TRI file");
}
else if(formatName.toUpper() == tr("ASC"))
{
mask |= vcg::tri::io::Mask::IOM_VERTQUALITY;
m.Enable(mask);
bool triangulate = parlst.getBool("triangulate");
int rowToSkip = parlst.getInt("rowToSkip");
int result = tri::io::ImporterASC<CMeshO>::Open(m.cm, qUtf8Printable(fileName),cb,triangulate,rowToSkip);
if (result != 0) // all the importers return 0 on success
{
mask |= vcg::tri::io::Mask::IOM_WEDGTEXCOORD;
m.Enable(mask);
return parseTRI(qUtf8Printable(fileName), m.cm);
throw MLException("Error while opening ASC file");
}
if(formatName.toUpper() == tr("ASC"))
{
mask |= vcg::tri::io::Mask::IOM_VERTQUALITY;
m.Enable(mask);
bool triangulate = parlst.getBool("triangulate");
int rowToSkip = parlst.getInt("rowToSkip");
int result = tri::io::ImporterASC<CMeshO>::Open(m.cm, qUtf8Printable(fileName),cb,triangulate,rowToSkip);
if (result != 0) // all the importers return 0 on success
{
errorMessage = QString("Failed to open:")+fileName;
return false;
}
return true;
}
return false;
}
else {
wrongOpenFormat(formatName);
}
}
bool TriIOPlugin::save(const QString &, const QString &, MeshModel &, const int, const RichParameterList &, vcg::CallBackPos *, QWidget *)

View File

@ -48,7 +48,7 @@ public:
virtual void exportMaskCapability(const QString &format, int &capability, int &defaultBits) const;
virtual void initPreOpenParameter(const QString &/*format*/, RichParameterList & /*par*/);
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, vcg::CallBackPos *cb=0, QWidget *parent=0);
void open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, vcg::CallBackPos *cb=0, QWidget *parent=0);
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList &, vcg::CallBackPos *cb, QWidget *parent);
};

View File

@ -59,31 +59,30 @@ void TxtIOPlugin::initPreOpenParameter(const QString &format, RichParameterList
}
}
bool TxtIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &parlst, CallBackPos * /*cb*/, QWidget * /*parent*/)
void TxtIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &parlst, CallBackPos * /*cb*/, QWidget * /*parent*/)
{
bool result=false;
if(formatName.toUpper() == tr("TXT")) {
int rowToSkip = parlst.getInt("rowToSkip");
int dataSeparator = parlst.getEnum("separator");
int dataFormat = parlst.getEnum("strformat");
int rgbMode = parlst.getEnum("rgbmode");
int onError = parlst.getEnum("onerror");
if(formatName.toUpper() == tr("TXT"))
{
int rowToSkip = parlst.getInt("rowToSkip");
int dataSeparator = parlst.getEnum("separator");
int dataFormat = parlst.getEnum("strformat");
int rgbMode = parlst.getEnum("rgbmode");
int onError = parlst.getEnum("onerror");
if(!(dataFormat==0) && !(dataFormat==6) && !(dataFormat==10))
mask |= vcg::tri::io::Mask::IOM_VERTQUALITY;
if(!(dataFormat==0) && !(dataFormat==10))
mask |= vcg::tri::io::Mask::IOM_VERTCOLOR;
if((dataFormat==3) || (dataFormat==4) || (dataFormat==5) || (dataFormat>=8))
mask |= vcg::tri::io::Mask::IOM_VERTNORMAL;
if(!(dataFormat==0) && !(dataFormat==6) && !(dataFormat==10))
mask |= vcg::tri::io::Mask::IOM_VERTQUALITY;
if(!(dataFormat==0) && !(dataFormat==10))
mask |= vcg::tri::io::Mask::IOM_VERTCOLOR;
if((dataFormat==3) || (dataFormat==4) || (dataFormat==5) || (dataFormat>=8))
mask |= vcg::tri::io::Mask::IOM_VERTNORMAL;
m.Enable(mask);
m.Enable(mask);
return parseTXT(fileName, m.cm, rowToSkip, dataSeparator, dataFormat, rgbMode, onError);
}
return result;
if (!parseTXT(fileName, m.cm, rowToSkip, dataSeparator, dataFormat, rgbMode, onError))
throw MLException("Error while opening TXT file.");
}
else {
wrongOpenFormat(formatName);
}
}
bool TxtIOPlugin::save(const QString & /*formatName*/, const QString & /*fileName*/, MeshModel & /*m*/, const int /*mask*/, const RichParameterList &, vcg::CallBackPos * /*cb*/, QWidget * /*parent*/)

View File

@ -42,7 +42,7 @@ public:
virtual void exportMaskCapability(const QString &format, int &capability, int &defaultBits) const;
virtual void initPreOpenParameter(const QString &/*format*/, RichParameterList & /*par*/);
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, vcg::CallBackPos *cb=0, QWidget *parent=0);
void open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, vcg::CallBackPos *cb=0, QWidget *parent=0);
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList &, vcg::CallBackPos *cb, QWidget *parent);
};

View File

@ -44,8 +44,8 @@ U3DIOPlugin::U3DIOPlugin() :
{
}
bool U3DIOPlugin::open(
const QString &,
void U3DIOPlugin::open(
const QString& format,
const QString &,
MeshModel &,
int&,
@ -53,7 +53,7 @@ bool U3DIOPlugin::open(
CallBackPos *,
QWidget *)
{
return false;
wrongOpenFormat(format);
}
bool U3DIOPlugin::save(
const QString &formatName,

View File

@ -48,7 +48,7 @@ public:
virtual void exportMaskCapability(const QString &format, int &capability, int &defaultBits) const;
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, vcg::CallBackPos *cb=0, QWidget *parent=0);
void open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, vcg::CallBackPos *cb=0, QWidget *parent=0);
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList &, vcg::CallBackPos *cb=0, QWidget *parent= 0);
void initSaveParameter(const QString &format, MeshModel &/*m*/, RichParameterList &par);

View File

@ -31,7 +31,7 @@
using namespace std;
using namespace vcg;
bool IoX3DPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, CallBackPos *cb, QWidget */*parent*/)
void IoX3DPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, CallBackPos *cb, QWidget */*parent*/)
{
// initializing mask
mask = 0;
@ -52,9 +52,7 @@ bool IoX3DPlugin::open(const QString &formatName, const QString &fileName, MeshM
result = vcg::tri::io::ImporterX3D<CMeshO>::LoadMaskVrml(filename.c_str(), info);
if ( result != vcg::tri::io::ImporterX3D<CMeshO>::E_NOERROR)
{
errorMessage = errorMsgFormat.arg(fileName, info->filenameStack[info->filenameStack.size()-1], vcg::tri::io::ImporterX3D<CMeshO>::ErrorMsg(result));
delete info;
return false;
throw MLException(errorMsgFormat.arg(fileName, info->filenameStack[info->filenameStack.size()-1], vcg::tri::io::ImporterX3D<CMeshO>::ErrorMsg(result)));
}
if (info->mask & vcg::tri::io::Mask::IOM_VERTTEXCOORD)
{
@ -74,16 +72,14 @@ bool IoX3DPlugin::open(const QString &formatName, const QString &fileName, MeshM
QString fileError = info->filenameStack[info->filenameStack.size()-1];
QString lineError;
lineError.setNum(info->lineNumberError);
errorMessage = errorMsgFormat.arg(fileName, fileError, lineError, vcg::tri::io::ImporterX3D<CMeshO>::ErrorMsg(result));
delete info;
return false;
throw MLException(errorMsgFormat.arg(fileName, fileError, lineError, vcg::tri::io::ImporterX3D<CMeshO>::ErrorMsg(result)));
}
if (m.cm.vert.size() == 0)
{
errorMsgFormat = "Error encountered while loading file:\n\"%1\"\n\nError details: File without a geometry";
errorMessage = errorMsgFormat.arg(fileName);
delete info;
return false;
throw MLException(errorMsgFormat.arg(fileName));
}
if(info->mask & vcg::tri::io::Mask::IOM_WEDGNORMAL)
normalsUpdated = true;
@ -116,11 +112,11 @@ bool IoX3DPlugin::open(const QString &formatName, const QString &fileName, MeshM
vcg::tri::UpdateNormal<CMeshO>::PerVertexPerFace(m.cm); // updates normals
delete info;
if (cb != NULL) (*cb)(99, "Done");
}
else {
wrongOpenFormat(formatName);
}
// verify if texture files are present
if (cb != NULL) (*cb)(99, "Done");
return true;
}

View File

@ -51,7 +51,7 @@ public:
virtual void exportMaskCapability(const QString &format, int &capability, int &defaultBits) const;
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, vcg::CallBackPos *cb=0, QWidget *parent=0);
void open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &, vcg::CallBackPos *cb=0, QWidget *parent=0);
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList &, vcg::CallBackPos *cb, QWidget *parent);
};

View File

@ -188,13 +188,14 @@ public:
pCurrentIOPlugin->initPreOpenParameter(extension,prePar);
prePar.join(meshlab::defaultGlobalParameterList());
if (!pCurrentIOPlugin->open(extension, fileName, mm ,mask,prePar))
{
try {
pCurrentIOPlugin->open(extension, fileName, mm ,mask,prePar);
}
catch(const MLException& e){
fprintf(fp,"MeshLabServer: Failed loading of %s from dir %s\n", qUtf8Printable(fileName), qUtf8Printable(QDir::currentPath()));
QDir::setCurrent(curDir.absolutePath());
return false;
}
// In case of polygonal meshes the normal should be updated accordingly
if( mask & vcg::tri::io::Mask::IOM_BITPOLYGONAL)
{
@ -310,9 +311,11 @@ public:
md->setBusy(true);
pCurrentIOPlugin->setLog(&md->Log);
if (!pCurrentIOPlugin->open(extension, fileNameSansDir, *mm ,mask,*prePar))
{
fprintf(fp, "Opening Failure: %s", (QString("While opening: '%1'\n\n").arg(fileName)+pCurrentIOPlugin->errorMsg()).toStdString().c_str()); // text+
try {
pCurrentIOPlugin->open(extension, fileNameSansDir, *mm ,mask,*prePar);
}
catch (const MLException& e) {
fprintf(fp, "Opening Failure: %s", (QString("While opening: '%1'\n\n").arg(fileName)+e.what()).toStdString().c_str()); // text+
pCurrentIOPlugin->clearErrorString();
md->setBusy(false);
QDir::setCurrent(origDir); // undo the change of directory before leaving