From 25f3d17b1d1d47ddc51179cb955f3027b7638745 Mon Sep 17 00:00:00 2001 From: granzuglia Date: Tue, 29 Jan 2019 15:37:47 +1100 Subject: [PATCH] - fixed a lot of bugs --- src/common/interfaces.h | 1 + src/common/meshmodel.cpp | 11 ++++++-- src/common/meshmodel.h | 3 ++- src/common/ml_mesh_type.h | 3 +++ src/common/mlapplication.h | 8 +++++- src/common/scriptinterface.cpp | 26 +++++++++++++++++++ src/common/scriptinterface.h | 2 ++ src/meshlab/glarea.cpp | 16 +++++++----- src/meshlab/glarea.h | 6 +++++ src/meshlab/mainwindow_RunTime.cpp | 10 +------ src/meshlab/ml_std_par_dialog.cpp | 7 +++++ src/meshlab/stdpardialog.cpp | 2 +- src/meshlab/xmlstdpardialog.cpp | 15 +++++++++++ .../edit_align/align/OccupancyGrid.h | 2 +- .../filter_meshing/filter_meshing.pro | 5 ++++ 15 files changed, 96 insertions(+), 21 deletions(-) diff --git a/src/common/interfaces.h b/src/common/interfaces.h index 2429fc6571..63acc4b6f2 100644 --- a/src/common/interfaces.h +++ b/src/common/interfaces.h @@ -673,6 +673,7 @@ class MeshLabFilterInterface : public QObject, public MeshLabInterface bool intteruptreq; signals: void renderingDataRequested(int); + void updateDecorators(int); }; #if (QT_VERSION >= 0x050000) diff --git a/src/common/meshmodel.cpp b/src/common/meshmodel.cpp index 52dfba7c81..9786f4c06e 100644 --- a/src/common/meshmodel.cpp +++ b/src/common/meshmodel.cpp @@ -121,6 +121,11 @@ void MeshDocument::setCurrentRaster( int i) return; } +void MeshDocument::requestUpdatingPerMeshDecorators(int meshid) +{ + emit updateDecorators(meshid); +} + template QString NameDisambiguator(QList &elemList, QString meshLabel ) { @@ -606,11 +611,13 @@ bool MeshModelState::apply(MeshModel *_m) if(changeMask & MeshModel::MM_VERTCOORD) { - if(vertCoord.size() != m->cm.vert.size()) return false; + if(vertCoord.size() != m->cm.vert.size()) + return false; std::vector::iterator ci; CMeshO::VertexIterator vi; for(vi = m->cm.vert.begin(), ci = vertCoord.begin(); vi != m->cm.vert.end(); ++vi, ++ci) - if(!(*vi).IsD()) (*vi).P()=(*ci); + if(!(*vi).IsD()) + (*vi).P()=(*ci); } if(changeMask & MeshModel::MM_VERTNORMAL) diff --git a/src/common/meshmodel.h b/src/common/meshmodel.h index 1f855319a1..a60b21a368 100644 --- a/src/common/meshmodel.h +++ b/src/common/meshmodel.h @@ -560,7 +560,7 @@ class MeshDocument : public QObject void updateRenderStateMeshes(const QList& mm,const int meshupdatemask); void updateRenderStateRasters(const QList& rm,const int rasterupdatemask);*/ - + void requestUpdatingPerMeshDecorators(int mesh_id); private: int meshIdCounter; @@ -664,6 +664,7 @@ class MeshDocument : public QObject //this signal is emitted when a filter request to update the mesh in the renderingState void documentUpdated(); + void updateDecorators(int mesh_id); };// end class MeshDocument diff --git a/src/common/ml_mesh_type.h b/src/common/ml_mesh_type.h index 4329a3a774..83f3d08d06 100644 --- a/src/common/ml_mesh_type.h +++ b/src/common/ml_mesh_type.h @@ -138,6 +138,9 @@ public : int sfn; //The number of selected faces. int svn; //The number of selected vertices. + int pvn; //the number of the polygonal vertices + int pfn; //the number of the polygonal faces + Matrix44m Tr; // Usually it is the identity. It is applied in rendering and filters can or cannot use it. (most of the filter will ignore this) const Box3m &trBB() diff --git a/src/common/mlapplication.h b/src/common/mlapplication.h index 25b130a3d7..ef1f8c6de8 100644 --- a/src/common/mlapplication.h +++ b/src/common/mlapplication.h @@ -2,6 +2,7 @@ #define ML_APPLICATION_H #include +#include #include #include #include "ml_mesh_type.h" @@ -16,7 +17,12 @@ class MeshLabApplication : public QApplication static const QString appName(){return tr("MeshLab"); } static const QString architecturalSuffix(const HW_ARCHITECTURE hw) {return "_" + QString::number(int(hw)) + "bit";} static const QString appArchitecturalName(const HW_ARCHITECTURE hw) {return appName() + architecturalSuffix(hw) + "_" + MeshLabScalarTest::floatingPointPrecision();} - static const QString appVer() {return tr("2018.04"); } + static const QString appVer() + { + const QDate dt = QDate::currentDate(); + return QString::number(dt.year()) + "." + QString::number(dt.month()); + } + static const QString shortName() { return appName() + " " + appVer(); } static const QString completeName(const HW_ARCHITECTURE hw){return appArchitecturalName(hw) + " v" + appVer(); } static const QString organization(){return tr("VCG");} diff --git a/src/common/scriptinterface.cpp b/src/common/scriptinterface.cpp index 47956b452d..41c71a2c0d 100644 --- a/src/common/scriptinterface.cpp +++ b/src/common/scriptinterface.cpp @@ -635,6 +635,20 @@ float EnvWrap::evalFloat(const QString& nm) return float(); } +MESHLAB_SCALAR EnvWrap::evalReal(const QString& nm) +{ + try + { + double result = evalDouble(nm); + return (MESHLAB_SCALAR)result; + } + catch (ExpressionHasNotThisTypeException& /*exc*/) + { + throw ExpressionHasNotThisTypeException("Real", nm); + } + return MESHLAB_SCALAR(); +} + int EnvWrap::evalInt(const QString& nm) { try @@ -661,6 +675,18 @@ vcg::Point3f EnvWrap::evalVec3(const QString& nm) return vcg::Point3f(); } +vcg::Point3 EnvWrap::evalVec3Real(const QString& nm) +{ + QScriptValue result = evalExp(nm); + QVariant resVar = result.toVariant(); + QVariantList resList = resVar.toList(); + if (resList.size() == 3) + return vcg::Point3(resList[0].toReal(), resList[1].toReal(), resList[2].toReal()); + else + throw ExpressionHasNotThisTypeException("Vec3", nm); + return vcg::Point3(); +} + int EnvWrap::evalEnum(const QString& nm) { return evalInt(nm); diff --git a/src/common/scriptinterface.h b/src/common/scriptinterface.h index 12c3c16d2a..fe7a61f39f 100644 --- a/src/common/scriptinterface.h +++ b/src/common/scriptinterface.h @@ -250,8 +250,10 @@ class EnvWrap bool evalBool(const QString& nm); double evalDouble(const QString& nm); float evalFloat( const QString& nm ); + MESHLAB_SCALAR evalReal(const QString& nm); int evalInt( const QString& nm ); vcg::Point3f evalVec3(const QString& nm); + vcg::Point3 evalVec3Real(const QString& nm); QColor evalColor(const QString& nm); /*QString getExpType(const QString& nm);*/ QString evalString(const QString& nm); diff --git a/src/meshlab/glarea.cpp b/src/meshlab/glarea.cpp index 7cf6c5e4de..42d2c08678 100644 --- a/src/meshlab/glarea.cpp +++ b/src/meshlab/glarea.cpp @@ -100,7 +100,8 @@ GLArea::GLArea(QWidget *parent, MultiViewer_Container *mvcont, RichParameterSet //connect(this->md(), SIGNAL(meshDocumentModified()), this, SLOT(updateAllPerMeshDecorators()),Qt::QueuedConnection); connect(this->md(), SIGNAL(meshSetChanged()), this, SLOT(updateMeshSetVisibilities())); connect(this->md(), SIGNAL(rasterSetChanged()), this, SLOT(updateRasterSetVisibilities())); - connect(this->md(),SIGNAL(documentUpdated()),this,SLOT(completeUpdateRequested())); + connect(this->md(), SIGNAL(documentUpdated()),this,SLOT(completeUpdateRequested())); + connect(this->md(), SIGNAL(updateDecorators(int)),this,SLOT(updatePerMeshDecorators(int))); connect(this, SIGNAL(updateLayerTable()), this->mw(), SIGNAL(updateLayerTable())); connect(md(),SIGNAL(meshRemoved(int)),this,SLOT(meshRemoved(int))); @@ -579,6 +580,13 @@ void GLArea::paintEvent(QPaintEvent* /*event*/) if(trackBallVisible && !takeSnapTile && !(iEdit && !suspendedEditor)) trackball.DrawPostApply(); + + foreach(QAction * p, iPerDocDecoratorlist) + { + MeshDecorateInterface * decorInterface = qobject_cast(p->parent()); + decorInterface->decorateDoc(p, *this->md(), this->glas.currentGlobalParamSet, this, &painter, md()->Log); + } + // The picking of the surface position has to be done in object space, // so after trackball transformation (and before the matrix associated to each mesh); if(hasToPick && hasToGetPickPos) @@ -600,11 +608,7 @@ void GLArea::paintEvent(QPaintEvent* /*event*/) hasToGetPickCoords = false; } - foreach(QAction * p , iPerDocDecoratorlist) - { - MeshDecorateInterface * decorInterface = qobject_cast(p->parent()); - decorInterface->decorateDoc(p,*this->md(),this->glas.currentGlobalParamSet, this,&painter,md()->Log); - } + // we want to write scene-space the point picked with double-click in the log // we have to do it now, before leaving this transformation space diff --git a/src/meshlab/glarea.h b/src/meshlab/glarea.h index ef6fc59358..ec8780bb7a 100644 --- a/src/meshlab/glarea.h +++ b/src/meshlab/glarea.h @@ -317,6 +317,12 @@ public slots: defdec.initMeshDecorationData(*mm, dt); } } + + void updatePerMeshDecorators(int mesh_id) + { + update(); + } + void updateAllDecorators(); public: diff --git a/src/meshlab/mainwindow_RunTime.cpp b/src/meshlab/mainwindow_RunTime.cpp index c33c9dae5f..040ffe9d86 100644 --- a/src/meshlab/mainwindow_RunTime.cpp +++ b/src/meshlab/mainwindow_RunTime.cpp @@ -1426,7 +1426,7 @@ from the user defined dialog void MainWindow::executeFilter(QAction *action, RichParameterSet ¶ms, bool isPreview) { - MeshFilterInterface *iFilter = qobject_cast(action->parent()); + MeshFilterInterface *iFilter = qobject_cast(action->parent()); qb->show(); iFilter->setLog(&meshDoc()->Log); @@ -1441,15 +1441,7 @@ void MainWindow::executeFilter(QAction *action, RichParameterSet ¶ms, bool i // (3) save the current filter and its parameters in the history if(!isPreview) - { - if (meshDoc()->filterHistory != NULL) - { - OldFilterNameParameterValuesPair* oldpair = new OldFilterNameParameterValuesPair(); - oldpair->pair = qMakePair(action->text(),params); - meshDoc()->filterHistory->filtparlist.append(oldpair); - } meshDoc()->Log.ClearBookmark(); - } else meshDoc()->Log.BackToBookmark(); // (4) Apply the Filter diff --git a/src/meshlab/ml_std_par_dialog.cpp b/src/meshlab/ml_std_par_dialog.cpp index 9799d5902a..915fc50927 100644 --- a/src/meshlab/ml_std_par_dialog.cpp +++ b/src/meshlab/ml_std_par_dialog.cpp @@ -196,6 +196,13 @@ void MeshlabStdDialog::applyClick() //PreView Caching: if the apply parameters are the same to those used in the preview mode //we don't need to reapply the filter to the mesh + if ((q != nullptr) && (curMeshDoc != nullptr) && (curMeshDoc->filterHistory != nullptr)) + { + OldFilterNameParameterValuesPair* oldpair = new OldFilterNameParameterValuesPair(); + oldpair->pair = qMakePair(q->text(), curParSet); + curMeshDoc->filterHistory->filtparlist.append(oldpair); + } + bool isEqual = (curParSet == prevParSet); if (curModel && (isEqual) && (validcache)) { diff --git a/src/meshlab/stdpardialog.cpp b/src/meshlab/stdpardialog.cpp index 5ea208f3d6..e34c1a7604 100644 --- a/src/meshlab/stdpardialog.cpp +++ b/src/meshlab/stdpardialog.cpp @@ -203,7 +203,7 @@ void AbsPercWidget::on_percSB_valueChanged(double newv) void AbsPercWidget::setValue(float val, float minV, float maxV) { assert(absSB); - absSB->setValue (val); + absSB->setValue(val); m_min=minV; m_max=maxV; } diff --git a/src/meshlab/xmlstdpardialog.cpp b/src/meshlab/xmlstdpardialog.cpp index 760c944b59..4aa24ae46d 100644 --- a/src/meshlab/xmlstdpardialog.cpp +++ b/src/meshlab/xmlstdpardialog.cpp @@ -5,6 +5,16 @@ #include #include "mainwindow.h" +static void updateRenderingData(GLArea* glarea, MeshModel* curmodel) +{ + MLSceneGLSharedDataContext* shar = glarea->getSceneGLSharedContext(); + if (shar != NULL) + { + shar->meshAttributesUpdated(curmodel->id(), true, MLRenderingData::RendAtts(true)); + shar->manageBuffers(curmodel->id()); + } +} + MeshLabXMLStdDialog::MeshLabXMLStdDialog(QWidget *p) :QDockWidget(QString("Plugin"), p),isfilterexecuting(false),env(),showHelp(false),previewCB(NULL) { @@ -286,6 +296,7 @@ void MeshLabXMLStdDialog::togglePreview() else { meshState.apply(curModel); + updateRenderingData(glarea, curModel); if (glarea != NULL) glarea->updateAllDecorators(); } @@ -945,13 +956,17 @@ QString XMLAbsWidget::getWidgetExpression() void XMLAbsWidget::on_absSB_valueChanged(double newv) { + disconnect(percSB, SIGNAL(valueChanged(double)), this, SLOT(on_percSB_valueChanged(double))); percSB->setValue((100*(newv - m_min))/(m_max - m_min)); + connect(percSB, SIGNAL(valueChanged(double)), this, SLOT(on_percSB_valueChanged(double))); emit dialogParamChanged(); } void XMLAbsWidget::on_percSB_valueChanged(double newv) { + disconnect(absSB, SIGNAL(valueChanged(double)), this, SLOT(on_absSB_valueChanged(double))); absSB->setValue((m_max - m_min)*0.01*newv + m_min); + connect(absSB, SIGNAL(valueChanged(double)), this, SLOT(on_absSB_valueChanged(double))); emit dialogParamChanged(); } diff --git a/src/meshlabplugins/edit_align/align/OccupancyGrid.h b/src/meshlabplugins/edit_align/align/OccupancyGrid.h index af4c42c069..8389449829 100644 --- a/src/meshlabplugins/edit_align/align/OccupancyGrid.h +++ b/src/meshlabplugins/edit_align/align/OccupancyGrid.h @@ -112,7 +112,7 @@ class OccupancyGrid{ - void Clear(); + void Clear() {}; bool Init(int _mn, Box3d bb, int size); void Add(const char *MeshName, Matrix44d &Tr, int id); diff --git a/src/meshlabplugins/filter_meshing/filter_meshing.pro b/src/meshlabplugins/filter_meshing/filter_meshing.pro index ac440e2b73..a1f5c8829f 100644 --- a/src/meshlabplugins/filter_meshing/filter_meshing.pro +++ b/src/meshlabplugins/filter_meshing/filter_meshing.pro @@ -8,3 +8,8 @@ SOURCES += meshfilter.cpp \ TARGET = filter_meshing +win32-msvc2010:QMAKE_CXXFLAGS = /bigobj +win32-msvc2005:QMAKE_CXXFLAGS = /bigobj +win32-msvc2008:QMAKE_CXXFLAGS = /bigobj +win32-msvc2012:QMAKE_CXXFLAGS = /bigobj +win32-msvc2015:QMAKE_CXXFLAGS = /bigobj