mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-20 11:26:11 +00:00
StartDecorate is now boolean. So decorations can fail on startup for various reasons.
This commit is contained in:
parent
12ec5c480d
commit
d60847e5a8
@ -491,7 +491,7 @@ public:
|
||||
|
||||
virtual void initGlobalParameterSet(QAction *, FilterParameterSet * /*globalparam*/) {}
|
||||
|
||||
virtual void StartDecorate(QAction * /*mode*/, MeshModel &/*m*/, GLArea * /*parent*/){};
|
||||
virtual bool StartDecorate(QAction * /*mode*/, MeshModel &/*m*/, GLArea * /*parent*/){assert(0); return false;};
|
||||
virtual void Decorate(QAction * /*mode*/, MeshModel &/*m*/, FilterParameterSet * /*param*/, GLArea * /*parent*/,QFont qf) = 0;
|
||||
virtual void EndDecorate(QAction * /*mode*/, MeshModel &/*m*/, GLArea * /*parent*/){};
|
||||
|
||||
|
||||
@ -730,10 +730,13 @@ void MainWindow::applyDecorateMode()
|
||||
if(!found){
|
||||
FilterParameterSet * decoratorParams = new FilterParameterSet();
|
||||
iDecorateTemp->initGlobalParameterSet(action,decoratorParams);
|
||||
iDecorateTemp->StartDecorate(action,*GLA()->mm(),GLA());
|
||||
GLA()->iDecoratorsList.push_back(make_pair(action,decoratorParams));
|
||||
|
||||
GLA()->log.Logf(GLLogStream::SYSTEM,"Enable Decorate mode %s",qPrintable(action->text()));
|
||||
bool ret = iDecorateTemp->StartDecorate(action,*GLA()->mm(),GLA());
|
||||
if(ret) {
|
||||
GLA()->iDecoratorsList.push_back(make_pair(action,decoratorParams));
|
||||
GLA()->log.Logf(GLLogStream::SYSTEM,"Enable Decorate mode %s",qPrintable(action->text()));
|
||||
}
|
||||
else GLA()->log.Logf(GLLogStream::SYSTEM,"Failed Decorate mode %s",qPrintable(action->text()));
|
||||
|
||||
}
|
||||
GLA()->update();
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ void ExtraMeshDecoratePlugin::Decorate(QAction *a, MeshModel &m, FilterParameter
|
||||
}
|
||||
else
|
||||
if( ID(a) == DP_SHOW_VERT_PRINC_CURV_DIR){
|
||||
if(vcg::tri::HasPerVertexCurvatureDir(m.cm))
|
||||
if(m.hasDataMask(MeshModel::MM_VERTCURVDIR))
|
||||
for(vi=m.cm.vert.begin();vi!=m.cm.vert.end();++vi) if(!(*vi).IsD())
|
||||
{
|
||||
glColor4f(1.0,0.0,0.0,.6f);
|
||||
@ -450,18 +450,24 @@ void ExtraMeshDecoratePlugin::DrawBBoxCorner(MeshModel &m, bool absBBoxFlag)
|
||||
|
||||
|
||||
|
||||
void ExtraMeshDecoratePlugin::StartDecorate(QAction * action, MeshModel &m, GLArea *)
|
||||
bool ExtraMeshDecoratePlugin::StartDecorate(QAction * action, MeshModel &m, GLArea *)
|
||||
{
|
||||
if( ID(action) == DP_SHOW_VERT_LABEL || ID(action) == DP_SHOW_FACE_LABEL)
|
||||
{
|
||||
if(m.cm.vn <1000 && m.cm.fn<2000) {
|
||||
isMeshOk[&m] = true;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
QMessageBox::StandardButton ret=QMessageBox::question(0,"","Warning: the mesh contains many faces and vertices.<br>Printing on the screen thousand of numbers is useless and VERY SLOW <br> Do you REALLY want this? ",QMessageBox::Yes|QMessageBox::No);
|
||||
if(ret==QMessageBox::Yes) isMeshOk[&m] = true;
|
||||
else isMeshOk[&m] = false;
|
||||
else isMeshOk[&m] = false;
|
||||
return isMeshOk[&m];
|
||||
}
|
||||
if( ID(action) == DP_SHOW_VERT_PRINC_CURV_DIR )
|
||||
{
|
||||
if(m.hasDataMask(MeshModel::MM_VERTCURVDIR)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void ExtraMeshDecoratePlugin::DrawFaceLabel(MeshModel &m, QGLWidget *gla, QFont qf)
|
||||
{
|
||||
|
||||
@ -179,7 +179,7 @@ public:
|
||||
QHash<MeshModel *, bool> isMeshOk;
|
||||
|
||||
virtual void Decorate(QAction *a, MeshModel &m, FilterParameterSet *, GLArea *gla,QFont qf);
|
||||
virtual void StartDecorate(QAction * /*mode*/, MeshModel &/*m*/, GLArea * /*parent*/);
|
||||
virtual bool StartDecorate(QAction * /*mode*/, MeshModel &/*m*/, GLArea * /*parent*/);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user