From 3f172b9f410bdcaa58d69df7d6f5ff7741536688 Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Fri, 18 Sep 2020 15:17:15 +0200 Subject: [PATCH] decorate_plugin_interface.h and fix last commit --- src/common/common.pro | 1 + src/common/interfaces.h | 117 -------------- .../interfaces/decorate_plugin_interface.h | 153 ++++++++++++++++++ src/common/pluginmanager.cpp | 6 +- src/common/pluginmanager.h | 7 +- src/meshlab/glarea.cpp | 18 +-- src/meshlab/glarea.h | 4 +- src/meshlab/layerDialog.cpp | 4 +- src/meshlab/layerDialog.h | 2 +- src/meshlab/mainwindow_Init.cpp | 4 +- src/meshlab/mainwindow_RunTime.cpp | 2 +- src/meshlab/plugindialog.cpp | 7 +- .../decorate_background/decorate_background.h | 13 +- .../decorate_base/decorate_base.h | 10 +- .../decorate_raster_proj.h | 9 +- .../decorate_shadow/decorate_shader.h | 2 +- .../decorate_shadow/decorate_shadow.h | 10 +- 17 files changed, 208 insertions(+), 161 deletions(-) create mode 100644 src/common/interfaces/decorate_plugin_interface.h diff --git a/src/common/common.pro b/src/common/common.pro index df95dd3fb..c57132938 100644 --- a/src/common/common.pro +++ b/src/common/common.pro @@ -48,6 +48,7 @@ HEADERS += \ filterscript.h \ GLLogStream.h \ interfaces.h \ + interfaces/decorate_plugin_interface.h \ interfaces/filter_plugin_interface.h \ interfaces/io_plugin_interface.h \ interfaces/mainwindow_interface.h \ diff --git a/src/common/interfaces.h b/src/common/interfaces.h index c0d966f00..45a141674 100644 --- a/src/common/interfaces.h +++ b/src/common/interfaces.h @@ -52,121 +52,6 @@ class GLAreaReg; class MeshModel; -/** -MeshDecorateInterface is the base class of all decorators -Decorators are 'read-only' visualization aids that helps to show some data about a document. -Decorators can make some permesh precomputation but the rendering has to be efficient. -Decorators should save the additional data into per-mesh attribute. - - -There are two classes of Decorations -- PerMesh -- PerDocument - -PerMesh Decorators are associated to each mesh/view -Some example of PerDocument Decorations -- backgrounds -- trackball icon -- axis -- shadows -- screen space Ambient occlusion (think it as a generic 'darkner') - -Some example of PerMesh Decorations -- coloring of selected vertex/face -- displaying of normals/curvature directions -- display of specific tagging -*/ - -class MeshDecorateInterface : public PluginInterface -{ -public: - - /** The DecorationClass enum represents the set of keywords that must be used to categorize a filter. - Each filter can belong to one or more filtering class, or-ed together. - */ - enum DecorationClass - { - Generic = 0x00000, /*!< Should be avoided if possible. */ // - PerMesh = 0x00001, /*!< Decoration that are applied on a single mesh */ - PerDocument = 0x00002, /*!< Decoration that are applied on a single mesh */ - PreRendering = 0x00004, /*!< Decoration that are applied before the rendering of the document/mesh */ - PostRendering = 0x00008 /*!< Decoration that are applied after the rendering of the document/mesh */ - }; - - MeshDecorateInterface() : PluginInterface() {} - virtual ~MeshDecorateInterface() {} - /** The very short string (a few words) describing each filtering action - // This string is used also to define the menu entry - */ - virtual QString decorationName(FilterIDType) const = 0; - virtual QString decorationInfo(FilterIDType) const = 0; - - virtual QString decorationName(QAction *a) const { return decorationName(ID(a)); } - virtual QString decorationInfo(QAction *a) const { return decorationInfo(ID(a)); } - - - virtual bool startDecorate(QAction *, MeshDocument &, const RichParameterList *, GLArea *) { return false; } - virtual bool startDecorate(QAction *, MeshModel &, const RichParameterList *, GLArea *) { return false; } - virtual void decorateMesh(QAction *, MeshModel &, const RichParameterList *, GLArea *, QPainter *, GLLogStream &) = 0; - virtual void decorateDoc(QAction *, MeshDocument &, const RichParameterList *, GLArea *, QPainter *, GLLogStream &) = 0; - virtual void endDecorate(QAction *, MeshModel &, const RichParameterList *, GLArea *) {} - virtual void endDecorate(QAction *, MeshDocument &, const RichParameterList *, GLArea *) {} - - /** \brief tests if a decoration is applicable to a mesh. - * used only for PerMesh Decorators. - For instance curvature cannot be shown on a mesh without curvature. - On failure (returning false) the function fills the MissingItems list with strings describing the missing items. - It is invoked only for decoration of \i PerMesh class; - */ - virtual bool isDecorationApplicable(QAction *, const MeshModel&, QString&) const { return true; } - - virtual int getDecorationClass(QAction *) const = 0; - - virtual QList actions() const { return actionList; } - virtual QList types() const { return typeList; } -protected: - QList actionList; - QList typeList; - virtual FilterIDType ID(QAction *a) const - { - QString aa=a->text(); - foreach(FilterIDType tt, types()) - if (a->text() == this->decorationName(tt)) return tt; - aa.replace("&",""); - foreach(FilterIDType tt, types()) - if (aa == this->decorationName(tt)) return tt; - - qDebug("unable to find the id corresponding to action '%s'", qUtf8Printable(a->text())); - assert(0); - return -1; - } - virtual FilterIDType ID(QString name) const - { - QString n = name; - foreach(FilterIDType tt, types()) - if (name == this->decorationName(tt)) return tt; - n.replace("&",""); - foreach(FilterIDType tt, types()) - if (n == this->decorationName(tt)) return tt; - - qDebug("unable to find the id corresponding to action '%s'", qUtf8Printable(name)); - assert(0); - return -1; - } -public: - virtual QAction *action(QString name) const - { - QString n = name; - foreach(QAction *tt, actions()) - if (name == this->decorationName(ID(tt))) return tt; - n.replace("&",""); - foreach(QAction *tt, actions()) - if (n == this->decorationName(ID(tt))) return tt; - - qDebug("unable to find the id corresponding to action '%s'", qUtf8Printable(name)); - return 0; - } -}; /* @@ -254,11 +139,9 @@ public: #define MESHLAB_PLUGIN_IID_EXPORTER(x) Q_PLUGIN_METADATA(IID x) #define MESHLAB_PLUGIN_NAME_EXPORTER(x) -#define MESH_DECORATE_INTERFACE_IID "vcg.meshlab.MeshDecorateInterface/1.0" #define MESH_EDIT_INTERFACE_IID "vcg.meshlab.MeshEditInterface/1.0" #define MESH_EDIT_INTERFACE_FACTORY_IID "vcg.meshlab.MeshEditInterfaceFactory/1.0" -Q_DECLARE_INTERFACE(MeshDecorateInterface, MESH_DECORATE_INTERFACE_IID) Q_DECLARE_INTERFACE(MeshEditInterface, MESH_EDIT_INTERFACE_IID) Q_DECLARE_INTERFACE(MeshEditInterfaceFactory, MESH_EDIT_INTERFACE_FACTORY_IID) diff --git a/src/common/interfaces/decorate_plugin_interface.h b/src/common/interfaces/decorate_plugin_interface.h new file mode 100644 index 000000000..2fdce7237 --- /dev/null +++ b/src/common/interfaces/decorate_plugin_interface.h @@ -0,0 +1,153 @@ +/**************************************************************************** +* MeshLab o o * +* A versatile mesh processing toolbox o o * +* _ O _ * +* Copyright(C) 2005-2020 \/)\/ * +* Visual Computing Lab /\/| * +* ISTI - Italian National Research Council | * +* \ * +* All rights reserved. * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * +* for more details. * +* * +****************************************************************************/ + +#ifndef MESHLAB_DECORATE_PLUGIN_INTERFACE_H +#define MESHLAB_DECORATE_PLUGIN_INTERFACE_H + +#include "plugin_interface.h" + +class GLArea; + +/** +MeshDecorateInterface is the base class of all decorators +Decorators are 'read-only' visualization aids that helps to show some data about a document. +Decorators can make some permesh precomputation but the rendering has to be efficient. +Decorators should save the additional data into per-mesh attribute. + + +There are two classes of Decorations +- PerMesh +- PerDocument + +PerMesh Decorators are associated to each mesh/view +Some example of PerDocument Decorations +- backgrounds +- trackball icon +- axis +- shadows +- screen space Ambient occlusion (think it as a generic 'darkner') + +Some example of PerMesh Decorations +- coloring of selected vertex/face +- displaying of normals/curvature directions +- display of specific tagging +*/ + +class DecoratePluginInterface : public PluginInterface +{ +public: + + /** The DecorationClass enum represents the set of keywords that must be used to categorize a filter. + Each filter can belong to one or more filtering class, or-ed together. + */ + enum DecorationClass + { + Generic = 0x00000, /*!< Should be avoided if possible. */ // + PerMesh = 0x00001, /*!< Decoration that are applied on a single mesh */ + PerDocument = 0x00002, /*!< Decoration that are applied on a single mesh */ + PreRendering = 0x00004, /*!< Decoration that are applied before the rendering of the document/mesh */ + PostRendering = 0x00008 /*!< Decoration that are applied after the rendering of the document/mesh */ + }; + + DecoratePluginInterface() : PluginInterface() {} + virtual ~DecoratePluginInterface() {} + /** The very short string (a few words) describing each filtering action + // This string is used also to define the menu entry + */ + virtual QString decorationName(FilterIDType) const = 0; + virtual QString decorationInfo(FilterIDType) const = 0; + + virtual QString decorationName(QAction *a) const { return decorationName(ID(a)); } + virtual QString decorationInfo(QAction *a) const { return decorationInfo(ID(a)); } + + + virtual bool startDecorate(QAction *, MeshDocument &, const RichParameterList *, GLArea *) { return false; } + virtual bool startDecorate(QAction *, MeshModel &, const RichParameterList *, GLArea *) { return false; } + virtual void decorateMesh(QAction *, MeshModel &, const RichParameterList *, GLArea *, QPainter *, GLLogStream &) = 0; + virtual void decorateDoc(QAction *, MeshDocument &, const RichParameterList *, GLArea *, QPainter *, GLLogStream &) = 0; + virtual void endDecorate(QAction *, MeshModel &, const RichParameterList *, GLArea *) {} + virtual void endDecorate(QAction *, MeshDocument &, const RichParameterList *, GLArea *) {} + + /** \brief tests if a decoration is applicable to a mesh. + * used only for PerMesh Decorators. + For instance curvature cannot be shown on a mesh without curvature. + On failure (returning false) the function fills the MissingItems list with strings describing the missing items. + It is invoked only for decoration of \i PerMesh class; + */ + virtual bool isDecorationApplicable(QAction *, const MeshModel&, QString&) const { return true; } + + virtual int getDecorationClass(QAction *) const = 0; + + virtual QList actions() const { return actionList; } + virtual QList types() const { return typeList; } +protected: + QList actionList; + QList typeList; + virtual FilterIDType ID(QAction *a) const + { + QString aa=a->text(); + foreach(FilterIDType tt, types()) + if (a->text() == this->decorationName(tt)) return tt; + aa.replace("&",""); + foreach(FilterIDType tt, types()) + if (aa == this->decorationName(tt)) return tt; + + qDebug("unable to find the id corresponding to action '%s'", qUtf8Printable(a->text())); + assert(0); + return -1; + } + virtual FilterIDType ID(QString name) const + { + QString n = name; + foreach(FilterIDType tt, types()) + if (name == this->decorationName(tt)) return tt; + n.replace("&",""); + foreach(FilterIDType tt, types()) + if (n == this->decorationName(tt)) return tt; + + qDebug("unable to find the id corresponding to action '%s'", qUtf8Printable(name)); + assert(0); + return -1; + } +public: + virtual QAction *action(QString name) const + { + QString n = name; + foreach(QAction *tt, actions()) + if (name == this->decorationName(ID(tt))) return tt; + n.replace("&",""); + foreach(QAction *tt, actions()) + if (n == this->decorationName(ID(tt))) return tt; + + qDebug("unable to find the id corresponding to action '%s'", qUtf8Printable(name)); + return 0; + } +}; + +#define MESHLAB_PLUGIN_IID_EXPORTER(x) Q_PLUGIN_METADATA(IID x) +#define MESHLAB_PLUGIN_NAME_EXPORTER(x) + +#define DECORATE_PLUGIN_INTERFACE_IID "vcg.meshlab.MeshDecorateInterface/1.0" +Q_DECLARE_INTERFACE(DecoratePluginInterface, DECORATE_PLUGIN_INTERFACE_IID) + +#endif // MESHLAB_DECORATE_PLUGIN_INTERFACE_H diff --git a/src/common/pluginmanager.cpp b/src/common/pluginmanager.cpp index b86ee7aa1..6542fd026 100644 --- a/src/common/pluginmanager.cpp +++ b/src/common/pluginmanager.cpp @@ -115,7 +115,7 @@ void PluginManager::loadPlugins(RichParameterList& defaultGlobal, const QDir& pl iIO->initGlobalParameterSet(NULL, defaultGlobal); } - MeshDecorateInterface *iDecorator = qobject_cast(plugin); + DecoratePluginInterface *iDecorator = qobject_cast(plugin); if (iDecorator) { iCommon = iDecorator; @@ -160,9 +160,9 @@ int PluginManager::numberIOPlugins() const } // Search among all the decorator plugins the one that contains a decoration with the given name -MeshDecorateInterface *PluginManager::getDecoratorInterfaceByName(const QString& name) +DecoratePluginInterface *PluginManager::getDecoratorInterfaceByName(const QString& name) { - foreach(MeshDecorateInterface *tt, this->meshDecoratePlugins()) + foreach(DecoratePluginInterface *tt, this->meshDecoratePlugins()) { foreach( QAction *ac, tt->actions()) if( name == tt->decorationName(ac) ) return tt; diff --git a/src/common/pluginmanager.h b/src/common/pluginmanager.h index c8bf2b986..be6ede877 100644 --- a/src/common/pluginmanager.h +++ b/src/common/pluginmanager.h @@ -28,6 +28,7 @@ #include "interfaces/filter_plugin_interface.h" #include "interfaces/io_plugin_interface.h" #include "interfaces/render_plugin_interface.h" +#include "interfaces/decorate_plugin_interface.h" //#include "scriptsyntax.h" #include @@ -49,7 +50,7 @@ public: int numberIOPlugins() const; inline QVector& meshFilterPlugins() {return meshFilterPlug;} inline QVector& meshRenderPlugins() {return meshRenderPlug;} - inline QVector& meshDecoratePlugins() {return meshDecoratePlug;} + inline QVector& meshDecoratePlugins() {return meshDecoratePlug;} inline QVector& meshEditFactoryPlugins() {return meshEditInterfacePlug;} static QString getDefaultPluginDirPath(); @@ -57,7 +58,7 @@ public: QMap generateFilterParameterMap(); - MeshDecorateInterface* getDecoratorInterfaceByName(const QString& name); + DecoratePluginInterface* getDecoratorInterfaceByName(const QString& name); QMap actionFilterMap; @@ -70,7 +71,7 @@ public: QVector meshIOPlug; QVector meshFilterPlug; QVector meshRenderPlug; - QVector meshDecoratePlug; + QVector meshDecoratePlug; QVector meshEditInterfacePlug; QVector editActionList; QVector decoratorActionList; diff --git a/src/meshlab/glarea.cpp b/src/meshlab/glarea.cpp index 2d3e3f480..7da4c7a85 100644 --- a/src/meshlab/glarea.cpp +++ b/src/meshlab/glarea.cpp @@ -484,7 +484,7 @@ void GLArea::paintEvent(QPaintEvent* /*event*/) QList& tmpset = iPerMeshDecoratorsListMap[mp->id()]; for( QList::iterator it = tmpset.begin(); it != tmpset.end();++it) { - MeshDecorateInterface * decorInterface = qobject_cast((*it)->parent()); + DecoratePluginInterface * decorInterface = qobject_cast((*it)->parent()); decorInterface->decorateMesh(*it,*mp,this->glas.currentGlobalParamSet,this,&painter,md()->Log); } MLRenderingData meshdt; @@ -546,7 +546,7 @@ void GLArea::paintEvent(QPaintEvent* /*event*/) QList& tmpset = iPerMeshDecoratorsListMap[mp->id()]; for (QList::iterator it = tmpset.begin(); it != tmpset.end(); ++it) { - MeshDecorateInterface * decorInterface = qobject_cast((*it)->parent()); + DecoratePluginInterface * decorInterface = qobject_cast((*it)->parent()); decorInterface->decorateMesh(*it, *mp, this->glas.currentGlobalParamSet, this, &painter, md()->Log); } } @@ -567,7 +567,7 @@ void GLArea::paintEvent(QPaintEvent* /*event*/) foreach(QAction * p, iPerDocDecoratorlist) { - MeshDecorateInterface * decorInterface = qobject_cast(p->parent()); + DecoratePluginInterface * decorInterface = qobject_cast(p->parent()); decorInterface->decorateDoc(p, *this->md(), this->glas.currentGlobalParamSet, this, &painter, md()->Log); } @@ -1065,7 +1065,7 @@ void GLArea::updateAllDecorators() return; foreach(QAction * p, iPerDocDecoratorlist) { - MeshDecorateInterface * decorInterface = qobject_cast(p->parent()); + DecoratePluginInterface * decorInterface = qobject_cast(p->parent()); decorInterface->endDecorate(p, *md(), this->glas.currentGlobalParamSet, this); decorInterface->setLog(&md()->Log); decorInterface->startDecorate(p, *md(), this->glas.currentGlobalParamSet, this); @@ -1151,7 +1151,7 @@ bool GLArea::readyToClose() // Now manage the closing of the decorator set; foreach(QAction* act, iPerDocDecoratorlist) { - MeshDecorateInterface* mdec = qobject_cast(act->parent()); + DecoratePluginInterface* mdec = qobject_cast(act->parent()); mdec->endDecorate(act,*md(),glas.currentGlobalParamSet,this); mdec->setLog(NULL); } @@ -1165,7 +1165,7 @@ bool GLArea::readyToClose() for(QSet::iterator it = dectobeclose.begin();it != dectobeclose.end();++it) { - MeshDecorateInterface* mdec = qobject_cast((*it)->parent()); + DecoratePluginInterface* mdec = qobject_cast((*it)->parent()); if (mdec != NULL) { mdec->endDecorate(*it,*md(),glas.currentGlobalParamSet,this); @@ -1402,7 +1402,7 @@ void GLArea::toggleDecorator(QString name) void GLArea::updateDecorator(QString name, bool toggle, bool stateToSet) { makeCurrent(); - MeshDecorateInterface *iDecorateTemp = this->mw()->PM.getDecoratorInterfaceByName(name); + DecoratePluginInterface *iDecorateTemp = this->mw()->PM.getDecoratorInterfaceByName(name); if (!iDecorateTemp) { this->Logf(GLLogStream::SYSTEM,"Could not get Decorate interface %s", qUtf8Printable(name)); this->Log(GLLogStream::SYSTEM,"Known decorate interfaces:"); @@ -1415,7 +1415,7 @@ void GLArea::updateDecorator(QString name, bool toggle, bool stateToSet) } QAction *action = iDecorateTemp->action(name); - if(iDecorateTemp->getDecorationClass(action)== MeshDecorateInterface::PerDocument) + if(iDecorateTemp->getDecorationClass(action)== DecoratePluginInterface::PerDocument) { bool found=this->iPerDocDecoratorlist.removeOne(action); if(found) @@ -1441,7 +1441,7 @@ void GLArea::updateDecorator(QString name, bool toggle, bool stateToSet) } } - if(iDecorateTemp->getDecorationClass(action)== MeshDecorateInterface::PerMesh) + if(iDecorateTemp->getDecorationClass(action)== DecoratePluginInterface::PerMesh) { MeshModel ¤tMeshModel = *mm(); bool found=this->iCurPerMeshDecoratorList().removeOne(action); diff --git a/src/meshlab/glarea.h b/src/meshlab/glarea.h index 9fe65b34e..ff89fa454 100644 --- a/src/meshlab/glarea.h +++ b/src/meshlab/glarea.h @@ -37,6 +37,8 @@ #include #include +#include +#include #include #include "glarea_setting.h" #include "snapshotsetting.h" @@ -308,7 +310,7 @@ public slots: MeshModel *m = md()->getMesh(i.key()); foreach(QAction *p, i.value()) { - MeshDecorateInterface * decorInterface = qobject_cast(p->parent()); + DecoratePluginInterface * decorInterface = qobject_cast(p->parent()); decorInterface->endDecorate(p, *m, this->glas.currentGlobalParamSet, this); decorInterface->setLog(&md()->Log); decorInterface->startDecorate(p, *m, this->glas.currentGlobalParamSet, this); diff --git a/src/meshlab/layerDialog.cpp b/src/meshlab/layerDialog.cpp index 601b6e341..b58914d2d 100644 --- a/src/meshlab/layerDialog.cpp +++ b/src/meshlab/layerDialog.cpp @@ -893,7 +893,7 @@ void LayerDialog::updateDecoratorParsView() ui->decParsTree->clear(); for(int ii = 0; ii < decList.size();++ii) { - MeshDecorateInterface* decPlug = qobject_cast(decList[ii]->parent()); + DecoratePluginInterface* decPlug = qobject_cast(decList[ii]->parent()); if (!decPlug) { mw->GLA()->Log(GLLogStream::SYSTEM,"MeshLab System Error: A Decorator Plugin has been expected."); @@ -1219,7 +1219,7 @@ void RasterTreeWidgetItem::updateVisibilityIcon( bool isvisible ) DecoratorParamsTreeWidget::DecoratorParamsTreeWidget(QAction* act,MainWindow *mw,QWidget* parent) : QFrame(parent),mainWin(mw),frame(NULL),savebut(NULL),resetbut(NULL),loadbut(NULL),dialoglayout(NULL) { - MeshDecorateInterface* decPlug = qobject_cast(act->parent()); + DecoratePluginInterface* decPlug = qobject_cast(act->parent()); if (!decPlug) { mw->GLA()->Log(GLLogStream::SYSTEM, "MeshLab System Error: A Decorator Plugin has been expected."); } diff --git a/src/meshlab/layerDialog.h b/src/meshlab/layerDialog.h index 113fef919..9ac248504 100644 --- a/src/meshlab/layerDialog.h +++ b/src/meshlab/layerDialog.h @@ -42,7 +42,7 @@ class GLLogStream; class MeshModel; class RasterModel; class MeshDocument; -class MeshDecorateInterface; +class DecoratePluginInterface; class RichParameterListFrame; class QGridLayout; class QToolBar; diff --git a/src/meshlab/mainwindow_Init.cpp b/src/meshlab/mainwindow_Init.cpp index ec1db42be..33c5e50bf 100644 --- a/src/meshlab/mainwindow_Init.cpp +++ b/src/meshlab/mainwindow_Init.cpp @@ -473,7 +473,7 @@ void MainWindow::createToolBars() decoratorToolBar = addToolBar("Decorator"); - foreach(MeshDecorateInterface *iDecorate, PM.meshDecoratePlugins()) + foreach(DecoratePluginInterface *iDecorate, PM.meshDecoratePlugins()) { foreach(QAction *decorateAction, iDecorate->actions()) { @@ -818,7 +818,7 @@ void MainWindow::fillFilterMenu() void MainWindow::fillDecorateMenu() { - foreach(MeshDecorateInterface *iDecorate, PM.meshDecoratePlugins()) + foreach(DecoratePluginInterface *iDecorate, PM.meshDecoratePlugins()) { foreach(QAction *decorateAction, iDecorate->actions()) { diff --git a/src/meshlab/mainwindow_RunTime.cpp b/src/meshlab/mainwindow_RunTime.cpp index 0eaf98250..c0f22c02d 100644 --- a/src/meshlab/mainwindow_RunTime.cpp +++ b/src/meshlab/mainwindow_RunTime.cpp @@ -1444,7 +1444,7 @@ void MainWindow::applyDecorateMode() if(GLA()->mm() == 0) return; QAction *action = qobject_cast(sender()); // find the action which has sent the signal - MeshDecorateInterface *iDecorateTemp = qobject_cast(action->parent()); + DecoratePluginInterface *iDecorateTemp = qobject_cast(action->parent()); GLA()->toggleDecorator(iDecorateTemp->decorationName(action)); diff --git a/src/meshlab/plugindialog.cpp b/src/meshlab/plugindialog.cpp index 02c608a94..68c15e9f4 100644 --- a/src/meshlab/plugindialog.cpp +++ b/src/meshlab/plugindialog.cpp @@ -25,6 +25,9 @@ #include #include #include +#include +#include + #include #include @@ -133,7 +136,7 @@ void PluginDialog::populateTreeWidget(const QString &path,const QStringList &fil } addItems(pluginItem,Templist); } - MeshDecorateInterface *iDecorate = qobject_cast(plugin); + DecoratePluginInterface *iDecorate = qobject_cast(plugin); if (iDecorate){ QStringList Templist; foreach(QAction *a,iDecorate->actions()){Templist.push_back(a->text());} @@ -199,7 +202,7 @@ void PluginDialog::displayInfo(QTreeWidgetItem* item,int /* ncolumn*/) if (actionName==formats) labelInfo->setText(f.description); } } - MeshDecorateInterface *iDecorate = qobject_cast(plugin); + DecoratePluginInterface *iDecorate = qobject_cast(plugin); if (iDecorate) { foreach(QAction *a,iDecorate->actions()) diff --git a/src/meshlabplugins/decorate_background/decorate_background.h b/src/meshlabplugins/decorate_background/decorate_background.h index b5b3efe9b..8d1e6cd63 100644 --- a/src/meshlabplugins/decorate_background/decorate_background.h +++ b/src/meshlabplugins/decorate_background/decorate_background.h @@ -34,14 +34,15 @@ New small samples #include #include -#include +#include +#include #include "cubemap.h" -class DecorateBackgroundPlugin : public QObject, public MeshDecorateInterface +class DecorateBackgroundPlugin : public QObject, public DecoratePluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_DECORATE_INTERFACE_IID) - Q_INTERFACES(MeshDecorateInterface) + MESHLAB_PLUGIN_IID_EXPORTER(DECORATE_PLUGIN_INTERFACE_IID) + Q_INTERFACES(DecoratePluginInterface) QString decorationName(FilterIDType id) const; QString decorationInfo(FilterIDType id) const; QString pluginName() const; @@ -72,7 +73,7 @@ DecorateBackgroundPlugin() /*<< DP_SHOW_CUBEMAPPED_ENV*/ << DP_SHOW_GRID; - foreach(FilterIDType tt , types()){ + for(FilterIDType tt : types()){ actionList << new QAction(decorationName(tt), this); if(tt==DP_SHOW_GRID) actionList.last()->setIcon(QIcon(":/images/show_background_grid.png")); @@ -88,7 +89,7 @@ DecorateBackgroundPlugin() void decorateDoc(QAction *a, MeshDocument &md, const RichParameterList *, GLArea *gla, QPainter *, GLLogStream &_log); void decorateMesh(QAction *, MeshModel &, const RichParameterList *, GLArea *, QPainter *, GLLogStream &){} void initGlobalParameterSet(QAction *, RichParameterList &/*globalparam*/); - int getDecorationClass(QAction * /*action*/) const { return MeshDecorateInterface::PerDocument; } + int getDecorationClass(QAction * /*action*/) const { return DecoratePluginInterface::PerDocument; } private: diff --git a/src/meshlabplugins/decorate_base/decorate_base.h b/src/meshlabplugins/decorate_base/decorate_base.h index 767c34852..8f554d1a2 100644 --- a/src/meshlabplugins/decorate_base/decorate_base.h +++ b/src/meshlabplugins/decorate_base/decorate_base.h @@ -24,7 +24,9 @@ #ifndef EXTRADECORATEPLUGIN_H #define EXTRADECORATEPLUGIN_H -#include +#include +#include + #include #include "colorhistogram.h" @@ -33,11 +35,11 @@ typedef vcg::ColorHistogram CHist; typedef std::pair PointPC; // this type is used to have a simple coord+color pair to rapidly draw non manifold faces -class DecorateBasePlugin : public QObject, public MeshDecorateInterface +class DecorateBasePlugin : public QObject, public DecoratePluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_DECORATE_INTERFACE_IID) - Q_INTERFACES(MeshDecorateInterface) + MESHLAB_PLUGIN_IID_EXPORTER(DECORATE_PLUGIN_INTERFACE_IID) + Q_INTERFACES(DecoratePluginInterface) QString decorationName(FilterIDType filter) const; QString decorationInfo(FilterIDType filter) const; QString pluginName() const; diff --git a/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.h b/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.h index fea51fd2a..3f13a9c46 100644 --- a/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.h +++ b/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.h @@ -27,18 +27,19 @@ #include -#include +#include #include +#include #include -class DecorateRasterProjPlugin : public QObject, public MeshDecorateInterface +class DecorateRasterProjPlugin : public QObject, public DecoratePluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_DECORATE_INTERFACE_IID) - Q_INTERFACES( MeshDecorateInterface ) + MESHLAB_PLUGIN_IID_EXPORTER(DECORATE_PLUGIN_INTERFACE_IID) + Q_INTERFACES( DecoratePluginInterface ) // Types. diff --git a/src/meshlabplugins/decorate_shadow/decorate_shader.h b/src/meshlabplugins/decorate_shadow/decorate_shader.h index e6e123f60..0332f3bbc 100644 --- a/src/meshlabplugins/decorate_shadow/decorate_shader.h +++ b/src/meshlabplugins/decorate_shadow/decorate_shader.h @@ -28,7 +28,7 @@ #include //#include -#include +#include //#include diff --git a/src/meshlabplugins/decorate_shadow/decorate_shadow.h b/src/meshlabplugins/decorate_shadow/decorate_shadow.h index a531bd7c2..2505f5d12 100644 --- a/src/meshlabplugins/decorate_shadow/decorate_shadow.h +++ b/src/meshlabplugins/decorate_shadow/decorate_shadow.h @@ -24,7 +24,7 @@ #define SAMPLE_DECORATE_PLUGIN_H #include -#include +#include #include "decorate_shader.h" #include "shadow_mapping.h" @@ -32,11 +32,11 @@ #include "variance_shadow_mapping_blur.h" #include "ssao.h" -class DecorateShadowPlugin : public QObject, public MeshDecorateInterface +class DecorateShadowPlugin : public QObject, public DecoratePluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_DECORATE_INTERFACE_IID) - Q_INTERFACES(MeshDecorateInterface) + MESHLAB_PLUGIN_IID_EXPORTER(DECORATE_PLUGIN_INTERFACE_IID) + Q_INTERFACES(DecoratePluginInterface) enum { DP_SHOW_SHADOW, @@ -93,7 +93,7 @@ public: void decorateDoc(QAction *a, MeshDocument &m, const RichParameterList*, GLArea *gla, QPainter *p, GLLogStream &); void endDecorate(QAction *, MeshDocument &, const RichParameterList *, GLArea *); void initGlobalParameterSet(QAction *, RichParameterList & globalparam); - int getDecorationClass(QAction * /*action*/) const { return MeshDecorateInterface::PerDocument; } + int getDecorationClass(QAction * /*action*/) const { return DecoratePluginInterface::PerDocument; } private: DecorateShader* smShader, *vsmShader, *vsmbShader;