using settings values for initPreOpen

This commit is contained in:
alemuntoni 2021-04-28 14:29:18 +02:00
parent b83e8e7b26
commit dc5799039e
3 changed files with 12 additions and 5 deletions

View File

@ -2420,7 +2420,16 @@ bool MainWindow::importMesh(QString fileName)
// the user does not want to see the parameter dialog
// need to take the default values from the currentGlobalParams
else {
//TODO
for (RichParameter& p : prePar){
QString prefixName = "MeshLab::IO::" + extension.toUpper() + "::";
if (currentGlobalParams.hasParameter(prefixName + p.name())){
const RichParameter& cp = currentGlobalParams.getParameterByName(prefixName + p.name());
p.setValue(cp.value());
}
else {
qDebug() << "ERROR!!! " + prefixName + p.name() + " not found in global params.";
}
}
}
}

View File

@ -136,7 +136,7 @@ void BaseMeshIOPlugin::initPreOpenParameter(const QString &formatName, RichParam
parlst.addParam(RichFloat("angle", 85.0, "Angle limit for face culling", "short"));
}
if (formatName.toUpper() == tr("STL")) {
parlst.addParam(RichBool(stlUnifyParName(), true, "Unify Duplicated Vertices in STL files", "The STL format is not an vertex-indexed format. Each triangle is composed by independent vertices, so, usually, duplicated vertices should be unified"));
parlst.addParam(RichBool("unify_vertices", true, "Unify Duplicated Vertices in STL files", "The STL format is not an vertex-indexed format. Each triangle is composed by independent vertices, so, usually, duplicated vertices should be unified"));
}
}
@ -189,7 +189,7 @@ void BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName,
throw MLException(errorMsgFormat.arg(fileName, tri::io::ImporterSTL<CMeshO>::ErrorMsg(result)));
}
bool stluinf = parlst.getBool(stlUnifyParName());
bool stluinf = parlst.getBool("unify_vertices");
if (stluinf)
{
tri::Clean<CMeshO>::RemoveDuplicateVertex(m.cm);

View File

@ -76,8 +76,6 @@ public:
private:
std::list<FileFormat> rasterFormatList;
static QString stlUnifyParName() { return QString("MeshLab::IO::STL::UnifyVertices"); }
};
#endif