filer-script execution (interface) did not properly updated rendering buffers

TO BE TESTED
This commit is contained in:
Marco Callieri 2018-03-20 15:50:58 +01:00
parent aac6cdac3d
commit 3a98aafd4d

View File

@ -841,6 +841,7 @@ void MainWindow::runFilterScript()
{
QString filtnm = (*ii)->filterName();
int classes = 0;
int postCondMask = 0;
if (!(*ii)->isXMLFilter())
{
QAction *action = PM.actionFilterMap[ filtnm];
@ -925,11 +926,14 @@ void MainWindow::runFilterScript()
//WARNING!!!!!!!!!!!!
/* to be changed */
iFilter->applyFilter( action, *meshDoc(), old->pair.second, QCallBack );
for (MeshModel* mm = meshDoc()->nextMesh(); mm != NULL; mm = meshDoc()->nextMesh(mm))
vcg::tri::Allocator<CMeshO>::CompactEveryVector(mm->cm);
meshDoc()->setBusy(false);
if (shar != NULL)
shar->removeView(iFilter->glContext);
delete iFilter->glContext;
classes = int(iFilter->getClass(action));
postCondMask = iFilter->postCondition(action);
}
else
{
@ -1025,6 +1029,8 @@ void MainWindow::runFilterScript()
/* IT SHOULD INVOKE executeFilter function. Unfortunately this function create a different thread for each invoked filter, and the MeshLab synchronization mechanisms are quite naive. Better to invoke the filters list in the same thread*/
meshDoc()->setBusy(true);
cppfilt->applyFilter( filtnm, *meshDoc(), envwrap, QCallBack );
for (MeshModel* mm = meshDoc()->nextMesh(); mm != NULL; mm = meshDoc()->nextMesh(mm))
vcg::tri::Allocator<CMeshO>::CompactEveryVector(mm->cm);
meshDoc()->setBusy(false);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ((currentViewContainer() != NULL) && (currentViewContainer()->sharedDataContext() != NULL))
@ -1032,9 +1038,11 @@ void MainWindow::runFilterScript()
delete cppfilt->glContext;
GLA()->completeUpdateRequested();
connect(meshDoc(),SIGNAL(documentUpdated()),GLA(),SLOT(completeUpdateRequested()));
/* executeFilter(&cont,*env);*/
QStringList filterClassesList = cont.xmlInfo->filterAttribute(filtnm,MLXMLElNames::filterClass).split(QRegExp("\\W+"), QString::SkipEmptyParts);
classes = MeshLabFilterInterface::convertStringListToCategoryEnum(filterClassesList);
QString postCond = cont.xmlInfo->filterAttribute(filtnm, MLXMLElNames::filterPostCond);
QStringList postCondList = postCond.split(QRegExp("\\W+"), QString::SkipEmptyParts);
postCondMask = MeshLabFilterInterface::convertStringListToMeshElementEnum(postCondList);
}
else
throw MLException("WARNING! The MeshLab Script System is able to manage just the C++ XML filters.");
@ -1048,23 +1056,26 @@ void MainWindow::runFilterScript()
{
if(classes & MeshFilterInterface::FaceColoring )
{
//GLA()->setColorMode(vcg::GLW::CMPerFace);
meshDoc()->mm()->updateDataMask(MeshModel::MM_FACECOLOR);
}
if(classes & MeshFilterInterface::VertexColoring ){
//GLA()->setColorMode(vcg::GLW::CMPerVert);
meshDoc()->mm()->updateDataMask(MeshModel::MM_VERTCOLOR);
}
if(classes & MeshModel::MM_COLOR)
{
//GLA()->setColorMode(vcg::GLW::CMPerMesh);
meshDoc()->mm()->updateDataMask(MeshModel::MM_COLOR);
}
if(classes & MeshModel::MM_CAMERA)
meshDoc()->mm()->updateDataMask(MeshModel::MM_CAMERA);
}
if(classes & MeshFilterInterface::MeshCreation )
bool newmeshcreated = false;
if (classes & MeshFilterInterface::MeshCreation)
newmeshcreated = true;
updateSharedContextDataAfterFilterExecution(postCondMask, classes, newmeshcreated);
meshDoc()->meshDocStateData().clear();
if(classes & MeshFilterInterface::MeshCreation)
GLA()->resetTrackBall();
/* to be changed */
@ -1414,7 +1425,7 @@ from the user defined dialog
void MainWindow::executeFilter(QAction *action, RichParameterSet &params, bool isPreview)
{
MeshFilterInterface *iFilter = qobject_cast< MeshFilterInterface *>(action->parent());
MeshFilterInterface *iFilter = qobject_cast<MeshFilterInterface *>(action->parent());
qb->show();
iFilter->setLog(&meshDoc()->Log);
@ -1914,16 +1925,13 @@ void MainWindow::postFilterExecution()
}
if(fclasses & MeshFilterInterface::FaceColoring ) {
//GLA()->setColorMode(vcg::GLW::CMPerFace);
meshDoc()->mm()->updateDataMask(MeshModel::MM_FACECOLOR);
}
if(fclasses & MeshFilterInterface::VertexColoring ){
/*GLA()->setColorMode(vcg::GLW::CMPerVert);*/
meshDoc()->mm()->updateDataMask(MeshModel::MM_VERTCOLOR);
}
if(fclasses & MeshModel::MM_COLOR)
{
/*GLA()->setColorMode(vcg::GLW::CMPerMesh);*/
meshDoc()->mm()->updateDataMask(MeshModel::MM_COLOR);
}