diff --git a/.github/workflows/BuildAndRelease.yml b/.github/workflows/BuildAndRelease.yml index 12331a0e4..b2b367d79 100644 --- a/.github/workflows/BuildAndRelease.yml +++ b/.github/workflows/BuildAndRelease.yml @@ -54,6 +54,7 @@ jobs: uses: jurplel/install-qt-action@v2 with: modules: xmlpatterns + version: '5.15.0' - name: Install dependencies run: | sudo apt-get install -y mesa-common-dev libglu1-mesa-dev libglew-dev libeigen3-dev libgmp-dev @@ -140,6 +141,7 @@ jobs: uses: jurplel/install-qt-action@v2 with: modules: xmlpatterns + version: '5.15.0' - name: Setup env variables id: envs shell: bash @@ -194,8 +196,7 @@ jobs: uses: jurplel/install-qt-action@v2 with: modules: xmlpatterns - version: '5.14.2' - #mirror: 'http://mirrors.ocf.berkeley.edu/qt/' + version: '5.15.0' - name: Build MeshLab run: | .\install\windows\windows_build.ps1 diff --git a/.github/workflows/BuildMacOS.yml b/.github/workflows/BuildMacOS.yml index 6ad59ed4e..776d62348 100644 --- a/.github/workflows/BuildMacOS.yml +++ b/.github/workflows/BuildMacOS.yml @@ -20,6 +20,7 @@ jobs: uses: jurplel/install-qt-action@v2 with: modules: xmlpatterns + version: '5.15.0' - name: Setup env variables id: envs shell: bash diff --git a/.github/workflows/BuildSnap.yml b/.github/workflows/BuildSnap.yml new file mode 100644 index 000000000..70bed4efc --- /dev/null +++ b/.github/workflows/BuildSnap.yml @@ -0,0 +1,35 @@ +name: BuildSnap + +on: + workflow_dispatch + +jobs: + ubuntu_build_snap: + name: Build MeshLab (Ubuntu - Snap) + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Install dependencies + run: | + #needed for some reason... + curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - + sudo apt update + sudo apt-get install -y snapcraft + - name: Setup env variables + id: envs + run: | + echo ::set-output name=date::"$(cat ML_VERSION)" + - name: Build MeshLab Snap + run: | + snapcraft + - name: Rename Snap + run: | + mv ./meshlab*.snap ./MeshLab${{steps.envs.outputs.date}}-linux.snap + - name: Upload Meshlab Snap + uses: actions/upload-artifact@v1 + with: + name: meshlab_linux_snap + path: MeshLab${{steps.envs.outputs.date}}-linux.snap diff --git a/.github/workflows/BuildUbuntu.yml b/.github/workflows/BuildUbuntu.yml index 0143c97ea..f5afa4162 100644 --- a/.github/workflows/BuildUbuntu.yml +++ b/.github/workflows/BuildUbuntu.yml @@ -16,6 +16,7 @@ jobs: uses: jurplel/install-qt-action@v2 with: modules: xmlpatterns + version: '5.15.0' - name: Install dependencies run: | sudo apt-get install -y mesa-common-dev libglu1-mesa-dev libglew-dev libeigen3-dev libgmp-dev @@ -52,36 +53,6 @@ jobs: name: meshlab_linux_appimage path: MeshLab${{steps.envs.outputs.date}}-linux.AppImage - ubuntu_build_snap: - name: Build MeshLab (Ubuntu - Snap) - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Install dependencies - run: | - #needed for some reason... - curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - - sudo apt update - sudo apt-get install -y snapcraft - - name: Setup env variables - id: envs - run: | - echo ::set-output name=date::"$(cat ML_VERSION)" - - name: Build MeshLab Snap - run: | - snapcraft - - name: Rename Snap - run: | - mv ./meshlab*.snap ./MeshLab${{steps.envs.outputs.date}}-linux.snap - - name: Upload Meshlab Snap - uses: actions/upload-artifact@v1 - with: - name: meshlab_linux_snap - path: MeshLab${{steps.envs.outputs.date}}-linux.snap - ubuntu_build_cmake: name: Build MeshLab (Ubuntu - CMake) runs-on: ubuntu-latest diff --git a/.github/workflows/BuildWindows.yml b/.github/workflows/BuildWindows.yml index 0e4b0ee04..d224c69c8 100644 --- a/.github/workflows/BuildWindows.yml +++ b/.github/workflows/BuildWindows.yml @@ -28,7 +28,7 @@ jobs: uses: jurplel/install-qt-action@v2 with: modules: xmlpatterns - version: '5.14.2' + version: '5.15.0' #mirror: 'http://mirrors.ocf.berkeley.edu/qt/' - name: Build MeshLab run: | @@ -71,7 +71,7 @@ jobs: uses: jurplel/install-qt-action@v2 with: modules: xmlpatterns - version: '5.14.2' + version: '5.15.0' #mirror: 'http://mirrors.ocf.berkeley.edu/qt/' - name: Setup env variables id: envs diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 598cc42a9..e55628e25 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -14,10 +14,12 @@ set(SOURCES filter_parameter/rich_parameter.cpp filter_parameter/rich_parameter_list.cpp filter_parameter/value.cpp + interfaces/decorate_plugin_interface.cpp + interfaces/filter_plugin_interface.cpp + interfaces/plugin_interface.cpp GLExtensionsManager.cpp GLLogStream.cpp filterscript.cpp - interfaces.cpp meshlabdocumentbundler.cpp meshlabdocumentxml.cpp meshmodel.cpp @@ -32,10 +34,16 @@ set(HEADERS filter_parameter/rich_parameter.h filter_parameter/rich_parameter_list.h filter_parameter/value.h + interfaces/decorate_plugin_interface.h + interfaces/edit_plugin_interface.h + interfaces/filter_plugin_interface.h + interfaces/io_plugin_interface.h + interfaces/mainwindow_interface.h + interfaces/plugin_interface.h + interfaces/render_plugin_interface.h GLExtensionsManager.h GLLogStream.h filterscript.h - interfaces.h meshlabdocumentbundler.h meshlabdocumentxml.h meshmodel.h diff --git a/src/common/common.pro b/src/common/common.pro index 93c9fcc3f..ee57d0e48 100644 --- a/src/common/common.pro +++ b/src/common/common.pro @@ -47,7 +47,13 @@ HEADERS += \ filter_parameter/rich_parameter.h \ filterscript.h \ GLLogStream.h \ - interfaces.h \ + interfaces/decorate_plugin_interface.h \ + interfaces/edit_plugin_interface.h \ + interfaces/filter_plugin_interface.h \ + interfaces/io_plugin_interface.h \ + interfaces/mainwindow_interface.h \ + interfaces/plugin_interface.h \ + interfaces/render_plugin_interface.h \ ml_mesh_type.h \ meshmodel.h \ pluginmanager.h \ @@ -63,9 +69,11 @@ SOURCES += \ filter_parameter/rich_parameter.cpp \ filter_parameter/rich_parameter_list.cpp \ filter_parameter/value.cpp \ - interfaces.cpp \ filterscript.cpp \ GLLogStream.cpp \ + interfaces/decorate_plugin_interface.cpp \ + interfaces/filter_plugin_interface.cpp \ + interfaces/plugin_interface.cpp \ meshmodel.cpp \ pluginmanager.cpp \ mlapplication.cpp \ diff --git a/src/common/interfaces.cpp b/src/common/interfaces.cpp deleted file mode 100644 index 49282f9ef..000000000 --- a/src/common/interfaces.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "interfaces.h" - -bool MeshFilterInterface::isFilterApplicable(QAction *act, const MeshModel& m, QStringList &MissingItems) const -{ - int preMask = getPreConditions(act); - MissingItems.clear(); - - if (preMask == MeshModel::MM_NONE) // no precondition specified. - return true; - - if (preMask & MeshModel::MM_VERTCOLOR && !m.hasDataMask(MeshModel::MM_VERTCOLOR)) - MissingItems.push_back("Vertex Color"); - - if (preMask & MeshModel::MM_FACECOLOR && !m.hasDataMask(MeshModel::MM_FACECOLOR)) - MissingItems.push_back("Face Color"); - - if (preMask & MeshModel::MM_VERTQUALITY && !m.hasDataMask(MeshModel::MM_VERTQUALITY)) - MissingItems.push_back("Vertex Quality"); - - if (preMask & MeshModel::MM_FACEQUALITY && !m.hasDataMask(MeshModel::MM_FACEQUALITY)) - MissingItems.push_back("Face Quality"); - - if (preMask & MeshModel::MM_WEDGTEXCOORD && !m.hasDataMask(MeshModel::MM_WEDGTEXCOORD)) - MissingItems.push_back("Per Wedge Texture Coords"); - - if (preMask & MeshModel::MM_VERTTEXCOORD && !m.hasDataMask(MeshModel::MM_VERTTEXCOORD)) - MissingItems.push_back("Per Vertex Texture Coords"); - - if (preMask & MeshModel::MM_VERTRADIUS && !m.hasDataMask(MeshModel::MM_VERTRADIUS)) - MissingItems.push_back("Vertex Radius"); - - if (preMask & MeshModel::MM_CAMERA && !m.hasDataMask(MeshModel::MM_CAMERA)) - MissingItems.push_back("Camera"); - - if (preMask & MeshModel::MM_FACENUMBER && (m.cm.fn==0)) - MissingItems.push_back("Any Faces"); - - - return MissingItems.isEmpty(); -} - -int MeshFilterInterface::previewOnCreatedAttributes(QAction* act,const MeshModel& mm ) -{ - int changedIfCalled = postCondition(act); - int createdIfCalled = MeshModel::MM_NONE; - if ((changedIfCalled & MeshModel::MM_VERTCOLOR) && !mm.hasDataMask(MeshModel::MM_VERTCOLOR)) - createdIfCalled = createdIfCalled | MeshModel::MM_VERTCOLOR; - - if ((changedIfCalled & MeshModel::MM_FACECOLOR) && !mm.hasDataMask(MeshModel::MM_FACECOLOR)) - createdIfCalled = createdIfCalled | MeshModel::MM_FACECOLOR; - - if ((changedIfCalled & MeshModel::MM_VERTQUALITY) && !mm.hasDataMask(MeshModel::MM_VERTQUALITY)) - createdIfCalled = createdIfCalled | MeshModel::MM_VERTQUALITY; - - if ((changedIfCalled & MeshModel::MM_FACEQUALITY) && !mm.hasDataMask(MeshModel::MM_FACEQUALITY)) - createdIfCalled = createdIfCalled | MeshModel::MM_FACEQUALITY; - - if ((changedIfCalled & MeshModel::MM_WEDGTEXCOORD) && !mm.hasDataMask(MeshModel::MM_WEDGTEXCOORD)) - createdIfCalled = createdIfCalled | MeshModel::MM_WEDGTEXCOORD; - - if ((changedIfCalled & MeshModel::MM_VERTTEXCOORD) && !mm.hasDataMask(MeshModel::MM_VERTTEXCOORD)) - createdIfCalled = createdIfCalled | MeshModel::MM_VERTTEXCOORD; - - if ((changedIfCalled & MeshModel::MM_VERTRADIUS) && !mm.hasDataMask(MeshModel::MM_VERTRADIUS)) - createdIfCalled = createdIfCalled | MeshModel::MM_VERTRADIUS; - - if ((getClass(act) == MeshFilterInterface::MeshCreation) && (mm.cm.vn == 0)) - createdIfCalled = createdIfCalled | MeshModel::MM_VERTCOORD; - - return createdIfCalled; -} diff --git a/src/common/interfaces.h b/src/common/interfaces.h deleted file mode 100644 index e95efdb34..000000000 --- a/src/common/interfaces.h +++ /dev/null @@ -1,728 +0,0 @@ -/**************************************************************************** -* MeshLab o o * -* A versatile mesh processing toolbox o o * -* _ O _ * -* Copyright(C) 2005-2008 \/)\/ * -* 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_INTERFACES_H -#define MESHLAB_INTERFACES_H -//#include - -#include "filter_parameter/rich_parameter_list.h" -#include "GLLogStream.h" -#include "meshmodel.h" - -#include -#include -#include -#include -#include -#include -#include -#include - - -class QWidget; -class QGLWidget; -class QString; -class QVariant; -class QMouseEvent; -class QTreeWidgetItem; -class MeshModel; -class RenderMode; -class GLArea; -class GLAreaReg; - -class MeshModel; - -/** The MainWindowInterface class defines just the executeFilter() callback function -that is invoked by the standard parameter input dialog. -It is used as base class of the MainWindow. -*/ -class MainWindowInterface -{ -public: - virtual void executeFilter(QAction *, RichParameterList &, bool = false) {} - //parexpval is a string map containing the parameter expression values set in the filter's dialog. - //These parameter expression values will be evaluated when the filter will start. -}; - -/** \brief The MeshLabInterface class is the base of all the plugin interfaces. - -The main idea common to all the framework is that each plugin export a set of actions, -internally each action is associated to a FilterIDType, and for each action a name and a formatted INFO is defined. - -For coding easyness ID are more practical (you can use them in switches). -Using action on the other hand is practical because it simplify their management in menus/toolbars and it allows to define icons and other things in a automatic way. -Moreover ID are UNSAFE (different plugin can have same id) so they should be used only INTERNALLY - -\todo There is inconsistency in the usage of ID and actions for retrieving particular filters. Remove. - -*/ -class MeshLabInterface -{ -public: - /** the type used to identify plugin actions; there is a one-to-one relation between an ID and an Action. - \todo To be renamed as ActionIDType - */ - - MeshLabInterface() :log(0) {} - virtual ~MeshLabInterface() {} -private: - GLLogStream *log; -public: - - /// Standard stuff that usually should not be redefined. - void setLog(GLLogStream *log) { this->log = log; } - - // This function must be used to communicate useful information collected in the parsing/saving of the files. - // NEVER EVER use a msgbox to say something to the user. - template - void Log(const char * f, Ts&&... ts ) - { - if(log != nullptr) - { - log->Logf(GLLogStream::FILTER, f, std::forward(ts)...); - } - } - - void Log(const char * s) - { - if(log != nullptr) - { - log->Log(GLLogStream::FILTER, s); - } - } - - void Log(const std::string& s) - { - if(log != nullptr) - { - log->Log(GLLogStream::FILTER, s); - } - } - - template - void Log(GLLogStream::Levels Level, const char * f, Ts&&... ts ) - { - if(log != nullptr) - { - log->Logf(Level, f, std::forward(ts)...); - } - } - - void Log(GLLogStream::Levels level, const char * s) - { - if(log != nullptr) - { - log->Log(level, s); - } - } - - void Log(GLLogStream::Levels level, const std::string& s) - { - if(log != nullptr) - { - log->Log(level, s); - } - } - - void RealTimeLog(QString Id, const QString &meshName, const char * f) - { - if(log != nullptr) - { - log->RealTimeLog(Id, meshName, f); - } - } - - template - void RealTimeLog(QString Id, const QString &meshName, const char * f, Ts&&... ts ) - { - if(log != nullptr) - { - log->RealTimeLogf(Id, meshName, f, std::forward(ts)...); - } - } -}; - -class MeshCommonInterface : public MeshLabInterface -{ -public: - typedef int FilterIDType; - MeshCommonInterface() {} - virtual ~MeshCommonInterface() {} - - virtual QString pluginName(void) const { return ""; } - - /** \brief This function is called by the framework, for each plugin that has global parameters (e.g. \ref MeshDecorateInterface) at the start of the application. - The rationale is to allow to each plugin to have a list of global persistent parameters that can be changed from the meshlab itself and whose value is persistent between different meshlab invocations. - A typical example is the background color. - - For the global parameters the following rules apply: - - \li there is a hardwired default value: a safe consistent value that is directly coded into the plugin and to which the user can always revert if needed. - \li there is a saved value: a value that is stored into a persistent location into the user space (registry/home/library) and it is presented as default value of the parameter at each MeshLab invocation. - \li there is a current value: a value that is currently used, different for each document instance and that is not stored permanently. - - The plugin use the current value to draw its decoration. - at startup the current value is always silently initialized to the saved value. - User can revert current value to the saved values and to the hardwired values. - In the dialog for each parameter some buttons should be present: - - \li apply: use the currently edited parameter value without saving it anywhere. After the closure of the document these values will be lost. - \li load: load from the saved values - \li save: save to a permanent location the current value (to the registry), - \li reset: revert to the hardwired values - - If your plugins/action has no GlobalParameter, do nothing. - The RichParameterSet comes to the StartDecorate already initialized with the values stored on the permanent storage. - At the start up the initGlobalParameterSet function is called with an empty RichParameterSet (to collect the default values) - If a filter wants to save some permanent stuff should set the permanent default values. - */ - virtual void initGlobalParameterSet(QAction * /*format*/, RichParameterList & /*globalparam*/) {} -}; -/** \brief The MeshIOInterface is the base class for all the single mesh loading plugins. -*/ -class MeshIOInterface : public MeshCommonInterface -{ -public: - class Format - { - public: - Format(QString description, QString ex) : description(description) { extensions << ex; } - QString description; - QStringList extensions; - }; - - MeshIOInterface() : MeshCommonInterface() { } - virtual ~MeshIOInterface() {} - - virtual QList importFormats() const = 0; - virtual QList exportFormats() const = 0; - - // This function is called to initialize the list of additional parameters that a OPENING filter could require - // it is called by the framework BEFORE the actual mesh loading to perform to determine how parse the input file - // The instanced parameters are then passed to the open at the loading time. - // Typical example of use to decide what subportion of a mesh you have to load. - // If you do not need any additional processing simply do not override this and ignore the parameterSet in the open - virtual void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, RichParameterList & /*par*/) {} - - // This function is called to initialize the list of additional parameters that a OPENING filter could require - // it is called by the framework AFTER the mesh is already loaded to perform more or less standard processing on the mesh. - // typical example: unifying vertices in stl models. - // If you do not need any additional processing do nothing. - virtual void initOpenParameter(const QString &/*format*/, MeshModel &/*m*/, RichParameterList & /*par*/) {} - - // This is the corresponding function that is called after the mesh is loaded with the initialized parameters - virtual void applyOpenParameter(const QString &/*format*/, MeshModel &/*m*/, const RichParameterList &/*par*/) {} - - // This function is called to initialize the list of additional parameters that a SAVING filter could require - // it is called by the framework after the mesh is loaded to perform more or less standard processing on the mesh. - // typical example: ascii or binary format for ply or stl - // If you do not need any additional parameter simply do nothing. - virtual void initSaveParameter(const QString &/*format*/, MeshModel &/*m*/, RichParameterList & /*par*/) {} - - - virtual void GetExportMaskCapability(const QString &format, int &capability, int &defaultBits) const = 0; - - /// callback used to actually load a mesh from a file - virtual bool open( - const QString &format, /// the extension of the format e.g. "PLY" - const QString &fileName, /// The name of the file to be opened - MeshModel &m, /// The mesh that is filled with the file content - int &mask, /// a bit mask that will be filled reporting what kind of data we have found in the file (per vertex color, texture coords etc) - const RichParameterList & par, /// The parameters that have been set up in the initPreOpenParameter() - vcg::CallBackPos *cb = 0, /// standard callback for reporting progress in the loading - QWidget *parent = 0) = 0; /// you should not use this... - - virtual bool save( - const QString &format, // the extension of the format e.g. "PLY" - const QString &fileName, - MeshModel &m, - const int mask, // a bit mask indicating what kind of the data present in the mesh should be saved (e.g. you could not want to save normals in ply files) - const RichParameterList & par, - vcg::CallBackPos *cb = 0, - QWidget *parent = 0) = 0; - - /// This function is invoked by the framework when the import/export plugin fails to give some info to the user about the failure - /// io plugins should avoid using QMessageBox for reporting errors. - /// Failure should put some meaningful information inside the errorMessage string. - virtual QString &errorMsg() { return this->errorMessage; } - void clearErrorString() { errorMessage.clear(); } - - // this string is used to pass back to the framework error messages in case of failure of a filter apply. - // NEVER EVER use a msgbox to say something to the user. - QString errorMessage; - -}; - -/** -\brief The MeshFilterInterface class provide the interface of the filter plugins. - -*/ -class MeshFilterInterface : public MeshCommonInterface -{ -public: - /** The FilterClass 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 FilterClass - { - Generic = 0x00000, /*!< Should be avoided if possible. */ // - Selection = 0x00001, /*!< select or de-select something, basic operation on selections (like deleting)*/ - Cleaning = 0x00002, /*!< Filters that can be used to clean meshes (duplicated vertices etc)*/ - Remeshing = 0x00004, /*!< Simplification, Refinement, Reconstruction and mesh optimization*/ - FaceColoring = 0x00008, - VertexColoring = 0x00010, - MeshColoring = 0x00020, - MeshCreation = 0x00040, - Smoothing = 0x00080, /*!< Stuff that does not change the topology, but just the vertex positions*/ - Quality = 0x00100, - Layer = 0x00200, /*!< Layers, attributes */ - RasterLayer = 0x00400, /*!< Raster Layers, attributes */ - Normal = 0x00800, /*!< Normal, Curvature, orientation (rotations and transformations fall here)*/ - Sampling = 0x01000, - Texture = 0x02000, - RangeMap = 0x04000, /*!< filters specific for range map processing*/ - PointSet = 0x08000, - Measure = 0x10000, /*!< Filters that compute measures and information on meshes.*/ - Polygonal = 0x20000, /*!< Filters that works on polygonal and quad meshes.*/ - Camera = 0x40000 /*!< Filters that works on shot of mesh and raster.*/ - }; - - - - MeshFilterInterface() : MeshCommonInterface(), glContext(NULL) - { - } - virtual ~MeshFilterInterface() {} - - - /** The very short string (a few words) describing each filtering action - // This string is used also to define the menu entry - */ - virtual QString filterName(FilterIDType) const = 0; - - /** The long, formatted string describing each filtering action. - // This string is printed in the top of the parameter window - // so it should be at least one or two paragraphs long. The more the better. - // you can use simple html formatting tags (like "
" "" and "") to improve readability. - // This string is used in the 'About plugin' dialog and by meshlabserver to create the filter list wiki page and the doxygen documentation of the filters. - // Here is the place where you should put you bibliographic references in a form like this: -
- See:
- Luiz Velho, Denis Zorin
- "4-8 Subdivision"
- CAGD, volume 18, Issue 5, Pages 397-427.
-
- e.g. italic for authors, bold for title (quoted) and plain for bib ref. - */ - virtual QString filterInfo(FilterIDType filter) const = 0; - - /** The FilterClass describes in which generic class of filters it fits. - // This choice affect the submenu in which each filter will be placed - // For example filters that perform an action only on the selection will be placed in the Selection Class - */ - virtual FilterClass getClass(QAction *) { return MeshFilterInterface::Generic; } - - /** - The filters can have some additional requirements on the mesh capabiliteis. - // For example if a filters requires Face-Face Adjacency you should re-implement - // this function making it returns MeshModel::MM_FACEFACETOPO. - // The framework will ensure that the mesh has the requirements satisfied before invoking the applyFilter function - // - // Furthermore, requirements are checked just before the invocation of a filter. If your filter - // outputs a never used before mesh property (e.g. face colors), it will be allocated by a call - // to MeshModel::updateDataMask(...) - */ - virtual int getRequirements(QAction *) { return MeshModel::MM_NONE; } - - /** The FilterPrecondition mask is used to explicitate what kind of data a filter really needs to be applied. - // For example algorithms that compute per face quality have as precondition the existence of faces - // (but quality per face is not a precondition, because quality per face is created by these algorithms) - // on the other hand an algorithm that deletes faces according to the stored quality has both FaceQuality - // and Face as precondition. - // These conditions do NOT include computed properties like borderFlags, manifoldness or watertightness. - // They are also used to grayout menus un-appliable entries. - */ - virtual int getPreConditions(QAction *) const { return MeshModel::MM_NONE; } - - /** Function used by the framework to get info about the mesh properties changed by the filter. - // It is widely used by the meshlab's preview system. - //TO BE REPLACED WITH = 0 - */ - virtual int postCondition(QAction*) const { return MeshModel::MM_ALL; } - - /** \brief applies the selected filter with the already stabilished parameters - * This function is called by the framework after getting values for the parameters specified in the \ref InitParameterSet - * NO GUI interaction should be done here. No dialog asking, no messagebox errors. - * Think that his function will also be called by the commandline framework. - * If you want report errors, use the \ref errorMsg() string. It will displayed in case of filters returning false. - * When implementing your applyFilter, you should use the cb function to report to the framework the current state of the processing. - * During your (long) processing you should call from time to time cb(perc,descriptiveString), where perc is an int (0..100) - * saying what you are doing and at what point of the computation you currently are. - * \sa errorMsg - * \sa initParameterSet - */ - virtual bool applyFilter(QAction * filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) = 0; - - /** \brief tests if a filter is applicable to a mesh. - This function is a handy wrapper used by the framework for the \a getPreConditions callback; - For instance a colorize by quality filter cannot be applied to a mesh without per-vertex-quality. - On failure (returning false) the function fills the MissingItems list with strings describing the missing items. - */ - bool isFilterApplicable(QAction *act, const MeshModel& m, QStringList &MissingItems) const; - - - enum FILTER_ARITY { NONE = 0, SINGLE_MESH = 1, FIXED = 2, VARIABLE = 3, UNKNOWN_ARITY = 4 }; - - /** \brief this function informs the MeshLab core on how many meshes the filter will work on. - Valid value: - - SINGLE_MESH: the filter works just on the current mesh - - FIXED: the number (and the names) of the meshes involved in the filter computation is determined by the parameters selected in the filter's parameters form - - VARIABLE: the filter works on a not predetermined number of meshes. The meshes involved are typically selected by the user checking on the correspondent layer on the layer dialog - */ - virtual FILTER_ARITY filterArity(QAction *act) const = 0; - - // This function is called to initialized the list of parameters. - // it is always called. If a filter does not need parameter it leave it empty and the framework - // will not create a dialog (unless for previewing) - virtual void initParameterSet(QAction *, MeshModel &/*m*/, RichParameterList & /*par*/) {} - virtual void initParameterSet(QAction *filter, MeshDocument &md, RichParameterList &par) - { - initParameterSet(filter, *(md.mm()), par); - } - - /** \brief is invoked by the framework when the applyFilter fails to give some info to the user about the filter failure - * Filters \b must never use QMessageBox for reporting errors. - * Failing filters should put some meaningful information inside the errorMessage string and return false with the \ref applyFilter - */ - const QString &errorMsg() { return this->errorMessage; } - virtual QString filterInfo(QAction *a) const { return this->filterInfo(ID(a)); } - virtual QString filterName(QAction *a) const { return this->filterName(ID(a)); } - virtual QString filterScriptFunctionName(FilterIDType /*filterID*/) { return ""; } - - virtual FilterIDType ID(QAction *a) const - { - QString aa=a->text(); - foreach(FilterIDType tt, types()) - if (a->text() == this->filterName(tt)) return tt; - aa.replace("&",""); - foreach(FilterIDType tt, types()) - if (aa == this->filterName(tt)) return tt; - - qDebug("unable to find the id corresponding to action '%s'", qUtf8Printable(a->text())); - assert(0); - return -1; - } - - virtual QAction *AC(FilterIDType filterID) - { - QString idName = this->filterName(filterID); - return AC(idName); - } - - virtual QAction *AC(QString idName) - { - QString i=idName; - foreach(QAction *tt, actionList) - if (idName == tt->text()) return tt; - i.replace("&",""); - foreach(QAction *tt, actionList) - if (i == tt->text()) return tt; - - qDebug("unable to find the action corresponding to action '%s'", qUtf8Printable(idName)); - assert(0); - return 0; - } - - virtual QList actions() const { return actionList; } - virtual QList types() const { return typeList; } - - /** Generate the mask of attributes would be created IF the MeshFilterInterface filt would has been called on MeshModel mm - BE CAREFUL! this function does NOT change in anyway the state of the MeshModel!!!! **/ - int previewOnCreatedAttributes(QAction* act, const MeshModel& mm); - QString generatedScriptCode; - - MLPluginGLContext* glContext; -protected: - // Each plugins exposes a set of filtering possibilities. - // Each filtering procedure corresponds to a single QAction with a corresponding FilterIDType id. - // - - // The list of actions exported by the plugin. Each actions strictly corresponds to - QList actionList; - - QList typeList; - - // this string is used to pass back to the framework error messages in case of failure of a filter apply. - QString errorMessage; -}; - - -/** -Used to customized the rendering process. -Rendering plugins are now responsible of the rendering of the whole MeshDocument and not only of a single MeshModel. - -The Render function is called in with the ModelView and Projection Matrices already set up, screen cleared and background drawn. -After the Render call the MeshLab frawework draw on the opengl context other decorations and the trackball, so it there is the -requirement for a rendering plugin is that it should leave the z-buffer in a coherent state. - -The typical rendering loop of a Render plugin is something like, : - - - -foreach(MeshModel * mp, meshDoc.meshList) -{ -if(mp->visible) mp->Render(rm.drawMode,rm.colorMode,rm.textureMode); -} - -*/ - -class MeshRenderInterface : public MeshCommonInterface -{ -public: - MeshRenderInterface() :MeshCommonInterface() {} - virtual ~MeshRenderInterface() {} - - virtual void Init(QAction *, MeshDocument &, MLSceneGLSharedDataContext::PerMeshRenderingDataMap& /*mp*/, GLArea *) {} - virtual void Render(QAction *, MeshDocument &, MLSceneGLSharedDataContext::PerMeshRenderingDataMap& mp, GLArea *) = 0; - virtual void Finalize(QAction *, MeshDocument *, GLArea *) {} - virtual bool isSupported() = 0; - virtual QList actions() = 0; -}; -/** -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 MeshCommonInterface -{ -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() : MeshCommonInterface() {} - 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; - } -}; - - -/* -Editing Interface -Used to provide tools that needs some kind of interaction with the mesh. -Editing tools are exclusive (only one at a time) and can grab the mouse events and customize the rendering process. -*/ - -class MeshEditInterface : public MeshCommonInterface -{ -public: - MeshEditInterface() : MeshCommonInterface() {} - virtual ~MeshEditInterface() {} - - //should return a sentence describing what the editing tool does - static const QString Info(); - - virtual void suggestedRenderingData(MeshModel &/*m*/, MLRenderingData& /*dt*/) {} - - // Called when the user press the first time the button - virtual bool StartEdit(MeshModel &/*m*/, GLArea * /*parent*/, MLSceneGLSharedDataContext* /*cont*/) { return true; } - virtual bool StartEdit(MeshDocument &md, GLArea *parent, MLSceneGLSharedDataContext* cont) - { - //assert(NULL != md.mm()); - if (md.mm() != NULL) - return (StartEdit(*(md.mm()), parent, cont)); - else return false; - } - // Called when the user press the second time the button - virtual void EndEdit(MeshModel &/*m*/, GLArea * /*parent*/, MLSceneGLSharedDataContext* /*cont*/) {} - virtual void EndEdit(MeshDocument &/*m*/, GLArea * /*parent*/, MLSceneGLSharedDataContext* /*cont*/) {} - - // There are two classes of editing tools, the one that works on a single layer at a time - // and the ones that works on all layers and have to manage in a correct way the action of changing the current layer. - // For the edit tools that works ona single layer changing the layer means the restart of the edit tool. - virtual bool isSingleMeshEdit() const { return true; } - - // Called when the user changes the selected layer - //by default it calls end edit with the layer that was selected and start with the new layer that is - //selected. This ensures that plugins who don't support layers do not get sent pointers to meshes - //they are not expecting. - // If your editing plugins is not singleMesh you MUST reimplement this to correctly handle the change of layer. - virtual void LayerChanged(MeshDocument &md, MeshModel &oldMeshModel, GLArea *parent, MLSceneGLSharedDataContext* cont) - { - assert(this->isSingleMeshEdit()); - EndEdit(oldMeshModel, parent, cont); - StartEdit(md, parent, cont); - } - - virtual void Decorate(MeshModel &m, GLArea *parent, QPainter * /*p*/) { Decorate(m, parent); } - virtual void Decorate(MeshModel &/*m*/, GLArea * /*parent*/) {} - - virtual void mousePressEvent(QMouseEvent *event, MeshModel &/*m*/, GLArea *) = 0; - virtual void mouseMoveEvent(QMouseEvent *event, MeshModel &/*m*/, GLArea *) = 0; - virtual void mouseReleaseEvent(QMouseEvent *event, MeshModel &/*m*/, GLArea *) = 0; - virtual void keyReleaseEvent(QKeyEvent *, MeshModel &/*m*/, GLArea *) {} - virtual void keyPressEvent(QKeyEvent *, MeshModel &/*m*/, GLArea *) {} - virtual void wheelEvent(QWheelEvent*, MeshModel &/*m*/, GLArea *) {} - virtual void tabletEvent(QTabletEvent * e, MeshModel &/*m*/, GLArea *) { e->ignore(); } -}; - - -/** MeshEditInterfaceFactory -\short The MeshEditInterfaceFactory class is a factory is used to generate a object for each starting of an editing filter. - -This is needed because editing filters have a internal state, so if you want to have an editing tool for two different documents you have to instance two objects. -This class is used by the framework to generate an independent MeshEditInterface for each document. -*/ -class MeshEditInterfaceFactory -{ -public: - virtual ~MeshEditInterfaceFactory() {} - - //gets a list of actions available from this plugin - virtual QList actions() const = 0; - - //get the edit tool for the given action - virtual MeshEditInterface* getMeshEditInterface(QAction *) = 0; - - //get the description for the given action - virtual QString getEditToolDescription(QAction *) = 0; - -}; - -#define MESHLAB_PLUGIN_IID_EXPORTER(x) Q_PLUGIN_METADATA(IID x) -#define MESHLAB_PLUGIN_NAME_EXPORTER(x) - -#define MESH_IO_INTERFACE_IID "vcg.meshlab.MeshIOInterface/1.0" -#define MESH_FILTER_INTERFACE_IID "vcg.meshlab.MeshFilterInterface/1.0" -#define MESHLAB_FILTER_INTERFACE_IID "vcg.meshlab.MeshLabFilterInterface/1.0" -#define MESH_RENDER_INTERFACE_IID "vcg.meshlab.MeshRenderInterface/1.0" -#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(MeshIOInterface, MESH_IO_INTERFACE_IID) -Q_DECLARE_INTERFACE(MeshFilterInterface, MESH_FILTER_INTERFACE_IID) -Q_DECLARE_INTERFACE(MeshRenderInterface, MESH_RENDER_INTERFACE_IID) -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) - -#endif diff --git a/src/common/interfaces/decorate_plugin_interface.cpp b/src/common/interfaces/decorate_plugin_interface.cpp new file mode 100644 index 000000000..69b07a0a4 --- /dev/null +++ b/src/common/interfaces/decorate_plugin_interface.cpp @@ -0,0 +1,72 @@ +#include "decorate_plugin_interface.h" + +/** \brief + * This function is called by the framework, for each plugin that has global parameters (e.g. \ref MeshDecorateInterface) at the start of the application. + * The rationale is to allow to each plugin to have a list of global persistent parameters that can be changed from the meshlab itself and whose value is persistent between different meshlab invocations. + * A typical example is the background color. + * + * For the global parameters the following rules apply: + * + * \li there is a hardwired default value: a safe consistent value that is directly coded into the plugin and to which the user can always revert if needed. + * \li there is a saved value: a value that is stored into a persistent location into the user space (registry/home/library) and it is presented as default value of the parameter at each MeshLab invocation. + * \li there is a current value: a value that is currently used, different for each document instance and that is not stored permanently. + * + * The plugin use the current value to draw its decoration. + * at startup the current value is always silently initialized to the saved value. + * User can revert current value to the saved values and to the hardwired values. + * In the dialog for each parameter some buttons should be present: + + * \li apply: use the currently edited parameter value without saving it anywhere. After the closure of the document these values will be lost. + * \li load: load from the saved values + * \li save: save to a permanent location the current value (to the registry), + * \li reset: revert to the hardwired values + + * If your plugins/action has no GlobalParameter, do nothing. + * The RichParameterList comes to the StartDecorate already initialized with the values stored on the permanent storage. + * At the start up the initGlobalParameterList function is called with an empty RichParameterList (to collect the default values) + * If a filter wants to save some permanent stuff should set the permanent default values. + */ +void DecoratePluginInterface::initGlobalParameterList(const QAction* /*format*/, RichParameterList& /*globalparam*/) +{ +} + +QAction* DecoratePluginInterface::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; +} + +PluginInterface::FilterIDType DecoratePluginInterface::ID(const 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; +} + +PluginInterface::FilterIDType DecoratePluginInterface::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; +} diff --git a/src/common/interfaces/decorate_plugin_interface.h b/src/common/interfaces/decorate_plugin_interface.h new file mode 100644 index 000000000..bc99ac34a --- /dev/null +++ b/src/common/interfaces/decorate_plugin_interface.h @@ -0,0 +1,121 @@ +/**************************************************************************** +* 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(const QAction *a) const { return decorationName(ID(a)); } + virtual QString decorationInfo(const QAction *a) const { return decorationInfo(ID(a)); } + + // See source file for documentation + virtual void initGlobalParameterList(const QAction* format, RichParameterList& globalparam); + + virtual bool startDecorate(const QAction *, MeshDocument &, const RichParameterList *, GLArea *) { return false; } + virtual bool startDecorate(const QAction *, MeshModel &, const RichParameterList *, GLArea *) { return false; } + virtual void decorateMesh(const QAction *, MeshModel &, const RichParameterList *, GLArea *, QPainter *, GLLogStream &) = 0; + virtual void decorateDoc(const QAction *, MeshDocument &, const RichParameterList *, GLArea *, QPainter *, GLLogStream &) = 0; + virtual void endDecorate(const QAction *, MeshModel &, const RichParameterList *, GLArea *) {} + virtual void endDecorate(const 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(const QAction *, const MeshModel&, QString&) const { return true; } + + virtual int getDecorationClass(const QAction *) const = 0; + + virtual QList actions() const { return actionList; } + virtual QList types() const { return typeList; } + + virtual QAction *action(QString name) const; + +protected: + QList actionList; + QList typeList; + virtual FilterIDType ID(const QAction *a) const; + virtual FilterIDType ID(QString name) const; +}; + +#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/interfaces/edit_plugin_interface.h b/src/common/interfaces/edit_plugin_interface.h new file mode 100644 index 000000000..37a076da7 --- /dev/null +++ b/src/common/interfaces/edit_plugin_interface.h @@ -0,0 +1,127 @@ +/**************************************************************************** +* 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_EDIT_PLUGIN_INTERFACE_H +#define MESHLAB_EDIT_PLUGIN_INTERFACE_H + +#include + +#include "plugin_interface.h" +#include "../meshmodel.h" + + +class GLArea; + +/* +Editing Interface +Used to provide tools that needs some kind of interaction with the mesh. +Editing tools are exclusive (only one at a time) and can grab the mouse events and customize the rendering process. +*/ + +class EditPluginInterface : public PluginInterface +{ +public: + EditPluginInterface() : PluginInterface() {} + virtual ~EditPluginInterface() {} + + //should return a sentence describing what the editing tool does + static const QString Info(); + + virtual void suggestedRenderingData(MeshModel &/*m*/, MLRenderingData& /*dt*/) {} + + // Called when the user press the first time the button + virtual bool StartEdit(MeshModel &/*m*/, GLArea * /*parent*/, MLSceneGLSharedDataContext* /*cont*/) { return true; } + virtual bool StartEdit(MeshDocument &md, GLArea *parent, MLSceneGLSharedDataContext* cont) + { + //assert(NULL != md.mm()); + if (md.mm() != NULL) + return (StartEdit(*(md.mm()), parent, cont)); + else return false; + } + // Called when the user press the second time the button + virtual void EndEdit(MeshModel &/*m*/, GLArea * /*parent*/, MLSceneGLSharedDataContext* /*cont*/) {} + virtual void EndEdit(MeshDocument &/*m*/, GLArea * /*parent*/, MLSceneGLSharedDataContext* /*cont*/) {} + + // There are two classes of editing tools, the one that works on a single layer at a time + // and the ones that works on all layers and have to manage in a correct way the action of changing the current layer. + // For the edit tools that works ona single layer changing the layer means the restart of the edit tool. + virtual bool isSingleMeshEdit() const { return true; } + + // Called when the user changes the selected layer + //by default it calls end edit with the layer that was selected and start with the new layer that is + //selected. This ensures that plugins who don't support layers do not get sent pointers to meshes + //they are not expecting. + // If your editing plugins is not singleMesh you MUST reimplement this to correctly handle the change of layer. + virtual void LayerChanged(MeshDocument &md, MeshModel &oldMeshModel, GLArea *parent, MLSceneGLSharedDataContext* cont) + { + assert(this->isSingleMeshEdit()); + EndEdit(oldMeshModel, parent, cont); + StartEdit(md, parent, cont); + } + + virtual void Decorate(MeshModel &m, GLArea *parent, QPainter * /*p*/) { Decorate(m, parent); } + virtual void Decorate(MeshModel &/*m*/, GLArea * /*parent*/) {} + + virtual void mousePressEvent(QMouseEvent *event, MeshModel &/*m*/, GLArea *) = 0; + virtual void mouseMoveEvent(QMouseEvent *event, MeshModel &/*m*/, GLArea *) = 0; + virtual void mouseReleaseEvent(QMouseEvent *event, MeshModel &/*m*/, GLArea *) = 0; + virtual void keyReleaseEvent(QKeyEvent *, MeshModel &/*m*/, GLArea *) {} + virtual void keyPressEvent(QKeyEvent *, MeshModel &/*m*/, GLArea *) {} + virtual void wheelEvent(QWheelEvent*, MeshModel &/*m*/, GLArea *) {} + virtual void tabletEvent(QTabletEvent * e, MeshModel &/*m*/, GLArea *) { e->ignore(); } +}; + + +/** MeshEditInterfaceFactory +\short The MeshEditInterfaceFactory class is a factory is used to generate a object for each starting of an editing filter. + +This is needed because editing filters have a internal state, so if you want to have an editing tool for two different documents you have to instance two objects. +This class is used by the framework to generate an independent MeshEditInterface for each document. +*/ +class EditPluginInterfaceFactory +{ +public: + virtual ~EditPluginInterfaceFactory() {} + + //gets a list of actions available from this plugin + virtual QList actions() const = 0; + + //get the edit tool for the given action + virtual EditPluginInterface* getMeshEditInterface(const QAction *) = 0; + + //get the description for the given action + virtual QString getEditToolDescription(const QAction *) = 0; + +}; + +#define MESHLAB_PLUGIN_IID_EXPORTER(x) Q_PLUGIN_METADATA(IID x) +#define MESHLAB_PLUGIN_NAME_EXPORTER(x) + +#define EDIT_PLUGIN_INTERFACE_IID "vcg.meshlab.EditPluginInterface/1.0" +#define EDIT_PLUGIN_INTERFACE_FACTORY_IID "vcg.meshlab.EditPluginInterfaceFactory/1.0" + +Q_DECLARE_INTERFACE(EditPluginInterface, EDIT_PLUGIN_INTERFACE_IID) +Q_DECLARE_INTERFACE(EditPluginInterfaceFactory, EDIT_PLUGIN_INTERFACE_FACTORY_IID) + + +#endif // MESHLAB_EDIT_PLUGIN_INTERFACE_H diff --git a/src/common/interfaces/filter_plugin_interface.cpp b/src/common/interfaces/filter_plugin_interface.cpp new file mode 100644 index 000000000..18fd66e3e --- /dev/null +++ b/src/common/interfaces/filter_plugin_interface.cpp @@ -0,0 +1,105 @@ +#include "filter_plugin_interface.h" + +bool FilterPluginInterface::isFilterApplicable(const QAction* act, const MeshModel& m, QStringList &MissingItems) const +{ + int preMask = getPreConditions(act); + MissingItems.clear(); + + if (preMask == MeshModel::MM_NONE) // no precondition specified. + return true; + + if (preMask & MeshModel::MM_VERTCOLOR && !m.hasDataMask(MeshModel::MM_VERTCOLOR)) + MissingItems.push_back("Vertex Color"); + + if (preMask & MeshModel::MM_FACECOLOR && !m.hasDataMask(MeshModel::MM_FACECOLOR)) + MissingItems.push_back("Face Color"); + + if (preMask & MeshModel::MM_VERTQUALITY && !m.hasDataMask(MeshModel::MM_VERTQUALITY)) + MissingItems.push_back("Vertex Quality"); + + if (preMask & MeshModel::MM_FACEQUALITY && !m.hasDataMask(MeshModel::MM_FACEQUALITY)) + MissingItems.push_back("Face Quality"); + + if (preMask & MeshModel::MM_WEDGTEXCOORD && !m.hasDataMask(MeshModel::MM_WEDGTEXCOORD)) + MissingItems.push_back("Per Wedge Texture Coords"); + + if (preMask & MeshModel::MM_VERTTEXCOORD && !m.hasDataMask(MeshModel::MM_VERTTEXCOORD)) + MissingItems.push_back("Per Vertex Texture Coords"); + + if (preMask & MeshModel::MM_VERTRADIUS && !m.hasDataMask(MeshModel::MM_VERTRADIUS)) + MissingItems.push_back("Vertex Radius"); + + if (preMask & MeshModel::MM_CAMERA && !m.hasDataMask(MeshModel::MM_CAMERA)) + MissingItems.push_back("Camera"); + + if (preMask & MeshModel::MM_FACENUMBER && (m.cm.fn==0)) + MissingItems.push_back("Any Faces"); + + + return MissingItems.isEmpty(); +} + +PluginInterface::FilterIDType FilterPluginInterface::ID(const QAction* a) const +{ + QString aa=a->text(); + for(FilterIDType tt : types()) + if (a->text() == this->filterName(tt)) return tt; + aa.replace("&",""); + for(FilterIDType tt : types()) + if (aa == this->filterName(tt)) return tt; + + qDebug("unable to find the id corresponding to action '%s'", qUtf8Printable(a->text())); + assert(0); + return -1; +} + +QAction* FilterPluginInterface::getFilterAction(PluginInterface::FilterIDType filterID) +{ + QString idName = this->filterName(filterID); + return getFilterAction(idName); +} + +QAction* FilterPluginInterface::getFilterAction(const QString& idName) +{ + QString i=idName; + for(QAction *tt : actionList) + if (idName == tt->text()) return tt; + i.replace("&",""); + for(QAction *tt : actionList) + if (i == tt->text()) return tt; + + qDebug("unable to find the action corresponding to action '%s'", qUtf8Printable(idName)); + assert(0); + return 0; +} + +int FilterPluginInterface::previewOnCreatedAttributes(const QAction* act, const MeshModel& mm ) const +{ + int changedIfCalled = postCondition(act); + int createdIfCalled = MeshModel::MM_NONE; + if ((changedIfCalled & MeshModel::MM_VERTCOLOR) && !mm.hasDataMask(MeshModel::MM_VERTCOLOR)) + createdIfCalled = createdIfCalled | MeshModel::MM_VERTCOLOR; + + if ((changedIfCalled & MeshModel::MM_FACECOLOR) && !mm.hasDataMask(MeshModel::MM_FACECOLOR)) + createdIfCalled = createdIfCalled | MeshModel::MM_FACECOLOR; + + if ((changedIfCalled & MeshModel::MM_VERTQUALITY) && !mm.hasDataMask(MeshModel::MM_VERTQUALITY)) + createdIfCalled = createdIfCalled | MeshModel::MM_VERTQUALITY; + + if ((changedIfCalled & MeshModel::MM_FACEQUALITY) && !mm.hasDataMask(MeshModel::MM_FACEQUALITY)) + createdIfCalled = createdIfCalled | MeshModel::MM_FACEQUALITY; + + if ((changedIfCalled & MeshModel::MM_WEDGTEXCOORD) && !mm.hasDataMask(MeshModel::MM_WEDGTEXCOORD)) + createdIfCalled = createdIfCalled | MeshModel::MM_WEDGTEXCOORD; + + if ((changedIfCalled & MeshModel::MM_VERTTEXCOORD) && !mm.hasDataMask(MeshModel::MM_VERTTEXCOORD)) + createdIfCalled = createdIfCalled | MeshModel::MM_VERTTEXCOORD; + + if ((changedIfCalled & MeshModel::MM_VERTRADIUS) && !mm.hasDataMask(MeshModel::MM_VERTRADIUS)) + createdIfCalled = createdIfCalled | MeshModel::MM_VERTRADIUS; + + if ((getClass(act) == FilterPluginInterface::MeshCreation) && (mm.cm.vn == 0)) + createdIfCalled = createdIfCalled | MeshModel::MM_VERTCOORD; + + return createdIfCalled; +} diff --git a/src/common/interfaces/filter_plugin_interface.h b/src/common/interfaces/filter_plugin_interface.h new file mode 100644 index 000000000..e4f14a959 --- /dev/null +++ b/src/common/interfaces/filter_plugin_interface.h @@ -0,0 +1,210 @@ +/**************************************************************************** +* 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_FILTER_PLUGIN_INTERFACE_H +#define MESHLAB_FILTER_PLUGIN_INTERFACE_H + +#include "plugin_interface.h" +#include "../meshmodel.h" + +/** +\brief The MeshFilterInterface class provide the interface of the filter plugins. + +*/ +class FilterPluginInterface : public PluginInterface +{ +public: + /** The FilterClass 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 FilterClass + { + Generic = 0x00000, /*!< Should be avoided if possible. */ // + Selection = 0x00001, /*!< select or de-select something, basic operation on selections (like deleting)*/ + Cleaning = 0x00002, /*!< Filters that can be used to clean meshes (duplicated vertices etc)*/ + Remeshing = 0x00004, /*!< Simplification, Refinement, Reconstruction and mesh optimization*/ + FaceColoring = 0x00008, + VertexColoring = 0x00010, + MeshColoring = 0x00020, + MeshCreation = 0x00040, + Smoothing = 0x00080, /*!< Stuff that does not change the topology, but just the vertex positions*/ + Quality = 0x00100, + Layer = 0x00200, /*!< Layers, attributes */ + RasterLayer = 0x00400, /*!< Raster Layers, attributes */ + Normal = 0x00800, /*!< Normal, Curvature, orientation (rotations and transformations fall here)*/ + Sampling = 0x01000, + Texture = 0x02000, + RangeMap = 0x04000, /*!< filters specific for range map processing*/ + PointSet = 0x08000, + Measure = 0x10000, /*!< Filters that compute measures and information on meshes.*/ + Polygonal = 0x20000, /*!< Filters that works on polygonal and quad meshes.*/ + Camera = 0x40000 /*!< Filters that works on shot of mesh and raster.*/ + }; + + + + FilterPluginInterface() : PluginInterface(), glContext(NULL) + { + } + virtual ~FilterPluginInterface() {} + + + /** The very short string (a few words) describing each filtering action + // This string is used also to define the menu entry + */ + virtual QString filterName(FilterIDType) const = 0; + + /** The long, formatted string describing each filtering action. + // This string is printed in the top of the parameter window + // so it should be at least one or two paragraphs long. The more the better. + // you can use simple html formatting tags (like "
" "" and "") to improve readability. + // This string is used in the 'About plugin' dialog and by meshlabserver to create the filter list wiki page and the doxygen documentation of the filters. + // Here is the place where you should put you bibliographic references in a form like this: +
+ See:
+ Luiz Velho, Denis Zorin
+ "4-8 Subdivision"
+ CAGD, volume 18, Issue 5, Pages 397-427.
+
+ e.g. italic for authors, bold for title (quoted) and plain for bib ref. + */ + virtual QString filterInfo(FilterIDType filter) const = 0; + + /** The FilterClass describes in which generic class of filters it fits. + // This choice affect the submenu in which each filter will be placed + // For example filters that perform an action only on the selection will be placed in the Selection Class + */ + virtual FilterClass getClass(const QAction*) const { return FilterPluginInterface::Generic; } + + /** + The filters can have some additional requirements on the mesh capabiliteis. + // For example if a filters requires Face-Face Adjacency you should re-implement + // this function making it returns MeshModel::MM_FACEFACETOPO. + // The framework will ensure that the mesh has the requirements satisfied before invoking the applyFilter function + // + // Furthermore, requirements are checked just before the invocation of a filter. If your filter + // outputs a never used before mesh property (e.g. face colors), it will be allocated by a call + // to MeshModel::updateDataMask(...) + */ + virtual int getRequirements(const QAction*) { return MeshModel::MM_NONE; } + + /** The FilterPrecondition mask is used to explicitate what kind of data a filter really needs to be applied. + // For example algorithms that compute per face quality have as precondition the existence of faces + // (but quality per face is not a precondition, because quality per face is created by these algorithms) + // on the other hand an algorithm that deletes faces according to the stored quality has both FaceQuality + // and Face as precondition. + // These conditions do NOT include computed properties like borderFlags, manifoldness or watertightness. + // They are also used to grayout menus un-appliable entries. + */ + virtual int getPreConditions(const QAction*) const { return MeshModel::MM_NONE; } + + /** Function used by the framework to get info about the mesh properties changed by the filter. + // It is widely used by the meshlab's preview system. + //TO BE REPLACED WITH = 0 + */ + virtual int postCondition(const QAction*) const { return MeshModel::MM_ALL; } + + /** \brief applies the selected filter with the already stabilished parameters + * This function is called by the framework after getting values for the parameters specified in the \ref InitParameterSet + * NO GUI interaction should be done here. No dialog asking, no messagebox errors. + * Think that his function will also be called by the commandline framework. + * If you want report errors, use the \ref errorMsg() string. It will displayed in case of filters returning false. + * When implementing your applyFilter, you should use the cb function to report to the framework the current state of the processing. + * During your (long) processing you should call from time to time cb(perc,descriptiveString), where perc is an int (0..100) + * saying what you are doing and at what point of the computation you currently are. + * \sa errorMsg + * \sa initParameterSet + */ + virtual bool applyFilter(const QAction* filter, MeshDocument& md, unsigned int& postConditionMask, const RichParameterList& par, vcg::CallBackPos* cb) = 0; + + /** \brief tests if a filter is applicable to a mesh. + This function is a handy wrapper used by the framework for the \a getPreConditions callback; + For instance a colorize by quality filter cannot be applied to a mesh without per-vertex-quality. + On failure (returning false) the function fills the MissingItems list with strings describing the missing items. + */ + bool isFilterApplicable(const QAction* act, const MeshModel& m, QStringList &MissingItems) const; + + + enum FILTER_ARITY { NONE = 0, SINGLE_MESH = 1, FIXED = 2, VARIABLE = 3, UNKNOWN_ARITY = 4 }; + + /** \brief this function informs the MeshLab core on how many meshes the filter will work on. + Valid value: + - SINGLE_MESH: the filter works just on the current mesh + - FIXED: the number (and the names) of the meshes involved in the filter computation is determined by the parameters selected in the filter's parameters form + - VARIABLE: the filter works on a not predetermined number of meshes. The meshes involved are typically selected by the user checking on the correspondent layer on the layer dialog + */ + virtual FILTER_ARITY filterArity(const QAction *act) const = 0; + + // This function is called to initialized the list of parameters. + // it is always called. If a filter does not need parameter it leave it empty and the framework + // will not create a dialog (unless for previewing) + virtual void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*par*/) {} + virtual void initParameterList(const QAction* filter, MeshDocument &md, RichParameterList &par) + { + initParameterList(filter, *(md.mm()), par); + } + + /** \brief is invoked by the framework when the applyFilter fails to give some info to the user about the filter failure + * Filters \b must never use QMessageBox for reporting errors. + * Failing filters should put some meaningful information inside the errorMessage string and return false with the \ref applyFilter + */ + const QString& errorMsg() const { return this->errorMessage; } + virtual QString filterInfo(const QAction* a) const { return this->filterInfo(ID(a)); } + virtual QString filterName(const QAction* a) const { return this->filterName(ID(a)); } + virtual QString filterScriptFunctionName(FilterIDType /*filterID*/) { return ""; } + + virtual FilterIDType ID(const QAction *a) const; + + virtual QAction* getFilterAction(FilterIDType filterID); + virtual QAction* getFilterAction(const QString& idName); + + virtual QList actions() const { return actionList; } + virtual QList types() const { return typeList; } + + /** Generate the mask of attributes would be created IF the MeshFilterInterface filt would has been called on MeshModel mm + BE CAREFUL! this function does NOT change in anyway the state of the MeshModel!!!! **/ + int previewOnCreatedAttributes(const QAction* act, const MeshModel& mm) const; + QString generatedScriptCode; + + MLPluginGLContext* glContext; +protected: + // Each plugins exposes a set of filtering possibilities. + // Each filtering procedure corresponds to a single QAction with a corresponding FilterIDType id. + // + + // The list of actions exported by the plugin. Each actions strictly corresponds to + QList actionList; + + QList typeList; + + // this string is used to pass back to the framework error messages in case of failure of a filter apply. + QString errorMessage; +}; + +#define MESHLAB_PLUGIN_IID_EXPORTER(x) Q_PLUGIN_METADATA(IID x) +#define MESHLAB_PLUGIN_NAME_EXPORTER(x) + +#define FILTER_PLUGIN_INTERFACE_IID "vcg.meshlab.FilterPluginInterface/1.0" +Q_DECLARE_INTERFACE(FilterPluginInterface, FILTER_PLUGIN_INTERFACE_IID) + +#endif // MESHLAB_FILTER_PLUGIN_INTERFACE_H diff --git a/src/common/interfaces/io_plugin_interface.h b/src/common/interfaces/io_plugin_interface.h new file mode 100644 index 000000000..c64fb966b --- /dev/null +++ b/src/common/interfaces/io_plugin_interface.h @@ -0,0 +1,112 @@ +/**************************************************************************** +* 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_IO_PLUGIN_INTERFACE_H +#define MESHLAB_IO_PLUGIN_INTERFACE_H + +#include + +#include "plugin_interface.h" + +/** \brief The MeshIOInterface is the base class for all the single mesh loading plugins. +*/ +class IOPluginInterface : public PluginInterface +{ +public: + class Format + { + public: + Format(QString description, QString ex) : description(description) { extensions << ex; } + QString description; + QStringList extensions; + }; + + IOPluginInterface() : PluginInterface() { } + virtual ~IOPluginInterface() {} + + virtual QList importFormats() const = 0; + virtual QList exportFormats() const = 0; + + // This function is called to initialize the list of additional parameters that a OPENING filter could require + // it is called by the framework BEFORE the actual mesh loading to perform to determine how parse the input file + // The instanced parameters are then passed to the open at the loading time. + // Typical example of use to decide what subportion of a mesh you have to load. + // If you do not need any additional processing simply do not override this and ignore the parameterSet in the open + virtual void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, RichParameterList & /*par*/) {} + + // This function is called to initialize the list of additional parameters that a OPENING filter could require + // it is called by the framework AFTER the mesh is already loaded to perform more or less standard processing on the mesh. + // typical example: unifying vertices in stl models. + // If you do not need any additional processing do nothing. + virtual void initOpenParameter(const QString &/*format*/, MeshModel &/*m*/, RichParameterList & /*par*/) {} + + // This is the corresponding function that is called after the mesh is loaded with the initialized parameters + virtual void applyOpenParameter(const QString &/*format*/, MeshModel &/*m*/, const RichParameterList &/*par*/) {} + + // This function is called to initialize the list of additional parameters that a SAVING filter could require + // it is called by the framework after the mesh is loaded to perform more or less standard processing on the mesh. + // typical example: ascii or binary format for ply or stl + // If you do not need any additional parameter simply do nothing. + virtual void initSaveParameter(const QString &/*format*/, MeshModel &/*m*/, RichParameterList & /*par*/) {} + + + virtual void GetExportMaskCapability(const QString &format, int &capability, int &defaultBits) const = 0; + + /// callback used to actually load a mesh from a file + virtual bool open( + const QString &format, /// the extension of the format e.g. "PLY" + const QString &fileName, /// The name of the file to be opened + MeshModel &m, /// The mesh that is filled with the file content + int &mask, /// a bit mask that will be filled reporting what kind of data we have found in the file (per vertex color, texture coords etc) + const RichParameterList & par, /// The parameters that have been set up in the initPreOpenParameter() + vcg::CallBackPos *cb = 0, /// standard callback for reporting progress in the loading + QWidget *parent = 0) = 0; /// you should not use this... + + virtual bool save( + const QString &format, // the extension of the format e.g. "PLY" + const QString &fileName, + MeshModel &m, + const int mask,// a bit mask indicating what kind of the data present in the mesh should be saved (e.g. you could not want to save normals in ply files) + const RichParameterList & par, + vcg::CallBackPos *cb = 0, + QWidget *parent = 0) = 0; + + /// This function is invoked by the framework when the import/export plugin fails to give some info to the user about the failure + /// io plugins should avoid using QMessageBox for reporting errors. + /// Failure should put some meaningful information inside the errorMessage string. + virtual QString &errorMsg() { return this->errorMessage; } + void clearErrorString() { errorMessage.clear(); } + + // this string is used to pass back to the framework error messages in case of failure of a filter apply. + // NEVER EVER use a msgbox to say something to the user. + QString errorMessage; + +}; + +#define MESHLAB_PLUGIN_IID_EXPORTER(x) Q_PLUGIN_METADATA(IID x) +#define MESHLAB_PLUGIN_NAME_EXPORTER(x) + +#define IO_PLUGIN_INTERFACE_IID "vcg.meshlab.IOPluginInterface/1.0" +Q_DECLARE_INTERFACE(IOPluginInterface, IO_PLUGIN_INTERFACE_IID) + +#endif // MESHLAB_IO_PLUGIN_INTERFACE_H diff --git a/src/common/interfaces/mainwindow_interface.h b/src/common/interfaces/mainwindow_interface.h new file mode 100644 index 000000000..f4989799a --- /dev/null +++ b/src/common/interfaces/mainwindow_interface.h @@ -0,0 +1,42 @@ +/**************************************************************************** +* 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_MAINWINDOW_INTERFACE_H +#define MESHLAB_MAINWINDOW_INTERFACE_H + +#include +#include "../filter_parameter/rich_parameter_list.h" + +/** The MainWindowInterface class defines just the executeFilter() callback function +that is invoked by the standard parameter input dialog. +It is used as base class of the MainWindow. +*/ +class MainWindowInterface +{ +public: + virtual void executeFilter(const QAction *, RichParameterList &, bool = false) {} + //parexpval is a string map containing the parameter expression values set in the filter's dialog. + //These parameter expression values will be evaluated when the filter will start. +}; + +#endif // MESHLAB_MAINWINDOW_INTERFACE_H diff --git a/src/common/interfaces/plugin_interface.cpp b/src/common/interfaces/plugin_interface.cpp new file mode 100644 index 000000000..7161c8049 --- /dev/null +++ b/src/common/interfaces/plugin_interface.cpp @@ -0,0 +1,46 @@ +#include "plugin_interface.h" + +PluginInterface::PluginInterface() : + logstream(nullptr) +{ +} + +void PluginInterface::setLog(GLLogStream* log) +{ + this->logstream = log; +} + +void PluginInterface::log(const char* s) +{ + if(logstream != nullptr) { + logstream->Log(GLLogStream::FILTER, s); + } +} + +void PluginInterface::log(const std::string& s) +{ + if(logstream != nullptr) { + logstream->Log(GLLogStream::FILTER, s); + } +} + +void PluginInterface::log(GLLogStream::Levels level, const char* s) +{ + if(logstream != nullptr) { + logstream->Log(level, s); + } +} + +void PluginInterface::log(GLLogStream::Levels level, const std::string& s) +{ + if(logstream != nullptr) { + logstream->Log(level, s); + } +} + +void PluginInterface::realTimeLog(QString Id, const QString& meshName, const char* f) +{ + if(logstream != nullptr) { + logstream->RealTimeLog(Id, meshName, f); + } +} diff --git a/src/common/interfaces/plugin_interface.h b/src/common/interfaces/plugin_interface.h new file mode 100644 index 000000000..4759d5722 --- /dev/null +++ b/src/common/interfaces/plugin_interface.h @@ -0,0 +1,118 @@ +/**************************************************************************** +* 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_PLUGIN_INTERFACE_H +#define MESHLAB_PLUGIN_INTERFACE_H + +#include + + +#include "../GLLogStream.h" +#include "../filter_parameter/rich_parameter_list.h" + +/** + * \brief The MeshLabInterface class is the base of all the plugin interfaces. + * + * The main idea common to all the framework is that each plugin export a set of actions, + * internally each action is associated to a FilterIDType, and for each action a name and a formatted INFO is defined. + * + * For coding easyness ID are more practical (you can use them in switches). + * Using action on the other hand is practical because it simplify their management in menus/toolbars and it allows to define icons and other things in a automatic way. + * Moreover ID are UNSAFE (different plugin can have same id) so they should be used only INTERNALLY + * + * \todo There is inconsistency in the usage of ID and actions for retrieving particular filters. Remove. + */ +class PluginInterface +{ +public: + typedef int FilterIDType; + + /** the type used to identify plugin actions; there is a one-to-one relation between an ID and an Action. + \todo To be renamed as ActionIDType + */ + PluginInterface(); + virtual ~PluginInterface() {} + + /** + * @brief This functions returns the name of the current plugin. + * Must be implemented in every plugin. + * @return + */ + virtual QString pluginName() const = 0; + + /// Standard stuff that usually should not be redefined. + void setLog(GLLogStream* log); + + // This function must be used to communicate useful information collected in the parsing/saving of the files. + // NEVER EVER use a msgbox to say something to the user. + template + void log(const char* f, Ts&&... ts); + + void log(const char* s); + void log(const std::string& s); + + template + void log(GLLogStream::Levels Level, const char* f, Ts&&... ts); + + void log(GLLogStream::Levels level, const char* s); + + void log(GLLogStream::Levels level, const std::string& s); + + void realTimeLog(QString Id, const QString& meshName, const char* f); + + template + void realTimeLog(QString Id, const QString &meshName, const char * f, Ts&&... ts ); + +private: + GLLogStream *logstream; +}; + +/************************ + * Template definitions * + ************************/ + +template +void PluginInterface::log(const char* f, Ts&&... ts) +{ + if(logstream != nullptr) { + logstream->Logf(GLLogStream::FILTER, f, std::forward(ts)...); + } +} + +template +void PluginInterface::log(GLLogStream::Levels Level, const char* f, Ts&&... ts) +{ + if(logstream != nullptr) { + logstream->Logf(Level, f, std::forward(ts)...); + } +} + +template +void PluginInterface::realTimeLog(QString Id, const QString& meshName, const char* f, Ts&&... ts) +{ + if(logstream != nullptr) { + logstream->RealTimeLogf(Id, meshName, f, std::forward(ts)...); + } +} + +#endif // MESHLAB_PLUGIN_INTERFACE_H diff --git a/src/common/interfaces/render_plugin_interface.h b/src/common/interfaces/render_plugin_interface.h new file mode 100644 index 000000000..e4b0ba30c --- /dev/null +++ b/src/common/interfaces/render_plugin_interface.h @@ -0,0 +1,70 @@ +/**************************************************************************** +* 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_RENDER_PLUGIN_INTERFACE_H +#define MESHLAB_RENDER_PLUGIN_INTERFACE_H + +#include "plugin_interface.h" +#include "../ml_shared_data_context.h" + +/** +Used to customized the rendering process. +Rendering plugins are now responsible of the rendering of the whole MeshDocument and not only of a single MeshModel. + +The Render function is called in with the ModelView and Projection Matrices already set up, screen cleared and background drawn. +After the Render call the MeshLab frawework draw on the opengl context other decorations and the trackball, so it there is the +requirement for a rendering plugin is that it should leave the z-buffer in a coherent state. + +The typical rendering loop of a Render plugin is something like, : + + + +foreach(MeshModel * mp, meshDoc.meshList) +{ +if(mp->visible) mp->Render(rm.drawMode,rm.colorMode,rm.textureMode); +} + +*/ + +class GLArea; + +class RenderPluginInterface : public PluginInterface +{ +public: + RenderPluginInterface() :PluginInterface() {} + virtual ~RenderPluginInterface() {} + + virtual void Init(QAction *, MeshDocument &, MLSceneGLSharedDataContext::PerMeshRenderingDataMap& /*mp*/, GLArea *) {} + virtual void Render(QAction *, MeshDocument &, MLSceneGLSharedDataContext::PerMeshRenderingDataMap& mp, GLArea *) = 0; + virtual void Finalize(QAction *, MeshDocument *, GLArea *) {} + virtual bool isSupported() = 0; + virtual QList actions() = 0; +}; + +#define MESHLAB_PLUGIN_IID_EXPORTER(x) Q_PLUGIN_METADATA(IID x) +#define MESHLAB_PLUGIN_NAME_EXPORTER(x) + +#define RENDER_PLUGIN_INTERFACE_IID "vcg.meshlab.RenderPluginInterface/1.0" +Q_DECLARE_INTERFACE(RenderPluginInterface, RENDER_PLUGIN_INTERFACE_IID) + +#endif // MESHLAB_RENDER_PLUGIN_INTERFACE_H diff --git a/src/common/pluginmanager.cpp b/src/common/pluginmanager.cpp index 95a50c4a4..477e47256 100644 --- a/src/common/pluginmanager.cpp +++ b/src/common/pluginmanager.cpp @@ -1,10 +1,14 @@ #include "pluginmanager.h" #include +#include +#include +#include #include #include "mlexception.h" + static QString DLLExtension() { #if defined(Q_OS_WIN) return QString("dll"); @@ -43,7 +47,7 @@ PluginManager::~PluginManager() meshFilterPlug.clear(); meshRenderPlug.clear(); meshDecoratePlug.clear(); - for (MeshCommonInterface* plugin : ownerPlug) + for (PluginInterface* plugin : ownerPlug) delete plugin; ownerPlug.clear(); @@ -83,8 +87,8 @@ void PluginManager::loadPlugins(RichParameterList& defaultGlobal, const QDir& pl if (plugin) { pluginsLoaded.push_back(fileName); - MeshCommonInterface *iCommon = nullptr; - MeshFilterInterface *iFilter = qobject_cast(plugin); + PluginInterface *iCommon = nullptr; + FilterPluginInterface *iFilter = qobject_cast(plugin); if (iFilter) { iCommon = iFilter; @@ -94,8 +98,7 @@ void PluginManager::loadPlugins(RichParameterList& defaultGlobal, const QDir& pl filterAction->setData(QVariant(fileName)); actionFilterMap.insert(filterAction->text(), filterAction); stringFilterMap.insert(filterAction->text(), iFilter); - iFilter->initGlobalParameterSet(filterAction, defaultGlobal); - if(iFilter->getClass(filterAction)==MeshFilterInterface::Generic) + if(iFilter->getClass(filterAction)==FilterPluginInterface::Generic) throw MLException("Missing class for " +fileName+filterAction->text()); if(iFilter->getRequirements(filterAction) == int(MeshModel::MM_UNKNOWN)) throw MLException("Missing requirements for " +fileName+filterAction->text()); @@ -103,19 +106,18 @@ void PluginManager::loadPlugins(RichParameterList& defaultGlobal, const QDir& pl throw MLException("Missing preconditions for "+fileName+filterAction->text()); if(iFilter->postCondition(filterAction) == int(MeshModel::MM_UNKNOWN )) throw MLException("Missing postcondition for "+fileName+filterAction->text()); - if(iFilter->filterArity(filterAction) == MeshFilterInterface::UNKNOWN_ARITY ) + if(iFilter->filterArity(filterAction) == FilterPluginInterface::UNKNOWN_ARITY ) throw MLException("Missing Arity for " +fileName+filterAction->text()); } } - MeshIOInterface *iIO = qobject_cast(plugin); + IOPluginInterface *iIO = qobject_cast(plugin); if (iIO) { iCommon = iIO; meshIOPlug.push_back(iIO); - iIO->initGlobalParameterSet(NULL, defaultGlobal); } - MeshDecorateInterface *iDecorator = qobject_cast(plugin); + DecoratePluginInterface *iDecorator = qobject_cast(plugin); if (iDecorator) { iCommon = iDecorator; @@ -123,18 +125,18 @@ void PluginManager::loadPlugins(RichParameterList& defaultGlobal, const QDir& pl foreach(QAction *decoratorAction, iDecorator->actions()) { decoratorActionList.push_back(decoratorAction); - iDecorator->initGlobalParameterSet(decoratorAction, defaultGlobal); + iDecorator->initGlobalParameterList(decoratorAction, defaultGlobal); } } - MeshRenderInterface *iRender = qobject_cast(plugin); + RenderPluginInterface *iRender = qobject_cast(plugin); if (iRender) { iCommon = iRender; meshRenderPlug.push_back(iRender); } - MeshEditInterfaceFactory *iEditFactory = qobject_cast(plugin); + EditPluginInterfaceFactory *iEditFactory = qobject_cast(plugin); if (iEditFactory) { meshEditInterfacePlug.push_back(iEditFactory); @@ -160,9 +162,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; @@ -188,7 +190,7 @@ QMap PluginManager::generateFilterParameterMap() QString filterName = ai.key();// ->filterName(); //QAction act(filterName,NULL); RichParameterList rp; - stringFilterMap[filterName]->initParameterSet(ai.value(), md, rp); + stringFilterMap[filterName]->initParameterList(ai.value(), md, rp); FPM[filterName] = rp; } return FPM; @@ -271,11 +273,11 @@ void PluginManager::knownIOFormats() { QStringList* formatFilters = NULL; QString allKnownFormatsFilter = QObject::tr("All known formats ("); - for (QVector::iterator itIOPlugin = meshIOPlug.begin(); itIOPlugin != meshIOPlug.end(); ++itIOPlugin) + for (QVector::iterator itIOPlugin = meshIOPlug.begin(); itIOPlugin != meshIOPlug.end(); ++itIOPlugin) { - MeshIOInterface* pMeshIOPlugin = *itIOPlugin; - QList format; - QMap* map = NULL; + IOPluginInterface* pMeshIOPlugin = *itIOPlugin; + QList format; + QMap* map = NULL; if (inpOut == int(IMPORT)) { map = &allKnowInputFormats; @@ -288,9 +290,9 @@ void PluginManager::knownIOFormats() formatFilters = &outFilters; format = pMeshIOPlugin->exportFormats(); } - for (QList::iterator itf = format.begin(); itf != format.end(); ++itf) + for (QList::iterator itf = format.begin(); itf != format.end(); ++itf) { - MeshIOInterface::Format currentFormat = *itf; + IOPluginInterface::Format currentFormat = *itf; QString currentFilterEntry = currentFormat.description + " ("; diff --git a/src/common/pluginmanager.h b/src/common/pluginmanager.h index 9b922c5b4..f10982470 100644 --- a/src/common/pluginmanager.h +++ b/src/common/pluginmanager.h @@ -24,11 +24,17 @@ #ifndef PLUGINMANAGER_H #define PLUGINMANAGER_H -#include "interfaces.h" +#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 "interfaces/edit_plugin_interface.h" + //#include "scriptsyntax.h" #include #include +#include /** \brief This class provides the basic tools for managing all the plugins. It is used by both meshlab and meshlab server. @@ -44,35 +50,35 @@ public: QString pluginsCode() const; int numberIOPlugins() const; - inline QVector& meshFilterPlugins() {return meshFilterPlug;} - inline QVector& meshRenderPlugins() {return meshRenderPlug;} - inline QVector& meshDecoratePlugins() {return meshDecoratePlug;} - inline QVector& meshEditFactoryPlugins() {return meshEditInterfacePlug;} + inline QVector& meshFilterPlugins() {return meshFilterPlug;} + inline QVector& meshRenderPlugins() {return meshRenderPlug;} + inline QVector& meshDecoratePlugins() {return meshDecoratePlug;} + inline QVector& meshEditFactoryPlugins() {return meshEditInterfacePlug;} static QString getDefaultPluginDirPath(); static QString getBaseDirPath(); QMap generateFilterParameterMap(); - MeshDecorateInterface* getDecoratorInterfaceByName(const QString& name); + DecoratePluginInterface* getDecoratorInterfaceByName(const QString& name); QMap actionFilterMap; - QMap stringFilterMap; - QMap allKnowInputFormats; - QMap allKnowOutputFormats; + QMap stringFilterMap; + QMap allKnowInputFormats; + QMap allKnowOutputFormats; QStringList inpFilters; QStringList outFilters; - QVector meshIOPlug; - QVector meshFilterPlug; - QVector meshRenderPlug; - QVector meshDecoratePlug; - QVector meshEditInterfacePlug; + QVector meshIOPlug; + QVector meshFilterPlug; + QVector meshRenderPlug; + QVector meshDecoratePlug; + QVector meshEditInterfacePlug; QVector editActionList; QVector decoratorActionList; // Used for unique destruction - this "owns" all IO, Filter, Render, and Decorate plugins - QVector ownerPlug; + QVector ownerPlug; QStringList pluginsLoaded; diff --git a/src/meshlab.pro b/src/meshlab.pro index f0423e57a..465390d40 100644 --- a/src/meshlab.pro +++ b/src/meshlab.pro @@ -271,11 +271,6 @@ edit_quality.depends = common edit_select.depends = common edit_pickpoints.depends = common -#no longer needed# meshlabplugins/filter_aging \ -#no longer needed# meshlabplugins/filter_bnpts \ -#no longer needed# meshlabplugins/filter_colorize \ - - # if distrib folder is not in $$PWD/../distrib (shadow build case), # we need to copy all the files inside $$PWD/../distrib in the actual # distrib folder ($$OUT_PWD/distrib or $$MESHLAB_DISTRIB_DIRECTORY) diff --git a/src/meshlab/filterScriptDialog.cpp b/src/meshlab/filterScriptDialog.cpp index fd4b3fbfd..5c177692f 100644 --- a/src/meshlab/filterScriptDialog.cpp +++ b/src/meshlab/filterScriptDialog.cpp @@ -210,7 +210,7 @@ void FilterScriptDialog::editOldParameters( const int row ) //get a pointer to this action and filter from the main window so we can get the //description of the parameters from the filter QAction *action = mainWindow->pluginManager().actionFilterMap[actionName]; - MeshFilterInterface *iFilter = qobject_cast(action->parent()); + FilterPluginInterface *iFilter = qobject_cast(action->parent()); if(NULL == iFilter){ qDebug() << "null filter"; @@ -220,7 +220,7 @@ void FilterScriptDialog::editOldParameters( const int row ) //fill the parameter set with all the names and descriptions which are lost in the //filter script RichParameterList newParameterSet; - iFilter->initParameterSet(action, *(mainWindow->meshDoc()), newParameterSet); + iFilter->initParameterList(action, *(mainWindow->meshDoc()), newParameterSet); if(newParameterSet.size() == oldParameterSet.size()) { RichParameterList::iterator i = newParameterSet.begin(); diff --git a/src/meshlab/glarea.cpp b/src/meshlab/glarea.cpp index 2d3e3f480..ac92637a7 100644 --- a/src/meshlab/glarea.cpp +++ b/src/meshlab/glarea.cpp @@ -23,7 +23,6 @@ -#include #include #include "glarea.h" @@ -35,6 +34,8 @@ #include #include #include +#include +#include #include #include @@ -484,7 +485,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 +547,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 +568,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 +1066,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 +1152,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 +1166,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 +1403,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 +1416,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 +1442,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); @@ -1760,9 +1761,9 @@ void GLArea::updateCustomSettingValues( const RichParameterList& rps ) this->update(); } -void GLArea::initGlobalParameterSet( RichParameterList * defaultGlobalParamSet) +void GLArea::initGlobalParameterList( RichParameterList * defaultGlobalParamList) { - GLAreaSetting::initGlobalParameterSet(defaultGlobalParamSet); + GLAreaSetting::initGlobalParameterList(defaultGlobalParamList); } //Don't alter the state of the other elements in the visibility map diff --git a/src/meshlab/glarea.h b/src/meshlab/glarea.h index b124bc401..3da1ddca5 100644 --- a/src/meshlab/glarea.h +++ b/src/meshlab/glarea.h @@ -36,7 +36,9 @@ #include #include -#include +#include +#include +#include #include #include "glarea_setting.h" #include "snapshotsetting.h" @@ -60,7 +62,7 @@ class GLArea : public QGLWidget public: GLArea(QWidget *parent,MultiViewer_Container *mvcont, RichParameterList *current); ~GLArea(); - static void initGlobalParameterSet( RichParameterList * /*globalparam*/); + static void initGlobalParameterList( RichParameterList * /*globalparam*/); private: int id; //the very important unique id of each subwindow. @@ -152,8 +154,8 @@ public: QSize minimumSizeHint() const; QSize sizeHint() const; - QAction *getLastAppliedFilter() {return lastFilterRef;} - void setLastAppliedFilter(QAction *qa) {lastFilterRef = qa;} + const QAction *getLastAppliedFilter() {return lastFilterRef;} + void setLastAppliedFilter(const QAction *qa) {lastFilterRef = qa;} ////RenderMode* getCurrentRenderMode(); //RenderMode* getCurrentRenderMode() @@ -192,8 +194,8 @@ public: QList iPerDocDecoratorlist; QList &iCurPerMeshDecoratorList() { assert(this->md()->mm()) ; return iPerMeshDecoratorsListMap[this->md()->mm()->id()]; } - void setRenderer(MeshRenderInterface *rend, QAction *shader){ iRenderer = rend; currentShader = shader;} - MeshRenderInterface * getRenderer() { return iRenderer; } + void setRenderer(RenderPluginInterface *rend, QAction *shader){ iRenderer = rend; currentShader = shader;} + RenderPluginInterface * getRenderer() { return iRenderer; } QAction* getCurrentShaderAction() {return currentShader;} @@ -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); @@ -350,13 +352,13 @@ public: QAction * getCurrentEditAction() { return currentEditor; } //get the currently active mesh editor - MeshEditInterface * getCurrentMeshEditor() { return iEdit; } + EditPluginInterface * getCurrentMeshEditor() { return iEdit; } //see if this glAarea has a MESHEditInterface for this action bool editorExistsForAction(QAction *editAction){ return actionToMeshEditMap.contains(editAction); } //add a MeshEditInterface for the given action - void addMeshEditor(QAction *editAction, MeshEditInterface *editor){ actionToMeshEditMap.insert(editAction, editor); } + void addMeshEditor(QAction *editAction, EditPluginInterface *editor){ actionToMeshEditMap.insert(editAction, editor); } bool readyToClose(); float lastRenderingTime() { return lastTime;} void drawGradient(); @@ -445,16 +447,16 @@ private: vcg::Point2i pointToPick; //shader support - MeshRenderInterface *iRenderer; + RenderPluginInterface *iRenderer; QAction *currentShader; - QAction *lastFilterRef; // reference to last filter applied + const QAction *lastFilterRef; // reference to last filter applied QFont qFont; //font settings // Editing support - MeshEditInterface *iEdit; + EditPluginInterface *iEdit; QAction *currentEditor; QAction *suspendedEditRef; // reference to last Editing Mode Used - QMap actionToMeshEditMap; + QMap actionToMeshEditMap; //the last model that start edit was called with MeshModel *lastModelEdited; diff --git a/src/meshlab/glarea_setting.cpp b/src/meshlab/glarea_setting.cpp index b10589df7..bf318d008 100644 --- a/src/meshlab/glarea_setting.cpp +++ b/src/meshlab/glarea_setting.cpp @@ -1,6 +1,6 @@ #include "glarea_setting.h" -void GLAreaSetting::initGlobalParameterSet( RichParameterList * defaultGlobalParamSet) +void GLAreaSetting::initGlobalParameterList( RichParameterList * defaultGlobalParamSet) { defaultGlobalParamSet->addParam(RichColor(backgroundBotColorParam(),QColor(128,128,255),"MeshLab Bottom BackGround Color","MeshLab GLarea's BackGround Color(bottom corner)")); defaultGlobalParamSet->addParam(RichColor(backgroundTopColorParam(),QColor( 0, 0, 0),"MeshLab Top BackGround Color","MeshLab GLarea's BackGround Color(top corner)")); diff --git a/src/meshlab/glarea_setting.h b/src/meshlab/glarea_setting.h index b7fb508b6..e2436a2a2 100644 --- a/src/meshlab/glarea_setting.h +++ b/src/meshlab/glarea_setting.h @@ -71,7 +71,7 @@ public: void updateGlobalParameterSet(const RichParameterList& rps ); - static void initGlobalParameterSet( RichParameterList * defaultGlobalParamSet); + static void initGlobalParameterList( RichParameterList * defaultGlobalParamSet); const RichParameterList *currentGlobalParamSet; }; diff --git a/src/meshlab/layerDialog.cpp b/src/meshlab/layerDialog.cpp index 601b6e341..196fd6051 100644 --- a/src/meshlab/layerDialog.cpp +++ b/src/meshlab/layerDialog.cpp @@ -32,6 +32,7 @@ $Log: stdpardialog.cpp,v $ #include #include #include +#include #include "mainwindow.h" #include "ui_layerDialog.h" @@ -893,7 +894,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,12 +1220,12 @@ 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."); } else { - decPlug->initGlobalParameterSet(act,tmpSet); + decPlug->initGlobalParameterList(act,tmpSet); if (tmpSet.size() != 0) { const RichParameterList& currSet = mw->currentGlobalPars(); RichParameterList defSet = tmpSet; 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.h b/src/meshlab/mainwindow.h index ab0000dd0..efae8e25c 100644 --- a/src/meshlab/mainwindow.h +++ b/src/meshlab/mainwindow.h @@ -29,6 +29,7 @@ #include +#include "../common/interfaces/mainwindow_interface.h" #include "../common/pluginmanager.h" #include @@ -66,8 +67,8 @@ class QToolBar; class MainWindowSetting { public: - static void initGlobalParameterSet(RichParameterList* gblset); - void updateGlobalParameterSet(const RichParameterList& rps ); + static void initGlobalParameterList(RichParameterList* gbllist); + void updateGlobalParameterList(const RichParameterList& rpl ); std::ptrdiff_t maxgpumem; inline static QString maximumDedicatedGPUMem() {return "MeshLab::System::maxGPUMemDedicatedToGeometry";} @@ -94,7 +95,7 @@ class MainWindow : public QMainWindow, public MainWindowInterface public: // callback function to execute a filter - void executeFilter(QAction *action, RichParameterList &srcpar, bool isPreview = false); + void executeFilter(const QAction *action, RichParameterList &srcpar, bool isPreview = false); MainWindow(); ~MainWindow(); @@ -148,7 +149,7 @@ private slots: public: bool exportMesh(QString fileName,MeshModel* mod,const bool saveAllPossibleAttributes); - bool loadMesh(const QString& fileName,MeshIOInterface *pCurrentIOPlugin,MeshModel* mm,int& mask,RichParameterList* prePar,const Matrix44m &mtr=Matrix44m::Identity(), bool isareload = false, MLRenderingData* rendOpt = NULL); + bool loadMesh(const QString& fileName,IOPluginInterface *pCurrentIOPlugin,MeshModel* mm,int& mask,RichParameterList* prePar,const Matrix44m &mtr=Matrix44m::Identity(), bool isareload = false, MLRenderingData* rendOpt = NULL); void computeRenderingDataOnLoading(MeshModel* mm,bool isareload, MLRenderingData* rendOpt = NULL); @@ -179,7 +180,6 @@ private slots: void suspendEditMode(); ///////////Slot Menu Filter //////////////////////// void startFilter(); - void applyLastFilter(); void runFilterScript(); void showFilterScript(); void showTooltip(QAction*); @@ -286,14 +286,14 @@ private: Note this part should be detached from MainWindow just like the loading plugin part. For each running instance of meshlab, for the global params we have default (hardwired) values and current(saved,modified) values. - At the start up the initGlobalParameterSet function (of decorations and of glarea and of ... ) is called with the empty RichParameterSet defaultGlobalParams (to collect the default values) + At the start up the initGlobalParameterList function (of decorations and of glarea and of ... ) is called with the empty RichParameterSet defaultGlobalParams (to collect the default values) At the start up the currentGlobalParams is filled with the values saved in the registry. */ RichParameterList currentGlobalParams; RichParameterList defaultGlobalParams; - QByteArray toolbarState; //stato delle toolbar e dockwidgets + QByteArray toolbarState; //toolbar and dockwidgets state QDir lastUsedDirectory; //This will hold the last directory that was used to load/save a file/project in diff --git a/src/meshlab/mainwindow_Init.cpp b/src/meshlab/mainwindow_Init.cpp index 3e6063c3c..0296df1e0 100644 --- a/src/meshlab/mainwindow_Init.cpp +++ b/src/meshlab/mainwindow_Init.cpp @@ -22,7 +22,6 @@ ****************************************************************************/ -#include "../common/interfaces.h" #include "../common/searcher.h" #include "../common/mlapplication.h" #include "../common/mlexception.h" @@ -39,6 +38,7 @@ #include #include #include +#include #include "mainwindow.h" #include "plugindialog.h" #include "meshlab_settings/meshlabsettingsdialog.h" @@ -91,7 +91,7 @@ MainWindow::MainWindow() } // Now load from the registry the settings and merge the hardwired values got from the PM.loadPlugins with the ones found in the registry. loadMeshLabSettings(); - mwsettings.updateGlobalParameterSet(currentGlobalParams); + mwsettings.updateGlobalParameterList(currentGlobalParams); createActions(); createToolBars(); createMenus(); @@ -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()) { @@ -484,7 +484,7 @@ void MainWindow::createToolBars() editToolBar = addToolBar(tr("Edit")); editToolBar->addAction(suspendEditModeAct); - foreach(MeshEditInterfaceFactory *iEditFactory, PM.meshEditFactoryPlugins()) + foreach(EditPluginInterfaceFactory *iEditFactory, PM.meshEditFactoryPlugins()) { foreach(QAction* editAction, iEditFactory->actions()) { @@ -500,7 +500,7 @@ void MainWindow::createToolBars() filterToolBar = addToolBar(tr("Filter")); filterToolBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - foreach(MeshFilterInterface *iFilter, PM.meshFilterPlugins()) + foreach(FilterPluginInterface *iFilter, PM.meshFilterPlugins()) { foreach(QAction* filterAction, iFilter->actions()) { @@ -717,90 +717,90 @@ void MainWindow::fillFilterMenu() filterMenu->addMenu(filterMenuCamera); - QMap::iterator msi; + QMap::iterator msi; for (msi = PM.stringFilterMap.begin(); msi != PM.stringFilterMap.end(); ++msi) { - MeshFilterInterface * iFilter = msi.value(); - QAction *filterAction = iFilter->AC((msi.key())); + FilterPluginInterface * iFilter = msi.value(); + QAction *filterAction = iFilter->getFilterAction((msi.key())); QString tooltip = iFilter->filterInfo(filterAction) + "
" + getDecoratedFileName(filterAction->data().toString()); filterAction->setToolTip(tooltip); //connect(filterAction, SIGNAL(hovered()), this, SLOT(showActionMenuTooltip()) ); connect(filterAction, SIGNAL(triggered()), this, SLOT(startFilter())); int filterClass = iFilter->getClass(filterAction); - if (filterClass & MeshFilterInterface::FaceColoring) + if (filterClass & FilterPluginInterface::FaceColoring) { filterMenuColorize->addAction(filterAction); } - if (filterClass & MeshFilterInterface::VertexColoring) + if (filterClass & FilterPluginInterface::VertexColoring) { filterMenuColorize->addAction(filterAction); } - if (filterClass & MeshFilterInterface::MeshColoring) + if (filterClass & FilterPluginInterface::MeshColoring) { filterMenuColorize->addAction(filterAction); } - if (filterClass & MeshFilterInterface::Selection) + if (filterClass & FilterPluginInterface::Selection) { filterMenuSelect->addAction(filterAction); } - if (filterClass & MeshFilterInterface::Cleaning) + if (filterClass & FilterPluginInterface::Cleaning) { filterMenuClean->addAction(filterAction); } - if (filterClass & MeshFilterInterface::Remeshing) + if (filterClass & FilterPluginInterface::Remeshing) { filterMenuRemeshing->addAction(filterAction); } - if (filterClass & MeshFilterInterface::Smoothing) + if (filterClass & FilterPluginInterface::Smoothing) { filterMenuSmoothing->addAction(filterAction); } - if (filterClass & MeshFilterInterface::Normal) + if (filterClass & FilterPluginInterface::Normal) { filterMenuNormal->addAction(filterAction); } - if (filterClass & MeshFilterInterface::Quality) + if (filterClass & FilterPluginInterface::Quality) { filterMenuQuality->addAction(filterAction); } - if (filterClass & MeshFilterInterface::Measure) + if (filterClass & FilterPluginInterface::Measure) { filterMenuQuality->addAction(filterAction); } - if (filterClass & MeshFilterInterface::Layer) + if (filterClass & FilterPluginInterface::Layer) { filterMenuMeshLayer->addAction(filterAction); } - if (filterClass & MeshFilterInterface::RasterLayer) + if (filterClass & FilterPluginInterface::RasterLayer) { filterMenuRasterLayer->addAction(filterAction); } - if (filterClass & MeshFilterInterface::MeshCreation) + if (filterClass & FilterPluginInterface::MeshCreation) { filterMenuCreate->addAction(filterAction); } - if (filterClass & MeshFilterInterface::RangeMap) + if (filterClass & FilterPluginInterface::RangeMap) { filterMenuRangeMap->addAction(filterAction); } - if (filterClass & MeshFilterInterface::PointSet) + if (filterClass & FilterPluginInterface::PointSet) { filterMenuPointSet->addAction(filterAction); } - if (filterClass & MeshFilterInterface::Sampling) + if (filterClass & FilterPluginInterface::Sampling) { filterMenuSampling->addAction(filterAction); } - if (filterClass & MeshFilterInterface::Texture) + if (filterClass & FilterPluginInterface::Texture) { filterMenuTexture->addAction(filterAction); } - if (filterClass & MeshFilterInterface::Polygonal) + if (filterClass & FilterPluginInterface::Polygonal) { filterMenuPolygonal->addAction(filterAction); } - if (filterClass & MeshFilterInterface::Camera) + if (filterClass & FilterPluginInterface::Camera) { filterMenuCamera->addAction(filterAction); } @@ -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()) { @@ -836,7 +836,7 @@ void MainWindow::fillRenderMenu() qaNone->setCheckable(false); shadersMenu->addAction(qaNone); connect(qaNone, SIGNAL(triggered()), this, SLOT(applyRenderMode())); - foreach(MeshRenderInterface *iRender, PM.meshRenderPlugins()) + foreach(RenderPluginInterface *iRender, PM.meshRenderPlugins()) { addToMenu(iRender->actions(), shadersMenu, SLOT(applyRenderMode())); } @@ -844,7 +844,7 @@ void MainWindow::fillRenderMenu() void MainWindow::fillEditMenu() { - foreach(MeshEditInterfaceFactory *iEditFactory, PM.meshEditFactoryPlugins()) + foreach(EditPluginInterfaceFactory *iEditFactory, PM.meshEditFactoryPlugins()) { foreach(QAction* editAction, iEditFactory->actions()) { @@ -860,8 +860,8 @@ void MainWindow::loadMeshLabSettings() // I have already loaded the plugins so the default parameters for the settings // of the plugins are already in the . // we just miss the globals default of meshlab itself - MainWindowSetting::initGlobalParameterSet(&defaultGlobalParams); - GLArea::initGlobalParameterSet(&defaultGlobalParams); + MainWindowSetting::initGlobalParameterList(&defaultGlobalParams); + GLArea::initGlobalParameterList(&defaultGlobalParams); QSettings settings; QStringList klist = settings.allKeys(); @@ -1002,7 +1002,16 @@ void MainWindow::checkForUpdates(bool verboseFlag) { verboseCheckingFlag = verboseFlag; + bool checkForMonthlyAndBetasVal = false; + const QString checkForMonthlyAndBetasVar("checkForMonthlyAndBetas"); + + QString urlCheck = "https://www.meshlab.net/ML_VERSION"; QSettings settings; + if (settings.contains(checkForMonthlyAndBetasVar)) + checkForMonthlyAndBetasVal = settings.value(checkForMonthlyAndBetasVar).toBool(); + if (checkForMonthlyAndBetasVal){ + urlCheck = "https://github.com/cnr-isti-vclab/meshlab/blob/master/ML_VERSION"; + } int totalKV = settings.value("totalKV", 0).toInt(); int loadedMeshCounter = settings.value("loadedMeshCounter", 0).toInt(); int savedMeshCounter = settings.value("savedMeshCounter", 0).toInt(); @@ -1011,7 +1020,7 @@ void MainWindow::checkForUpdates(bool verboseFlag) UID = QUuid::createUuid().toString(); settings.setValue("UID", UID); } - QString BaseCommand("/~cignoni/meshlab_latest.php"); + QString baseCommand("/~cignoni/meshlab_latest.php"); #ifdef Q_OS_WIN QString OS = "Win"; @@ -1020,13 +1029,13 @@ void MainWindow::checkForUpdates(bool verboseFlag) #else QString OS = "Lin"; #endif - QString message = BaseCommand + QString("?code=%1&count=%2&scount=%3&totkv=%4&ver=%5&os=%6").arg(UID).arg(loadedMeshCounter).arg(savedMeshCounter).arg(totalKV).arg(MeshLabApplication::appVer()).arg(OS); + QString message = baseCommand + QString("?code=%1&count=%2&scount=%3&totkv=%4&ver=%5&os=%6").arg(UID).arg(loadedMeshCounter).arg(savedMeshCounter).arg(totalKV).arg(MeshLabApplication::appVer()).arg(OS); QNetworkAccessManager stats; QNetworkRequest statreq(MeshLabApplication::organizationHost() + message); stats.get(statreq); - QNetworkRequest request(QString("http://www.meshlab.net/ML_VERSION")); + QNetworkRequest request(urlCheck); httpReq.get(request); } @@ -1036,15 +1045,21 @@ void MainWindow::connectionDone(QNetworkReply *reply) QSettings::setDefaultFormat(QSettings::NativeFormat); bool dontRemindMeAboutUpgradeVal = false; + bool checkForMonthlyAndBetasVal = false; const QString dontRemindMeAboutUpgradeVar("dontRemindMeAboutUpgrade"); + const QString checkForMonthlyAndBetasVar("checkForMonthlyAndBetas"); // Check if the user specified not to be reminded to upgrade + if (settings.contains(dontRemindMeAboutUpgradeVar)) + dontRemindMeAboutUpgradeVal = settings.value(dontRemindMeAboutUpgradeVar).toBool(); if (!verboseCheckingFlag) { - if (settings.contains(dontRemindMeAboutUpgradeVar)) - dontRemindMeAboutUpgradeVal = settings.value(dontRemindMeAboutUpgradeVar).toBool(); if (dontRemindMeAboutUpgradeVal) return; } + + if (settings.contains(checkForMonthlyAndBetasVar)){ + checkForMonthlyAndBetasVal = settings.value(checkForMonthlyAndBetasVar).toBool();; + } QByteArray ddata = reply->readAll(); QString onlineVersion = QString::fromStdString(ddata.toStdString()); @@ -1062,6 +1077,12 @@ void MainWindow::connectionDone(QNetworkReply *reply) if (splitOnlineVersion[1].toInt() > splitThisVersion[1].toInt()) { newVersionAvailable = true; } + else if (splitOnlineVersion[1].toInt() == splitThisVersion[1].toInt() && splitOnlineVersion.size() > 2) { + //case of beta version or very important fixes + if (splitThisVersion.size() == 2 || (splitThisVersion.size() > 2 && splitOnlineVersion[2] > splitThisVersion[2])){ + newVersionAvailable = true; + } + } } // Set up a message box for the user @@ -1071,8 +1092,25 @@ void MainWindow::connectionDone(QNetworkReply *reply) QCheckBox dontShowCheckBox("Don't show this message again."); dontShowCheckBox.blockSignals(true); msgBox.addButton(&dontShowCheckBox, QMessageBox::ResetRole); + dontShowCheckBox.setChecked(dontRemindMeAboutUpgradeVal); + QCheckBox checkMonthlysCheckBox("Check for Monthly and Beta versions."); + checkMonthlysCheckBox.blockSignals(true); + msgBox.addButton(&checkMonthlysCheckBox, QMessageBox::ResetRole); + checkMonthlysCheckBox.setChecked(checkForMonthlyAndBetasVal); if (newVersionAvailable){ + QString message = + "
You are using an old version of MeshLab.

" + "Please, upgrade to the new version!

"; + if (checkForMonthlyAndBetasVal){ + message += + " Download
"; + } + else { + message += + " Download"; + } + msgBox.setText( "
You are using an old version of MeshLab.

" "Please, upgrade to the new version!

" @@ -1088,6 +1126,18 @@ void MainWindow::connectionDone(QNetworkReply *reply) int userReply = msgBox.exec(); if (userReply == QMessageBox::Ok && dontShowCheckBox.checkState() == Qt::Checked) settings.setValue(dontRemindMeAboutUpgradeVar, true); + else if (userReply == QMessageBox::Ok && dontShowCheckBox.checkState() == Qt::Unchecked) + settings.setValue(dontRemindMeAboutUpgradeVar, false); + if (userReply == QMessageBox::Ok && checkMonthlysCheckBox.checkState() == Qt::Checked) { + settings.setValue(checkForMonthlyAndBetasVar, true); + if (!checkForMonthlyAndBetasVal) { + //the user changed the states: he now wants to check for betas + //need to check again with properly set + checkForUpdates(false); + } + } + else if (userReply == QMessageBox::Ok && checkMonthlysCheckBox.checkState() == Qt::Unchecked) + settings.setValue(checkForMonthlyAndBetasVar, false); } } @@ -1159,28 +1209,28 @@ int MainWindow::longestActionWidthInAllMenus() return longest; } -void MainWindowSetting::initGlobalParameterSet(RichParameterList* glbset) +void MainWindowSetting::initGlobalParameterList(RichParameterList* gbllist) { - glbset->addParam(RichInt(maximumDedicatedGPUMem(), 350, "Maximum GPU Memory Dedicated to MeshLab (Mb)", "Maximum GPU Memory Dedicated to MeshLab (megabyte) for the storing of the geometry attributes. The dedicated memory must NOT be all the GPU memory presents on the videocard.")); - glbset->addParam(RichInt(perBatchPrimitives(), 100000, "Per batch primitives loaded in GPU", "Per batch primitives (vertices and faces) loaded in the GPU memory. It's used in order to do not overwhelm the system memory with an entire temporary copy of a mesh.")); - glbset->addParam(RichInt(minPolygonNumberPerSmoothRendering(), 50000, "Default Face number per smooth rendering", "Minimum number of faces in order to automatically render a newly created mesh layer with the per vertex normal attribute activated.")); + gbllist->addParam(RichInt(maximumDedicatedGPUMem(), 350, "Maximum GPU Memory Dedicated to MeshLab (Mb)", "Maximum GPU Memory Dedicated to MeshLab (megabyte) for the storing of the geometry attributes. The dedicated memory must NOT be all the GPU memory presents on the videocard.")); + gbllist->addParam(RichInt(perBatchPrimitives(), 100000, "Per batch primitives loaded in GPU", "Per batch primitives (vertices and faces) loaded in the GPU memory. It's used in order to do not overwhelm the system memory with an entire temporary copy of a mesh.")); + gbllist->addParam(RichInt(minPolygonNumberPerSmoothRendering(), 50000, "Default Face number per smooth rendering", "Minimum number of faces in order to automatically render a newly created mesh layer with the per vertex normal attribute activated.")); // glbset->addParam(RichBool(perMeshRenderingToolBar(), true, "Show Per-Mesh Rendering Side ToolBar", "If true the per-mesh rendering side toolbar will be redendered inside the layerdialog.")); if (MeshLabScalarTest::doublePrecision()) - glbset->addParam(RichBool(highPrecisionRendering(), false, "High Precision Rendering", "If true all the models in the scene will be rendered at the center of the world")); - glbset->addParam(RichInt(maxTextureMemoryParam(), 256, "Max Texture Memory (in MB)", "The maximum quantity of texture memory allowed to load mesh textures")); + gbllist->addParam(RichBool(highPrecisionRendering(), false, "High Precision Rendering", "If true all the models in the scene will be rendered at the center of the world")); + gbllist->addParam(RichInt(maxTextureMemoryParam(), 256, "Max Texture Memory (in MB)", "The maximum quantity of texture memory allowed to load mesh textures")); } -void MainWindowSetting::updateGlobalParameterSet(const RichParameterList& rps) +void MainWindowSetting::updateGlobalParameterList(const RichParameterList& rpl) { - maxgpumem = (std::ptrdiff_t)rps.getInt(maximumDedicatedGPUMem()) * (float)(1024 * 1024); - perbatchprimitives = (size_t)rps.getInt(perBatchPrimitives()); - minpolygonpersmoothrendering = (size_t)rps.getInt(minPolygonNumberPerSmoothRendering()); + maxgpumem = (std::ptrdiff_t)rpl.getInt(maximumDedicatedGPUMem()) * (float)(1024 * 1024); + perbatchprimitives = (size_t)rpl.getInt(perBatchPrimitives()); + minpolygonpersmoothrendering = (size_t)rpl.getInt(minPolygonNumberPerSmoothRendering()); highprecision = false; if (MeshLabScalarTest::doublePrecision()) - highprecision = rps.getBool(highPrecisionRendering()); - maxTextureMemory = (std::ptrdiff_t) rps.getInt(this->maxTextureMemoryParam()) * (float)(1024 * 1024); + highprecision = rpl.getBool(highPrecisionRendering()); + maxTextureMemory = (std::ptrdiff_t) rpl.getInt(this->maxTextureMemoryParam()) * (float)(1024 * 1024); } void MainWindow::defaultPerViewRenderingData(MLRenderingData& dt) const diff --git a/src/meshlab/mainwindow_RunTime.cpp b/src/meshlab/mainwindow_RunTime.cpp index 9b2734370..de8bb8787 100644 --- a/src/meshlab/mainwindow_RunTime.cpp +++ b/src/meshlab/mainwindow_RunTime.cpp @@ -39,6 +39,11 @@ #include #include #include +#include +#include +#include +#include +#include #include "../common/meshlabdocumentxml.h" #include "../common/meshlabdocumentbundler.h" @@ -56,61 +61,61 @@ using namespace vcg; void MainWindow::updateRecentFileActions() { - bool activeDoc = (bool) !mdiarea->subWindowList().empty() && mdiarea->currentSubWindow(); - - QSettings settings; - QStringList files = settings.value("recentFileList").toStringList(); - - int numRecentFiles = qMin(files.size(), (int)MAXRECENTFILES); - - for (int i = 0; i < numRecentFiles; ++i) - { - QString text = tr("&%1 %2").arg(i + 1).arg(QFileInfo(files[i]).fileName()); - recentFileActs[i]->setText(text); - recentFileActs[i]->setData(files[i]); - recentFileActs[i]->setEnabled(activeDoc); - } - for (int j = numRecentFiles; j < MAXRECENTFILES; ++j) - recentFileActs[j]->setVisible(false); + bool activeDoc = (bool) !mdiarea->subWindowList().empty() && mdiarea->currentSubWindow(); + + QSettings settings; + QStringList files = settings.value("recentFileList").toStringList(); + + int numRecentFiles = qMin(files.size(), (int)MAXRECENTFILES); + + for (int i = 0; i < numRecentFiles; ++i) + { + QString text = tr("&%1 %2").arg(i + 1).arg(QFileInfo(files[i]).fileName()); + recentFileActs[i]->setText(text); + recentFileActs[i]->setData(files[i]); + recentFileActs[i]->setEnabled(activeDoc); + } + for (int j = numRecentFiles; j < MAXRECENTFILES; ++j) + recentFileActs[j]->setVisible(false); } void MainWindow::updateRecentProjActions() { - //bool activeDoc = (bool) !mdiarea->subWindowList().empty() && mdiarea->currentSubWindow(); - - QSettings settings; - QStringList projs = settings.value("recentProjList").toStringList(); - - int numRecentProjs = qMin(projs.size(), (int)MAXRECENTFILES); - for (int i = 0; i < numRecentProjs; ++i) - { - QString text = tr("&%1 %2").arg(i + 1).arg(QFileInfo(projs[i]).fileName()); - recentProjActs[i]->setText(text); - recentProjActs[i]->setData(projs[i]); - recentProjActs[i]->setEnabled(true); - } - for (int j = numRecentProjs; j < MAXRECENTFILES; ++j) - recentProjActs[j]->setVisible(false); + //bool activeDoc = (bool) !mdiarea->subWindowList().empty() && mdiarea->currentSubWindow(); + + QSettings settings; + QStringList projs = settings.value("recentProjList").toStringList(); + + int numRecentProjs = qMin(projs.size(), (int)MAXRECENTFILES); + for (int i = 0; i < numRecentProjs; ++i) + { + QString text = tr("&%1 %2").arg(i + 1).arg(QFileInfo(projs[i]).fileName()); + recentProjActs[i]->setText(text); + recentProjActs[i]->setData(projs[i]); + recentProjActs[i]->setEnabled(true); + } + for (int j = numRecentProjs; j < MAXRECENTFILES; ++j) + recentProjActs[j]->setVisible(false); } // creates the standard plugin window void MainWindow::createStdPluginWnd() { - //checks if a MeshlabStdDialog is already open and closes it - if (stddialog!=0) - { - stddialog->close(); - delete stddialog; - } - stddialog = new MeshlabStdDialog(this); - stddialog->setAllowedAreas ( Qt::NoDockWidgetArea); - //addDockWidget(Qt::RightDockWidgetArea,stddialog); - - //stddialog->setAttribute(Qt::WA_DeleteOnClose,true); - stddialog->setFloating(true); - stddialog->hide(); - connect(GLA(),SIGNAL(glareaClosed()),this,SLOT(updateStdDialog())); - connect(GLA(),SIGNAL(glareaClosed()),stddialog,SLOT(closeClick())); + //checks if a MeshlabStdDialog is already open and closes it + if (stddialog!=0) + { + stddialog->close(); + delete stddialog; + } + stddialog = new MeshlabStdDialog(this); + stddialog->setAllowedAreas ( Qt::NoDockWidgetArea); + //addDockWidget(Qt::RightDockWidgetArea,stddialog); + + //stddialog->setAttribute(Qt::WA_DeleteOnClose,true); + stddialog->setFloating(true); + stddialog->hide(); + connect(GLA(),SIGNAL(glareaClosed()),this,SLOT(updateStdDialog())); + connect(GLA(),SIGNAL(glareaClosed()),stddialog,SLOT(closeClick())); } // When we switch the current model (and we change the active window) @@ -118,125 +123,125 @@ void MainWindow::createStdPluginWnd() // this one is called when user switch current window. void MainWindow::updateStdDialog() { - if(stddialog!=0){ - if(GLA()!=0){ - if(stddialog->curModel != meshDoc()->mm()){ - stddialog->curgla=0; // invalidate the curgla member that is no more valid. - stddialog->close(); - } - } - } + if(stddialog!=0){ + if(GLA()!=0){ + if(stddialog->curModel != meshDoc()->mm()){ + stddialog->curgla=0; // invalidate the curgla member that is no more valid. + stddialog->close(); + } + } + } } void MainWindow::updateCustomSettings() { - mwsettings.updateGlobalParameterSet(currentGlobalParams); - emit dispatchCustomSettings(currentGlobalParams); + mwsettings.updateGlobalParameterList(currentGlobalParams); + emit dispatchCustomSettings(currentGlobalParams); } void MainWindow::updateWindowMenu() { - windowsMenu->clear(); - windowsMenu->addAction(closeAllAct); - windowsMenu->addSeparator(); - windowsMenu->addAction(windowsTileAct); - windowsMenu->addAction(windowsCascadeAct); - windowsMenu->addAction(windowsNextAct); - windowsNextAct->setEnabled(mdiarea-> subWindowList().size()>1); - - windowsMenu->addSeparator(); - - - if((mdiarea-> subWindowList().size()>0)){ - // Split/Unsplit SUBmenu - splitModeMenu = windowsMenu->addMenu(tr("&Split current view")); - - splitModeMenu->addAction(setSplitHAct); - splitModeMenu->addAction(setSplitVAct); - - windowsMenu->addAction(setUnsplitAct); - - // Link act - windowsMenu->addAction(linkViewersAct); - - // View From SUBmenu - viewFromMenu = windowsMenu->addMenu(tr("&View from")); - foreach(QAction *ac, viewFromGroupAct->actions()) - viewFromMenu->addAction(ac); - + windowsMenu->clear(); + windowsMenu->addAction(closeAllAct); + windowsMenu->addSeparator(); + windowsMenu->addAction(windowsTileAct); + windowsMenu->addAction(windowsCascadeAct); + windowsMenu->addAction(windowsNextAct); + windowsNextAct->setEnabled(mdiarea-> subWindowList().size()>1); + + windowsMenu->addSeparator(); + + + if((mdiarea-> subWindowList().size()>0)){ + // Split/Unsplit SUBmenu + splitModeMenu = windowsMenu->addMenu(tr("&Split current view")); + + splitModeMenu->addAction(setSplitHAct); + splitModeMenu->addAction(setSplitVAct); + + windowsMenu->addAction(setUnsplitAct); + + // Link act + windowsMenu->addAction(linkViewersAct); + + // View From SUBmenu + viewFromMenu = windowsMenu->addMenu(tr("&View from")); + foreach(QAction *ac, viewFromGroupAct->actions()) + viewFromMenu->addAction(ac); + // Trackball Step SUBmenu trackballStepMenu = windowsMenu->addMenu(tr("Trackball step")); foreach(QAction *ac, trackballStepGroupAct->actions()) trackballStepMenu->addAction(ac); - - // View From File act - windowsMenu->addAction(readViewFromFileAct); - windowsMenu->addAction(saveViewToFileAct); - windowsMenu->addAction(viewFromMeshAct); - windowsMenu->addAction(viewFromRasterAct); - - // Copy and paste shot acts - windowsMenu->addAction(copyShotToClipboardAct); - windowsMenu->addAction(pasteShotFromClipboardAct); - - //Enabling the actions - MultiViewer_Container *mvc = currentViewContainer(); - if(mvc) - { - setUnsplitAct->setEnabled(mvc->viewerCounter()>1); - GLArea* current = mvc->currentView(); - if(current) - { - setSplitHAct->setEnabled(current->size().height()/2 > current->minimumSizeHint().height()); - setSplitVAct->setEnabled(current->size().width()/2 > current->minimumSizeHint().width()); - - linkViewersAct->setEnabled(currentViewContainer()->viewerCounter()>1); - if(currentViewContainer()->viewerCounter()==1) - linkViewersAct->setChecked(false); - - windowsMenu->addSeparator(); - } - } - } - - QList windows = mdiarea->subWindowList(); - - if(windows.size() > 0) - windowsMenu->addSeparator(); - - int i=0; - foreach(QWidget *w,windows) - { - QString text = tr("&%1. %2").arg(i+1).arg(QFileInfo(w->windowTitle()).fileName()); - QAction *action = windowsMenu->addAction(text); - action->setCheckable(true); - action->setChecked(w == mdiarea->currentSubWindow()); - // Connect the signal to activate the selected window - connect(action, SIGNAL(triggered()), windowMapper, SLOT(map())); - windowMapper->setMapping(action, w); - ++i; - } + + // View From File act + windowsMenu->addAction(readViewFromFileAct); + windowsMenu->addAction(saveViewToFileAct); + windowsMenu->addAction(viewFromMeshAct); + windowsMenu->addAction(viewFromRasterAct); + + // Copy and paste shot acts + windowsMenu->addAction(copyShotToClipboardAct); + windowsMenu->addAction(pasteShotFromClipboardAct); + + //Enabling the actions + MultiViewer_Container *mvc = currentViewContainer(); + if(mvc) + { + setUnsplitAct->setEnabled(mvc->viewerCounter()>1); + GLArea* current = mvc->currentView(); + if(current) + { + setSplitHAct->setEnabled(current->size().height()/2 > current->minimumSizeHint().height()); + setSplitVAct->setEnabled(current->size().width()/2 > current->minimumSizeHint().width()); + + linkViewersAct->setEnabled(currentViewContainer()->viewerCounter()>1); + if(currentViewContainer()->viewerCounter()==1) + linkViewersAct->setChecked(false); + + windowsMenu->addSeparator(); + } + } + } + + QList windows = mdiarea->subWindowList(); + + if(windows.size() > 0) + windowsMenu->addSeparator(); + + int i=0; + foreach(QWidget *w,windows) + { + QString text = tr("&%1. %2").arg(i+1).arg(QFileInfo(w->windowTitle()).fileName()); + QAction *action = windowsMenu->addAction(text); + action->setCheckable(true); + action->setChecked(w == mdiarea->currentSubWindow()); + // Connect the signal to activate the selected window + connect(action, SIGNAL(triggered()), windowMapper, SLOT(map())); + windowMapper->setMapping(action, w); + ++i; + } } void MainWindow::enableDocumentSensibleActionsContainer(const bool allowed) { - QAction* fileact = fileMenu->menuAction(); - if (fileact != NULL) - fileact->setEnabled(allowed); - if (mainToolBar != NULL) - mainToolBar->setEnabled(allowed); - if (searchToolBar != NULL) - searchToolBar->setEnabled(allowed); - QAction* filtact = filterMenu->menuAction(); - if (filtact != NULL) - filtact->setEnabled(allowed); - if (filterToolBar != NULL) - filterToolBar->setEnabled(allowed); - QAction* editact = editMenu->menuAction(); - if (editact != NULL) - editact->setEnabled(allowed); - if (editToolBar) - editToolBar->setEnabled(allowed); + QAction* fileact = fileMenu->menuAction(); + if (fileact != NULL) + fileact->setEnabled(allowed); + if (mainToolBar != NULL) + mainToolBar->setEnabled(allowed); + if (searchToolBar != NULL) + searchToolBar->setEnabled(allowed); + QAction* filtact = filterMenu->menuAction(); + if (filtact != NULL) + filtact->setEnabled(allowed); + if (filterToolBar != NULL) + filterToolBar->setEnabled(allowed); + QAction* editact = editMenu->menuAction(); + if (editact != NULL) + editact->setEnabled(allowed); + if (editToolBar) + editToolBar->setEnabled(allowed); } @@ -244,401 +249,401 @@ void MainWindow::enableDocumentSensibleActionsContainer(const bool allowed) //menu create is not enabled only in case of not valid/existing meshdocument void MainWindow::updateSubFiltersMenu( const bool createmenuenabled,const bool validmeshdoc ) { - showFilterScriptAct->setEnabled(validmeshdoc); - filterMenuSelect->setEnabled(validmeshdoc); - updateMenuItems(filterMenuSelect,validmeshdoc); - filterMenuClean->setEnabled(validmeshdoc); - updateMenuItems(filterMenuClean,validmeshdoc); - filterMenuCreate->setEnabled(createmenuenabled || validmeshdoc); - updateMenuItems(filterMenuCreate,createmenuenabled || validmeshdoc); - filterMenuRemeshing->setEnabled(validmeshdoc); - updateMenuItems(filterMenuRemeshing,validmeshdoc); - filterMenuPolygonal->setEnabled(validmeshdoc); - updateMenuItems(filterMenuPolygonal,validmeshdoc); - filterMenuColorize->setEnabled(validmeshdoc); - updateMenuItems(filterMenuColorize,validmeshdoc); - filterMenuSmoothing->setEnabled(validmeshdoc); - updateMenuItems(filterMenuSmoothing,validmeshdoc); - filterMenuQuality->setEnabled(validmeshdoc); - updateMenuItems(filterMenuQuality,validmeshdoc); - filterMenuNormal->setEnabled(validmeshdoc); - updateMenuItems(filterMenuNormal,validmeshdoc); - filterMenuMeshLayer->setEnabled(validmeshdoc); - updateMenuItems(filterMenuMeshLayer,validmeshdoc); - filterMenuRasterLayer->setEnabled(validmeshdoc); - updateMenuItems(filterMenuRasterLayer,validmeshdoc); - filterMenuRangeMap->setEnabled(validmeshdoc); - updateMenuItems(filterMenuRangeMap,validmeshdoc); - filterMenuPointSet->setEnabled(validmeshdoc); - updateMenuItems(filterMenuPointSet,validmeshdoc); - filterMenuSampling->setEnabled(validmeshdoc); - updateMenuItems(filterMenuSampling,validmeshdoc); - filterMenuTexture->setEnabled(validmeshdoc); - updateMenuItems(filterMenuTexture,validmeshdoc); - filterMenuCamera->setEnabled(validmeshdoc); - updateMenuItems(filterMenuCamera,validmeshdoc); - + showFilterScriptAct->setEnabled(validmeshdoc); + filterMenuSelect->setEnabled(validmeshdoc); + updateMenuItems(filterMenuSelect,validmeshdoc); + filterMenuClean->setEnabled(validmeshdoc); + updateMenuItems(filterMenuClean,validmeshdoc); + filterMenuCreate->setEnabled(createmenuenabled || validmeshdoc); + updateMenuItems(filterMenuCreate,createmenuenabled || validmeshdoc); + filterMenuRemeshing->setEnabled(validmeshdoc); + updateMenuItems(filterMenuRemeshing,validmeshdoc); + filterMenuPolygonal->setEnabled(validmeshdoc); + updateMenuItems(filterMenuPolygonal,validmeshdoc); + filterMenuColorize->setEnabled(validmeshdoc); + updateMenuItems(filterMenuColorize,validmeshdoc); + filterMenuSmoothing->setEnabled(validmeshdoc); + updateMenuItems(filterMenuSmoothing,validmeshdoc); + filterMenuQuality->setEnabled(validmeshdoc); + updateMenuItems(filterMenuQuality,validmeshdoc); + filterMenuNormal->setEnabled(validmeshdoc); + updateMenuItems(filterMenuNormal,validmeshdoc); + filterMenuMeshLayer->setEnabled(validmeshdoc); + updateMenuItems(filterMenuMeshLayer,validmeshdoc); + filterMenuRasterLayer->setEnabled(validmeshdoc); + updateMenuItems(filterMenuRasterLayer,validmeshdoc); + filterMenuRangeMap->setEnabled(validmeshdoc); + updateMenuItems(filterMenuRangeMap,validmeshdoc); + filterMenuPointSet->setEnabled(validmeshdoc); + updateMenuItems(filterMenuPointSet,validmeshdoc); + filterMenuSampling->setEnabled(validmeshdoc); + updateMenuItems(filterMenuSampling,validmeshdoc); + filterMenuTexture->setEnabled(validmeshdoc); + updateMenuItems(filterMenuTexture,validmeshdoc); + filterMenuCamera->setEnabled(validmeshdoc); + updateMenuItems(filterMenuCamera,validmeshdoc); + } void MainWindow::updateMenuItems(QMenu* menu,const bool enabled) { - foreach(QAction* act,menu->actions()) - act->setEnabled(enabled); + foreach(QAction* act,menu->actions()) + act->setEnabled(enabled); } void MainWindow::switchOffDecorator(QAction* decorator) { - if (GLA() != NULL) - { - int res = GLA()->iCurPerMeshDecoratorList().removeAll(decorator); - if (res == 0) - GLA()->iPerDocDecoratorlist.removeAll(decorator); - updateMenus(); + if (GLA() != NULL) + { + int res = GLA()->iCurPerMeshDecoratorList().removeAll(decorator); + if (res == 0) + GLA()->iPerDocDecoratorlist.removeAll(decorator); + updateMenus(); layerDialog->updateDecoratorParsView(); - GLA()->update(); - } + GLA()->update(); + } } void MainWindow::updateLayerDialog() { if ((meshDoc() == NULL) || ((layerDialog != NULL) && !(layerDialog->isVisible()))) return; - MultiViewer_Container* mvc = currentViewContainer(); - if (mvc == NULL) - return; - MLSceneGLSharedDataContext* shared = mvc->sharedDataContext(); - if (shared == NULL) - return; - if(GLA()) - { - MLSceneGLSharedDataContext::PerMeshRenderingDataMap dtf; - shared->getRenderInfoPerMeshView(GLA()->context(),dtf); + MultiViewer_Container* mvc = currentViewContainer(); + if (mvc == NULL) + return; + MLSceneGLSharedDataContext* shared = mvc->sharedDataContext(); + if (shared == NULL) + return; + if(GLA()) + { + MLSceneGLSharedDataContext::PerMeshRenderingDataMap dtf; + shared->getRenderInfoPerMeshView(GLA()->context(),dtf); /*Add to the table the info for the per view global rendering of the Project*/ MLRenderingData projdt; //GLA()->getPerDocGlobalRenderingData(projdt); dtf[-1] = projdt; - layerDialog->updateTable(dtf); - layerDialog->updateLog(meshDoc()->Log); - layerDialog->updateDecoratorParsView(); - MLRenderingData dt; - if (meshDoc()->mm() != NULL) + layerDialog->updateTable(dtf); + layerDialog->updateLog(meshDoc()->Log); + layerDialog->updateDecoratorParsView(); + MLRenderingData dt; + if (meshDoc()->mm() != NULL) { MLSceneGLSharedDataContext::PerMeshRenderingDataMap::iterator it = dtf.find(meshDoc()->mm()->id()); if (it != dtf.end()) layerDialog->updateRenderingParametersTab(meshDoc()->mm()->id(),*it); - } + } if (globrendtoolbar != NULL) { shared->getRenderInfoPerMeshView(GLA()->context(), dtf); globrendtoolbar->statusConsistencyCheck(dtf); } - } + } } void MainWindow::updateMenus() { - - bool activeDoc = !(mdiarea->subWindowList().empty()) && (mdiarea->currentSubWindow() != NULL); - bool notEmptyActiveDoc = activeDoc && (meshDoc() != NULL) && !(meshDoc()->meshList.empty()); - + + bool activeDoc = !(mdiarea->subWindowList().empty()) && (mdiarea->currentSubWindow() != NULL); + bool notEmptyActiveDoc = activeDoc && (meshDoc() != NULL) && !(meshDoc()->meshList.empty()); + //std::cout << "SubWindowsList empty: " << mdiarea->subWindowList().empty() << " Valid Current Sub Windows: " << (mdiarea->currentSubWindow() != NULL) << " MeshList empty: " << meshDoc()->meshList.empty() << "\n"; - - importMeshAct->setEnabled(activeDoc); - - exportMeshAct->setEnabled(notEmptyActiveDoc); - exportMeshAsAct->setEnabled(notEmptyActiveDoc); - reloadMeshAct->setEnabled(notEmptyActiveDoc); - reloadAllMeshAct->setEnabled(notEmptyActiveDoc); - importRasterAct->setEnabled(activeDoc); - - saveProjectAct->setEnabled(activeDoc); - closeProjectAct->setEnabled(activeDoc); - - saveSnapshotAct->setEnabled(activeDoc); - - updateRecentFileActions(); - updateRecentProjActions(); - filterMenu->setEnabled(!filterMenu->actions().isEmpty()); - if (!filterMenu->actions().isEmpty()) - updateSubFiltersMenu(GLA() != NULL,notEmptyActiveDoc); - lastFilterAct->setEnabled(false); - lastFilterAct->setText(QString("Apply filter")); - editMenu->setEnabled(!editMenu->actions().isEmpty()); - updateMenuItems(editMenu,activeDoc); - renderMenu->setEnabled(!renderMenu->actions().isEmpty()); - updateMenuItems(renderMenu,activeDoc); - fullScreenAct->setEnabled(activeDoc); - showLayerDlgAct->setEnabled(activeDoc); - showTrackBallAct->setEnabled(activeDoc); - resetTrackBallAct->setEnabled(activeDoc); - showInfoPaneAct->setEnabled(activeDoc); - windowsMenu->setEnabled(activeDoc); - preferencesMenu->setEnabled(activeDoc); - - showToolbarStandardAct->setChecked(mainToolBar->isVisible()); - if(activeDoc && GLA()) - { - if(GLA()->getLastAppliedFilter() != NULL) - { - lastFilterAct->setText(QString("Apply filter ") + GLA()->getLastAppliedFilter()->text()); - lastFilterAct->setEnabled(true); - } - - // Management of the editing toolbar - // when you enter in a editing mode you can toggle between editing - // and camera moving by esc; - // you exit from editing mode by pressing again the editing button - // When you are in a editing mode all the other editing are disabled. - - foreach (QAction *a,PM.editActionList) - { - a->setChecked(false); - a->setEnabled( GLA()->getCurrentEditAction() == NULL ); - } - - suspendEditModeAct->setChecked(GLA()->suspendedEditor); - suspendEditModeAct->setDisabled(GLA()->getCurrentEditAction() == NULL); - - if(GLA()->getCurrentEditAction()) - { - GLA()->getCurrentEditAction()->setChecked(! GLA()->suspendedEditor); - GLA()->getCurrentEditAction()->setEnabled(true); - } - - showInfoPaneAct->setChecked(GLA()->infoAreaVisible); - showTrackBallAct->setChecked(GLA()->isTrackBallVisible()); - - // Decorator Menu Checking and unChecking - // First uncheck and disable all the decorators - foreach (QAction *a, PM.decoratorActionList) - { - a->setChecked(false); - a->setEnabled(true); - } - // Check the decorator per Document of the current glarea - foreach (QAction *a, GLA()->iPerDocDecoratorlist) - { a ->setChecked(true); } - - // Then check the decorator enabled for the current mesh. - if(GLA()->mm()) - foreach (QAction *a, GLA()->iCurPerMeshDecoratorList()) - a ->setChecked(true); - } // if active - else - { - foreach (QAction *a,PM.editActionList) - { - a->setEnabled(false); - } - foreach (QAction *a,PM.decoratorActionList) - a->setEnabled(false); - - } + + importMeshAct->setEnabled(activeDoc); + + exportMeshAct->setEnabled(notEmptyActiveDoc); + exportMeshAsAct->setEnabled(notEmptyActiveDoc); + reloadMeshAct->setEnabled(notEmptyActiveDoc); + reloadAllMeshAct->setEnabled(notEmptyActiveDoc); + importRasterAct->setEnabled(activeDoc); + + saveProjectAct->setEnabled(activeDoc); + closeProjectAct->setEnabled(activeDoc); + + saveSnapshotAct->setEnabled(activeDoc); + + updateRecentFileActions(); + updateRecentProjActions(); + filterMenu->setEnabled(!filterMenu->actions().isEmpty()); + if (!filterMenu->actions().isEmpty()) + updateSubFiltersMenu(GLA() != NULL,notEmptyActiveDoc); + lastFilterAct->setEnabled(false); + lastFilterAct->setText(QString("Apply filter")); + editMenu->setEnabled(!editMenu->actions().isEmpty()); + updateMenuItems(editMenu,activeDoc); + renderMenu->setEnabled(!renderMenu->actions().isEmpty()); + updateMenuItems(renderMenu,activeDoc); + fullScreenAct->setEnabled(activeDoc); + showLayerDlgAct->setEnabled(activeDoc); + showTrackBallAct->setEnabled(activeDoc); + resetTrackBallAct->setEnabled(activeDoc); + showInfoPaneAct->setEnabled(activeDoc); + windowsMenu->setEnabled(activeDoc); + preferencesMenu->setEnabled(activeDoc); + + showToolbarStandardAct->setChecked(mainToolBar->isVisible()); + if(activeDoc && GLA()) + { + if(GLA()->getLastAppliedFilter() != NULL) + { + lastFilterAct->setText(QString("Apply filter ") + GLA()->getLastAppliedFilter()->text()); + lastFilterAct->setEnabled(true); + } + + // Management of the editing toolbar + // when you enter in a editing mode you can toggle between editing + // and camera moving by esc; + // you exit from editing mode by pressing again the editing button + // When you are in a editing mode all the other editing are disabled. + + foreach (QAction *a,PM.editActionList) + { + a->setChecked(false); + a->setEnabled( GLA()->getCurrentEditAction() == NULL ); + } + + suspendEditModeAct->setChecked(GLA()->suspendedEditor); + suspendEditModeAct->setDisabled(GLA()->getCurrentEditAction() == NULL); + + if(GLA()->getCurrentEditAction()) + { + GLA()->getCurrentEditAction()->setChecked(! GLA()->suspendedEditor); + GLA()->getCurrentEditAction()->setEnabled(true); + } + + showInfoPaneAct->setChecked(GLA()->infoAreaVisible); + showTrackBallAct->setChecked(GLA()->isTrackBallVisible()); + + // Decorator Menu Checking and unChecking + // First uncheck and disable all the decorators + foreach (QAction *a, PM.decoratorActionList) + { + a->setChecked(false); + a->setEnabled(true); + } + // Check the decorator per Document of the current glarea + foreach (QAction *a, GLA()->iPerDocDecoratorlist) + { a ->setChecked(true); } + + // Then check the decorator enabled for the current mesh. + if(GLA()->mm()) + foreach (QAction *a, GLA()->iCurPerMeshDecoratorList()) + a ->setChecked(true); + } // if active + else + { + foreach (QAction *a,PM.editActionList) + { + a->setEnabled(false); + } + foreach (QAction *a,PM.decoratorActionList) + a->setEnabled(false); + + } GLArea* tmp = GLA(); - if(tmp != NULL) - { - showLayerDlgAct->setChecked(layerDialog->isVisible()); - showRasterAct->setEnabled((meshDoc() != NULL) && (meshDoc()->rm() != 0)); - showRasterAct->setChecked(tmp->isRaster()); - } - else - { - foreach (QAction *a,PM.decoratorActionList) - { - a->setChecked(false); - a->setEnabled(false); - } - - - layerDialog->setVisible(false); - } - if (searchMenu != NULL) - searchMenu->searchLineWidth() = longestActionWidthInAllMenus(); - updateWindowMenu(); + if(tmp != NULL) + { + showLayerDlgAct->setChecked(layerDialog->isVisible()); + showRasterAct->setEnabled((meshDoc() != NULL) && (meshDoc()->rm() != 0)); + showRasterAct->setChecked(tmp->isRaster()); + } + else + { + foreach (QAction *a,PM.decoratorActionList) + { + a->setChecked(false); + a->setEnabled(false); + } + + + layerDialog->setVisible(false); + } + if (searchMenu != NULL) + searchMenu->searchLineWidth() = longestActionWidthInAllMenus(); + updateWindowMenu(); } void MainWindow::setSplit(QAction *qa) { - MultiViewer_Container *mvc = currentViewContainer(); - if(mvc) - { - GLArea *glwClone=new GLArea(this, mvc, ¤tGlobalParams); + MultiViewer_Container *mvc = currentViewContainer(); + if(mvc) + { + GLArea *glwClone=new GLArea(this, mvc, ¤tGlobalParams); //connect(glwClone, SIGNAL(insertRenderingDataForNewlyGeneratedMesh(int)), this, SLOT(addRenderingDataIfNewlyGeneratedMesh(int))); - if(qa->text() == tr("&Horizontally")) - mvc->addView(glwClone,Qt::Vertical); - else if(qa->text() == tr("&Vertically")) - mvc->addView(glwClone,Qt::Horizontal); - - //The loading of the raster must be here - if(GLA()->isRaster()) - { - glwClone->setIsRaster(true); - if(this->meshDoc()->rm()->id()>=0) - glwClone->loadRaster(this->meshDoc()->rm()->id()); - } - - updateMenus(); - - glwClone->resetTrackBall(); - glwClone->update(); - } - + if(qa->text() == tr("&Horizontally")) + mvc->addView(glwClone,Qt::Vertical); + else if(qa->text() == tr("&Vertically")) + mvc->addView(glwClone,Qt::Horizontal); + + //The loading of the raster must be here + if(GLA()->isRaster()) + { + glwClone->setIsRaster(true); + if(this->meshDoc()->rm()->id()>=0) + glwClone->loadRaster(this->meshDoc()->rm()->id()); + } + + updateMenus(); + + glwClone->resetTrackBall(); + glwClone->update(); + } + } void MainWindow::setUnsplit() { - MultiViewer_Container *mvc = currentViewContainer(); - if(mvc) - { - assert(mvc->viewerCounter() >1); - - mvc->removeView(mvc->currentView()->getId()); - - updateMenus(); - } + MultiViewer_Container *mvc = currentViewContainer(); + if(mvc) + { + assert(mvc->viewerCounter() >1); + + mvc->removeView(mvc->currentView()->getId()); + + updateMenus(); + } } //set the split/unsplit menu that appears right clicking on a splitter's handle void MainWindow::setHandleMenu(QPoint point, Qt::Orientation orientation, QSplitter *origin) { - MultiViewer_Container *mvc = currentViewContainer(); - int epsilon =10; - splitMenu->clear(); - unSplitMenu->clear(); - //the viewer to split/unsplit is chosen through picking - - //Vertical handle allows to split horizontally - if(orientation == Qt::Vertical) - { - splitUpAct->setData(point); - splitDownAct->setData(point); - - //check if the viewer on the top is splittable according to its size - int pickingId = mvc->getViewerByPicking(QPoint(point.x(), point.y()-epsilon)); - if(pickingId>=0) - splitUpAct->setEnabled(mvc->getViewer(pickingId)->size().width()/2 > mvc->getViewer(pickingId)->minimumSizeHint().width()); - - //the viewer on top can be closed only if the splitter over the handle that originated the event has one child - bool unSplittabilityUp = true; - Splitter * upSplitter = qobject_cast(origin->widget(0)); - if(upSplitter) - unSplittabilityUp = !(upSplitter->count()>1); - unsplitUpAct->setEnabled(unSplittabilityUp); - - //check if the viewer below is splittable according to its size - pickingId = mvc->getViewerByPicking(QPoint(point.x(), point.y()+epsilon)); - if(pickingId>=0) - splitDownAct->setEnabled(mvc->getViewer(pickingId)->size().width()/2 > mvc->getViewer(pickingId)->minimumSizeHint().width()); - - //the viewer below can be closed only if the splitter ounder the handle that originated the event has one child - bool unSplittabilityDown = true; - Splitter * downSplitter = qobject_cast(origin->widget(1)); - if(downSplitter) - unSplittabilityDown = !(downSplitter->count()>1); - unsplitDownAct->setEnabled(unSplittabilityDown); - - splitMenu->addAction(splitUpAct); - splitMenu->addAction(splitDownAct); - - unsplitUpAct->setData(point); - unsplitDownAct->setData(point); - - unSplitMenu->addAction(unsplitUpAct); - unSplitMenu->addAction(unsplitDownAct); - } - //Horizontal handle allows to split vertically - else if (orientation == Qt::Horizontal) - { - splitRightAct->setData(point); - splitLeftAct->setData(point); - - //check if the viewer on the right is splittable according to its size - int pickingId =mvc->getViewerByPicking(QPoint(point.x()+epsilon, point.y())); - if(pickingId>=0) - splitRightAct->setEnabled(mvc->getViewer(pickingId)->size().height()/2 > mvc->getViewer(pickingId)->minimumSizeHint().height()); - - //the viewer on the right can be closed only if the splitter on the right the handle that originated the event has one child - bool unSplittabilityRight = true; - Splitter * rightSplitter = qobject_cast(origin->widget(1)); - if(rightSplitter) - unSplittabilityRight = !(rightSplitter->count()>1); - unsplitRightAct->setEnabled(unSplittabilityRight); - - //check if the viewer on the left is splittable according to its size - pickingId =mvc->getViewerByPicking(QPoint(point.x()-epsilon, point.y())); - if(pickingId>=0) - splitLeftAct->setEnabled(mvc->getViewer(pickingId)->size().height()/2 > mvc->getViewer(pickingId)->minimumSizeHint().height()); - - //the viewer on the left can be closed only if the splitter on the left of the handle that originated the event has one child - bool unSplittabilityLeft = true; - Splitter * leftSplitter = qobject_cast(origin->widget(0)); - if(leftSplitter) - unSplittabilityLeft = !(leftSplitter->count()>1); - unsplitLeftAct->setEnabled(unSplittabilityLeft); - - splitMenu->addAction(splitRightAct); - splitMenu->addAction(splitLeftAct); - - unsplitRightAct->setData(point); - unsplitLeftAct->setData(point); - - unSplitMenu->addAction(unsplitRightAct); - unSplitMenu->addAction(unsplitLeftAct); - } - handleMenu->popup(point); + MultiViewer_Container *mvc = currentViewContainer(); + int epsilon =10; + splitMenu->clear(); + unSplitMenu->clear(); + //the viewer to split/unsplit is chosen through picking + + //Vertical handle allows to split horizontally + if(orientation == Qt::Vertical) + { + splitUpAct->setData(point); + splitDownAct->setData(point); + + //check if the viewer on the top is splittable according to its size + int pickingId = mvc->getViewerByPicking(QPoint(point.x(), point.y()-epsilon)); + if(pickingId>=0) + splitUpAct->setEnabled(mvc->getViewer(pickingId)->size().width()/2 > mvc->getViewer(pickingId)->minimumSizeHint().width()); + + //the viewer on top can be closed only if the splitter over the handle that originated the event has one child + bool unSplittabilityUp = true; + Splitter * upSplitter = qobject_cast(origin->widget(0)); + if(upSplitter) + unSplittabilityUp = !(upSplitter->count()>1); + unsplitUpAct->setEnabled(unSplittabilityUp); + + //check if the viewer below is splittable according to its size + pickingId = mvc->getViewerByPicking(QPoint(point.x(), point.y()+epsilon)); + if(pickingId>=0) + splitDownAct->setEnabled(mvc->getViewer(pickingId)->size().width()/2 > mvc->getViewer(pickingId)->minimumSizeHint().width()); + + //the viewer below can be closed only if the splitter ounder the handle that originated the event has one child + bool unSplittabilityDown = true; + Splitter * downSplitter = qobject_cast(origin->widget(1)); + if(downSplitter) + unSplittabilityDown = !(downSplitter->count()>1); + unsplitDownAct->setEnabled(unSplittabilityDown); + + splitMenu->addAction(splitUpAct); + splitMenu->addAction(splitDownAct); + + unsplitUpAct->setData(point); + unsplitDownAct->setData(point); + + unSplitMenu->addAction(unsplitUpAct); + unSplitMenu->addAction(unsplitDownAct); + } + //Horizontal handle allows to split vertically + else if (orientation == Qt::Horizontal) + { + splitRightAct->setData(point); + splitLeftAct->setData(point); + + //check if the viewer on the right is splittable according to its size + int pickingId =mvc->getViewerByPicking(QPoint(point.x()+epsilon, point.y())); + if(pickingId>=0) + splitRightAct->setEnabled(mvc->getViewer(pickingId)->size().height()/2 > mvc->getViewer(pickingId)->minimumSizeHint().height()); + + //the viewer on the right can be closed only if the splitter on the right the handle that originated the event has one child + bool unSplittabilityRight = true; + Splitter * rightSplitter = qobject_cast(origin->widget(1)); + if(rightSplitter) + unSplittabilityRight = !(rightSplitter->count()>1); + unsplitRightAct->setEnabled(unSplittabilityRight); + + //check if the viewer on the left is splittable according to its size + pickingId =mvc->getViewerByPicking(QPoint(point.x()-epsilon, point.y())); + if(pickingId>=0) + splitLeftAct->setEnabled(mvc->getViewer(pickingId)->size().height()/2 > mvc->getViewer(pickingId)->minimumSizeHint().height()); + + //the viewer on the left can be closed only if the splitter on the left of the handle that originated the event has one child + bool unSplittabilityLeft = true; + Splitter * leftSplitter = qobject_cast(origin->widget(0)); + if(leftSplitter) + unSplittabilityLeft = !(leftSplitter->count()>1); + unsplitLeftAct->setEnabled(unSplittabilityLeft); + + splitMenu->addAction(splitRightAct); + splitMenu->addAction(splitLeftAct); + + unsplitRightAct->setData(point); + unsplitLeftAct->setData(point); + + unSplitMenu->addAction(unsplitRightAct); + unSplitMenu->addAction(unsplitLeftAct); + } + handleMenu->popup(point); } void MainWindow::splitFromHandle(QAction *qa ) { - MultiViewer_Container *mvc = currentViewContainer(); - QPoint point = qa->data().toPoint(); - int epsilon =10; - - if(qa->text() == tr("&Right")) - point.setX(point.x()+ epsilon); - else if(qa->text() == tr("&Left")) - point.setX(point.x()- epsilon); - else if(qa->text() == tr("&Up")) - point.setY(point.y()- epsilon); - else if(qa->text() == tr("&Down")) - point.setY(point.y()+ epsilon); - - int newCurrent = mvc->getViewerByPicking(point); - mvc->updateCurrent(newCurrent); - - if(qa->text() == tr("&Right") || qa->text() == tr("&Left")) - setSplit(new QAction(tr("&Horizontally"), this)); - else - setSplit( new QAction(tr("&Vertically"), this)); + MultiViewer_Container *mvc = currentViewContainer(); + QPoint point = qa->data().toPoint(); + int epsilon =10; + + if(qa->text() == tr("&Right")) + point.setX(point.x()+ epsilon); + else if(qa->text() == tr("&Left")) + point.setX(point.x()- epsilon); + else if(qa->text() == tr("&Up")) + point.setY(point.y()- epsilon); + else if(qa->text() == tr("&Down")) + point.setY(point.y()+ epsilon); + + int newCurrent = mvc->getViewerByPicking(point); + mvc->updateCurrent(newCurrent); + + if(qa->text() == tr("&Right") || qa->text() == tr("&Left")) + setSplit(new QAction(tr("&Horizontally"), this)); + else + setSplit( new QAction(tr("&Vertically"), this)); } void MainWindow::unsplitFromHandle(QAction * qa) { - MultiViewer_Container *mvc = currentViewContainer(); - - QPoint point = qa->data().toPoint(); - int epsilon =10; - - if(qa->text() == tr("&Right")) - point.setX(point.x()+ epsilon); - else if(qa->text() == tr("&Left")) - point.setX(point.x()- epsilon); - else if(qa->text() == tr("&Up")) - point.setY(point.y()- epsilon); - else if(qa->text() == tr("&Down")) - point.setY(point.y()+ epsilon); - - int newCurrent = mvc->getViewerByPicking(point); - mvc->updateCurrent(newCurrent); - - setUnsplit(); + MultiViewer_Container *mvc = currentViewContainer(); + + QPoint point = qa->data().toPoint(); + int epsilon =10; + + if(qa->text() == tr("&Right")) + point.setX(point.x()+ epsilon); + else if(qa->text() == tr("&Left")) + point.setX(point.x()- epsilon); + else if(qa->text() == tr("&Up")) + point.setY(point.y()- epsilon); + else if(qa->text() == tr("&Down")) + point.setY(point.y()+ epsilon); + + int newCurrent = mvc->getViewerByPicking(point); + mvc->updateCurrent(newCurrent); + + setUnsplit(); } void MainWindow::linkViewers() { - MultiViewer_Container *mvc = currentViewContainer(); - mvc->updateTrackballInViewers(); + MultiViewer_Container *mvc = currentViewContainer(); + mvc->updateTrackballInViewers(); } void MainWindow::toggleOrtho() @@ -648,7 +653,7 @@ void MainWindow::toggleOrtho() void MainWindow::viewFrom(QAction *qa) { - if(GLA()) GLA()->createOrthoView(qa->text()); + if(GLA()) GLA()->createOrthoView(qa->text()); } void MainWindow::trackballStep(QAction *qa) @@ -658,74 +663,74 @@ void MainWindow::trackballStep(QAction *qa) void MainWindow::readViewFromFile() { - if(GLA()) GLA()->readViewFromFile(); - updateMenus(); + if(GLA()) GLA()->readViewFromFile(); + updateMenus(); } void MainWindow::saveViewToFile() { - if(GLA()) GLA()->saveViewToFile(); + if(GLA()) GLA()->saveViewToFile(); } void MainWindow::viewFromCurrentMeshShot() { - if(GLA()) GLA()->viewFromCurrentShot("Mesh"); - updateMenus(); + if(GLA()) GLA()->viewFromCurrentShot("Mesh"); + updateMenus(); } void MainWindow::viewFromCurrentRasterShot() { - if(GLA()) GLA()->viewFromCurrentShot("Raster"); - updateMenus(); + if(GLA()) GLA()->viewFromCurrentShot("Raster"); + updateMenus(); } void MainWindow::copyViewToClipBoard() { - if(GLA()) GLA()->viewToClipboard(); + if(GLA()) GLA()->viewToClipboard(); } void MainWindow::pasteViewFromClipboard() { - if(GLA()) GLA()->viewFromClipboard(); - updateMenus(); + if(GLA()) GLA()->viewFromClipboard(); + updateMenus(); } void MainWindow::dragEnterEvent(QDragEnterEvent *event) { - //qDebug("dragEnterEvent: %s",event->format()); - event->accept(); + //qDebug("dragEnterEvent: %s",event->format()); + event->accept(); } void MainWindow::dropEvent ( QDropEvent * event ) { - //qDebug("dropEvent: %s",event->format()); - const QMimeData * data = event->mimeData(); - if (data->hasUrls()) - { - QList< QUrl > url_list = data->urls(); - bool layervis = false; - if (layerDialog != NULL) - { - layervis = layerDialog->isVisible(); - showLayerDlg(false); - } - for (int i=0, size=url_list.size(); ikeyboardModifiers () == Qt::ControlModifier ) || ( QApplication::keyboardModifiers () == Qt::ControlModifier )) - { - this->newProject(); - } - - if(path.endsWith("mlp",Qt::CaseInsensitive) || path.endsWith("mlb", Qt::CaseInsensitive) || path.endsWith("aln",Qt::CaseInsensitive) || path.endsWith("out",Qt::CaseInsensitive) || path.endsWith("nvm",Qt::CaseInsensitive) ) - openProject(path); - else - { - importMesh(path); - } - } - showLayerDlg(layervis || meshDoc()->meshList.size() > 0); - } + //qDebug("dropEvent: %s",event->format()); + const QMimeData * data = event->mimeData(); + if (data->hasUrls()) + { + QList< QUrl > url_list = data->urls(); + bool layervis = false; + if (layerDialog != NULL) + { + layervis = layerDialog->isVisible(); + showLayerDlg(false); + } + for (int i=0, size=url_list.size(); ikeyboardModifiers () == Qt::ControlModifier ) || ( QApplication::keyboardModifiers () == Qt::ControlModifier )) + { + this->newProject(); + } + + if(path.endsWith("mlp",Qt::CaseInsensitive) || path.endsWith("mlb", Qt::CaseInsensitive) || path.endsWith("aln",Qt::CaseInsensitive) || path.endsWith("out",Qt::CaseInsensitive) || path.endsWith("nvm",Qt::CaseInsensitive) ) + openProject(path); + else + { + importMesh(path); + } + } + showLayerDlg(layervis || meshDoc()->meshList.size() > 0); + } } void MainWindow::endEdit() @@ -733,8 +738,8 @@ void MainWindow::endEdit() MultiViewer_Container* mvc = currentViewContainer(); if ((meshDoc() == NULL) || (GLA() == NULL) || (mvc == NULL)) return; - - + + for (int ii = 0; ii < meshDoc()->meshList.size(); ++ii) { MeshModel* mm = meshDoc()->meshList[ii]; @@ -742,50 +747,44 @@ void MainWindow::endEdit() addRenderingDataIfNewlyGeneratedMesh(mm->id()); } meshDoc()->meshDocStateData().clear(); - - GLA()->endEdit(); + + GLA()->endEdit(); updateLayerDialog(); } -void MainWindow::applyLastFilter() -{ - if(GLA()==nullptr) return; - GLA()->getLastAppliedFilter()->activate(QAction::Trigger); -} - void MainWindow::showFilterScript() { - if (meshDoc()->filterHistory != nullptr) - { - FilterScriptDialog dialog(this); - - dialog.setScript(meshDoc()->filterHistory); - if (dialog.exec()==QDialog::Accepted) - { - runFilterScript(); - return ; - } - } + if (meshDoc()->filterHistory != nullptr) + { + FilterScriptDialog dialog(this); + + dialog.setScript(meshDoc()->filterHistory); + if (dialog.exec()==QDialog::Accepted) + { + runFilterScript(); + return ; + } + } } void MainWindow::runFilterScript() { - if ((meshDoc() == nullptr) || (meshDoc()->filterHistory == nullptr)) - return; - for (FilterNameParameterValuesPair& pair : *meshDoc()->filterHistory) - { - QString filtnm = pair.filterName(); - int classes = 0; - int postCondMask = 0; - QAction *action = PM.actionFilterMap[ filtnm]; - MeshFilterInterface *iFilter = qobject_cast(action->parent()); - - int req=iFilter->getRequirements(action); - if (meshDoc()->mm() != NULL) - meshDoc()->mm()->updateDataMask(req); - iFilter->setLog(&meshDoc()->Log); - RichParameterList ¶meterSet = pair.second; - + if ((meshDoc() == nullptr) || (meshDoc()->filterHistory == nullptr)) + return; + for (FilterNameParameterValuesPair& pair : *meshDoc()->filterHistory) + { + QString filtnm = pair.filterName(); + int classes = 0; + unsigned int postCondMask = MeshModel::MM_UNKNOWN; + QAction *action = PM.actionFilterMap[ filtnm]; + FilterPluginInterface *iFilter = qobject_cast(action->parent()); + + int req=iFilter->getRequirements(action); + if (meshDoc()->mm() != NULL) + meshDoc()->mm()->updateDataMask(req); + iFilter->setLog(&meshDoc()->Log); + RichParameterList ¶meterSet = pair.second; + for(RichParameter& parameter : parameterSet) { //if this is a mesh parameter and the index is valid if(parameter.value().isMesh()) { @@ -800,97 +799,99 @@ void MainWindow::runFilterScript() } } } - //iFilter->applyFilter( action, *(meshDoc()->mm()), (*ii).second, QCallBack ); - - bool created = false; - MLSceneGLSharedDataContext* shar = NULL; - if (currentViewContainer() != NULL) - { - shar = currentViewContainer()->sharedDataContext(); - //GLA() is only the parent - QGLWidget* filterWidget = new QGLWidget(GLA(),shar); - QGLFormat defForm = QGLFormat::defaultFormat(); - iFilter->glContext = new MLPluginGLContext(defForm,filterWidget->context()->device(),*shar); - created = iFilter->glContext->create(filterWidget->context()); - shar->addView(iFilter->glContext); - MLRenderingData dt; - MLRenderingData::RendAtts atts; - atts[MLRenderingData::ATT_NAMES::ATT_VERTPOSITION] = true; - atts[MLRenderingData::ATT_NAMES::ATT_VERTNORMAL] = true; - - - if (iFilter->filterArity(action) == MeshFilterInterface::SINGLE_MESH) - { - MLRenderingData::PRIMITIVE_MODALITY pm = MLPoliciesStandAloneFunctions::bestPrimitiveModalityAccordingToMesh(meshDoc()->mm()); - if ((pm != MLRenderingData::PR_ARITY) && (meshDoc()->mm() != NULL)) - { - dt.set(pm,atts); - shar->setRenderingDataPerMeshView(meshDoc()->mm()->id(),iFilter->glContext,dt); - } - } - else - { - for(int ii = 0;ii < meshDoc()->meshList.size();++ii) - { - MeshModel* mm = meshDoc()->meshList[ii]; - MLRenderingData::PRIMITIVE_MODALITY pm = MLPoliciesStandAloneFunctions::bestPrimitiveModalityAccordingToMesh(mm); - if ((pm != MLRenderingData::PR_ARITY) && (mm != NULL)) - { - dt.set(pm,atts); - shar->setRenderingDataPerMeshView(mm->id(),iFilter->glContext,dt); - } - } - } - - } - if ((!created) || (!iFilter->glContext->isValid())) - throw MLException("A valid GLContext is required by the filter to work.\n"); - meshDoc()->setBusy(true); - //WARNING!!!!!!!!!!!! - /* to be changed */ - iFilter->applyFilter( action, *meshDoc(), pair.second, QCallBack ); - for (MeshModel* mm = meshDoc()->nextMesh(); mm != NULL; mm = meshDoc()->nextMesh(mm)) - vcg::tri::Allocator::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); - if (meshDoc()->mm() != NULL) - { - if(classes & MeshFilterInterface::FaceColoring ) - { - meshDoc()->mm()->updateDataMask(MeshModel::MM_FACECOLOR); - } - if(classes & MeshFilterInterface::VertexColoring ) - { - meshDoc()->mm()->updateDataMask(MeshModel::MM_VERTCOLOR); - } - if(classes & MeshModel::MM_COLOR) - { - meshDoc()->mm()->updateDataMask(MeshModel::MM_COLOR); - } - if(classes & MeshModel::MM_CAMERA) - meshDoc()->mm()->updateDataMask(MeshModel::MM_CAMERA); - } - - 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 */ - - qb->reset(); - GLA()->update(); - GLA()->Logf(GLLogStream::SYSTEM,"Re-Applied filter %s",qUtf8Printable(pair.filterName())); - if (_currviewcontainer != NULL) - _currviewcontainer->updateAllDecoratorsForAllViewers(); - } + //iFilter->applyFilter( action, *(meshDoc()->mm()), (*ii).second, QCallBack ); + + bool created = false; + MLSceneGLSharedDataContext* shar = NULL; + if (currentViewContainer() != NULL) + { + shar = currentViewContainer()->sharedDataContext(); + //GLA() is only the parent + QGLWidget* filterWidget = new QGLWidget(GLA(),shar); + QGLFormat defForm = QGLFormat::defaultFormat(); + iFilter->glContext = new MLPluginGLContext(defForm,filterWidget->context()->device(),*shar); + created = iFilter->glContext->create(filterWidget->context()); + shar->addView(iFilter->glContext); + MLRenderingData dt; + MLRenderingData::RendAtts atts; + atts[MLRenderingData::ATT_NAMES::ATT_VERTPOSITION] = true; + atts[MLRenderingData::ATT_NAMES::ATT_VERTNORMAL] = true; + + + if (iFilter->filterArity(action) == FilterPluginInterface::SINGLE_MESH) + { + MLRenderingData::PRIMITIVE_MODALITY pm = MLPoliciesStandAloneFunctions::bestPrimitiveModalityAccordingToMesh(meshDoc()->mm()); + if ((pm != MLRenderingData::PR_ARITY) && (meshDoc()->mm() != NULL)) + { + dt.set(pm,atts); + shar->setRenderingDataPerMeshView(meshDoc()->mm()->id(),iFilter->glContext,dt); + } + } + else + { + for(int ii = 0;ii < meshDoc()->meshList.size();++ii) + { + MeshModel* mm = meshDoc()->meshList[ii]; + MLRenderingData::PRIMITIVE_MODALITY pm = MLPoliciesStandAloneFunctions::bestPrimitiveModalityAccordingToMesh(mm); + if ((pm != MLRenderingData::PR_ARITY) && (mm != NULL)) + { + dt.set(pm,atts); + shar->setRenderingDataPerMeshView(mm->id(),iFilter->glContext,dt); + } + } + } + + } + if ((!created) || (!iFilter->glContext->isValid())) + throw MLException("A valid GLContext is required by the filter to work.\n"); + meshDoc()->setBusy(true); + //WARNING!!!!!!!!!!!! + /* to be changed */ + iFilter->applyFilter( action, *meshDoc(), postCondMask, pair.second, QCallBack); + if (postCondMask == MeshModel::MM_UNKNOWN) + postCondMask = iFilter->postCondition(action); + for (MeshModel* mm = meshDoc()->nextMesh(); mm != NULL; mm = meshDoc()->nextMesh(mm)) + vcg::tri::Allocator::CompactEveryVector(mm->cm); + meshDoc()->setBusy(false); + if (shar != NULL) + shar->removeView(iFilter->glContext); + delete iFilter->glContext; + classes = int(iFilter->getClass(action)); + + if (meshDoc()->mm() != NULL) + { + if(classes & FilterPluginInterface::FaceColoring ) + { + meshDoc()->mm()->updateDataMask(MeshModel::MM_FACECOLOR); + } + if(classes & FilterPluginInterface::VertexColoring ) + { + meshDoc()->mm()->updateDataMask(MeshModel::MM_VERTCOLOR); + } + if(classes & MeshModel::MM_COLOR) + { + meshDoc()->mm()->updateDataMask(MeshModel::MM_COLOR); + } + if(classes & MeshModel::MM_CAMERA) + meshDoc()->mm()->updateDataMask(MeshModel::MM_CAMERA); + } + + bool newmeshcreated = false; + if (classes & FilterPluginInterface::MeshCreation) + newmeshcreated = true; + updateSharedContextDataAfterFilterExecution(postCondMask, classes, newmeshcreated); + meshDoc()->meshDocStateData().clear(); + + if(classes & FilterPluginInterface::MeshCreation) + GLA()->resetTrackBall(); + /* to be changed */ + + qb->reset(); + GLA()->update(); + GLA()->Logf(GLLogStream::SYSTEM,"Re-Applied filter %s",qUtf8Printable(pair.filterName())); + if (_currviewcontainer != NULL) + _currviewcontainer->updateAllDecoratorsForAllViewers(); + } } // Receives the action that wants to show a tooltip and display it @@ -899,8 +900,8 @@ void MainWindow::runFilterScript() // hand side of the menu entry (not invasive) void MainWindow::showTooltip(QAction* q) { - QString tip = q->toolTip(); - QToolTip::showText(QCursor::pos(), tip); + QString tip = q->toolTip(); + QToolTip::showText(QCursor::pos(), tip); } // ///////////////////////////////////////////////// @@ -913,161 +914,161 @@ void MainWindow::showTooltip(QAction* q) void MainWindow::startFilter() { - if(currentViewContainer() == NULL) return; - if(GLA() == NULL) return; - - // In order to avoid that a filter changes something assumed by the current editing tool, - // before actually starting the filter we close the current editing tool (if any). - if (GLA()->getCurrentEditAction() != NULL) - endEdit(); - updateMenus(); - - QStringList missingPreconditions; - QAction *action = qobject_cast(sender()); - if (action == NULL) - throw MLException("Invalid filter action value."); - MeshFilterInterface *iFilter = qobject_cast(action->parent()); - if (meshDoc() == NULL) - return; - //OLD FILTER PHILOSOPHY - if (iFilter != NULL) - { - //if(iFilter->getClass(action) == MeshFilterInterface::MeshCreation) - //{ - // qDebug("MeshCreation"); - // GLA()->meshDoc->addNewMesh("",iFilter->filterName(action) ); - //} - //else - if (!iFilter->isFilterApplicable(action,(*meshDoc()->mm()),missingPreconditions)) - { - QString enstr = missingPreconditions.join(","); - QMessageBox::warning(this, tr("PreConditions' Failure"), QString("Warning the filter '" + iFilter->filterName(action) + "' has not been applied.
" - "Current mesh does not have " + enstr + ".")); - return; - } - - if(currentViewContainer()) - { - iFilter->setLog(currentViewContainer()->LogPtr()); - currentViewContainer()->LogPtr()->SetBookmark(); - } - // just to be sure... - createStdPluginWnd(); - - // (2) Ask for filter parameters and eventually directly invoke the filter - // showAutoDialog return true if a dialog have been created (and therefore the execution is demanded to the apply event) - // if no dialog is created the filter must be executed immediately - if(! stddialog->showAutoDialog(iFilter, meshDoc()->mm(), (meshDoc()), action, this, GLA()) ) - { - RichParameterList dummyParSet; - executeFilter(action, dummyParSet, false); - - //Insert the filter to filterHistory - FilterNameParameterValuesPair tmp; - tmp.first = action->text(); tmp.second = dummyParSet; - meshDoc()->filterHistory->append(tmp); - } - } - + if(currentViewContainer() == NULL) return; + if(GLA() == NULL) return; + + // In order to avoid that a filter changes something assumed by the current editing tool, + // before actually starting the filter we close the current editing tool (if any). + if (GLA()->getCurrentEditAction() != NULL) + endEdit(); + updateMenus(); + + QStringList missingPreconditions; + QAction *action = qobject_cast(sender()); + if (action == NULL) + throw MLException("Invalid filter action value."); + FilterPluginInterface *iFilter = qobject_cast(action->parent()); + if (meshDoc() == NULL) + return; + //OLD FILTER PHILOSOPHY + if (iFilter != NULL) + { + //if(iFilter->getClass(action) == MeshFilterInterface::MeshCreation) + //{ + // qDebug("MeshCreation"); + // GLA()->meshDoc->addNewMesh("",iFilter->filterName(action) ); + //} + //else + if (!iFilter->isFilterApplicable(action,(*meshDoc()->mm()),missingPreconditions)) + { + QString enstr = missingPreconditions.join(","); + QMessageBox::warning(this, tr("PreConditions' Failure"), QString("Warning the filter '" + iFilter->filterName(action) + "' has not been applied.
" + "Current mesh does not have " + enstr + ".")); + return; + } + + if(currentViewContainer()) + { + iFilter->setLog(currentViewContainer()->LogPtr()); + currentViewContainer()->LogPtr()->SetBookmark(); + } + // just to be sure... + createStdPluginWnd(); + + // (2) Ask for filter parameters and eventually directly invoke the filter + // showAutoDialog return true if a dialog have been created (and therefore the execution is demanded to the apply event) + // if no dialog is created the filter must be executed immediately + if(! stddialog->showAutoDialog(iFilter, meshDoc()->mm(), (meshDoc()), action, this, GLA()) ) + { + RichParameterList dummyParSet; + executeFilter(action, dummyParSet, false); + + //Insert the filter to filterHistory + FilterNameParameterValuesPair tmp; + tmp.first = action->text(); tmp.second = dummyParSet; + meshDoc()->filterHistory->append(tmp); + } + } + }//void MainWindow::startFilter() void MainWindow::updateSharedContextDataAfterFilterExecution(int postcondmask,int fclasses,bool& newmeshcreated) { - MultiViewer_Container* mvc = currentViewContainer(); - if ((meshDoc() != NULL) && (mvc != NULL)) - { - if (GLA() == NULL) - return; - MLSceneGLSharedDataContext* shared = mvc->sharedDataContext(); - if (shared != NULL) - { - for(MeshModel* mm = meshDoc()->nextMesh();mm != NULL;mm = meshDoc()->nextMesh(mm)) - { - if (mm == NULL) - continue; - //Just to be sure that the filter author didn't forget to add changing tags to the postCondition field - if ((mm->hasDataMask(MeshModel::MM_FACECOLOR)) && (fclasses & MeshFilterInterface::FaceColoring )) - postcondmask = postcondmask | MeshModel::MM_FACECOLOR; - - if ((mm->hasDataMask(MeshModel::MM_VERTCOLOR)) && (fclasses & MeshFilterInterface::VertexColoring )) - postcondmask = postcondmask | MeshModel::MM_VERTCOLOR; - - if ((mm->hasDataMask(MeshModel::MM_COLOR)) && (fclasses & MeshFilterInterface::MeshColoring )) - postcondmask = postcondmask | MeshModel::MM_COLOR; - - if ((mm->hasDataMask(MeshModel::MM_FACEQUALITY)) && (fclasses & MeshFilterInterface::Quality )) - postcondmask = postcondmask | MeshModel::MM_FACEQUALITY; - - if ((mm->hasDataMask(MeshModel::MM_VERTQUALITY)) && (fclasses & MeshFilterInterface::Quality )) - postcondmask = postcondmask | MeshModel::MM_VERTQUALITY; - - MLRenderingData dttoberendered; - QMap::Iterator existit = meshDoc()->meshDocStateData().find(mm->id()); + MultiViewer_Container* mvc = currentViewContainer(); + if ((meshDoc() != NULL) && (mvc != NULL)) + { + if (GLA() == NULL) + return; + MLSceneGLSharedDataContext* shared = mvc->sharedDataContext(); + if (shared != NULL) + { + for(MeshModel* mm = meshDoc()->nextMesh();mm != NULL;mm = meshDoc()->nextMesh(mm)) + { + if (mm == NULL) + continue; + //Just to be sure that the filter author didn't forget to add changing tags to the postCondition field + if ((mm->hasDataMask(MeshModel::MM_FACECOLOR)) && (fclasses & FilterPluginInterface::FaceColoring )) + postcondmask = postcondmask | MeshModel::MM_FACECOLOR; + + if ((mm->hasDataMask(MeshModel::MM_VERTCOLOR)) && (fclasses & FilterPluginInterface::VertexColoring )) + postcondmask = postcondmask | MeshModel::MM_VERTCOLOR; + + if ((mm->hasDataMask(MeshModel::MM_COLOR)) && (fclasses & FilterPluginInterface::MeshColoring )) + postcondmask = postcondmask | MeshModel::MM_COLOR; + + if ((mm->hasDataMask(MeshModel::MM_FACEQUALITY)) && (fclasses & FilterPluginInterface::Quality )) + postcondmask = postcondmask | MeshModel::MM_FACEQUALITY; + + if ((mm->hasDataMask(MeshModel::MM_VERTQUALITY)) && (fclasses & FilterPluginInterface::Quality )) + postcondmask = postcondmask | MeshModel::MM_VERTQUALITY; + + MLRenderingData dttoberendered; + QMap::Iterator existit = meshDoc()->meshDocStateData().find(mm->id()); if (existit != meshDoc()->meshDocStateData().end()) - { - - shared->getRenderInfoPerMeshView(mm->id(),GLA()->context(),dttoberendered); - int updatemask = MeshModel::MM_NONE; + { + + shared->getRenderInfoPerMeshView(mm->id(),GLA()->context(),dttoberendered); + int updatemask = MeshModel::MM_NONE; bool connectivitychanged = false; - if (((unsigned int)mm->cm.VN() != existit->_nvert) || ((unsigned int)mm->cm.FN() != existit->_nface) || - bool(postcondmask & MeshModel::MM_UNKNOWN) || bool(postcondmask & MeshModel::MM_VERTNUMBER) || - bool(postcondmask & MeshModel::MM_FACENUMBER) || bool(postcondmask & MeshModel::MM_FACEVERT) || - bool(postcondmask & MeshModel::MM_VERTFACETOPO) || bool(postcondmask & MeshModel::MM_FACEFACETOPO)) - { + if (((unsigned int)mm->cm.VN() != existit->_nvert) || ((unsigned int)mm->cm.FN() != existit->_nface) || + bool(postcondmask & MeshModel::MM_UNKNOWN) || bool(postcondmask & MeshModel::MM_VERTNUMBER) || + bool(postcondmask & MeshModel::MM_FACENUMBER) || bool(postcondmask & MeshModel::MM_FACEVERT) || + bool(postcondmask & MeshModel::MM_VERTFACETOPO) || bool(postcondmask & MeshModel::MM_FACEFACETOPO)) + { updatemask = MeshModel::MM_ALL; - connectivitychanged = true; - } - else - { - //masks differences bitwise operator (^) -> remove the attributes that didn't apparently change + the ones that for sure changed according to the postCondition function - //this operation has been introduced in order to minimize problems with filters that didn't declared properly the postCondition mask - updatemask = (existit->_mask ^ mm->dataMask()) | postcondmask; - connectivitychanged = false; - } - - MLRenderingData::RendAtts dttoupdate; - //1) we convert the meshmodel updating mask to a RendAtts structure - MLPoliciesStandAloneFunctions::fromMeshModelMaskToMLRenderingAtts(updatemask,dttoupdate); - //2) The correspondent bos to the updated rendering attributes are set to invalid - shared->meshAttributesUpdated(mm->id(),connectivitychanged,dttoupdate); - - //3) we took the current rendering modality for the mesh in the active gla - MLRenderingData curr; - shared->getRenderInfoPerMeshView(mm->id(),GLA()->context(),curr); - - //4) we add to the current rendering modality in the current GLArea just the minimum attributes having been updated - // WARNING!!!! There are priority policies - // ex1) suppose that the current rendering modality is PR_POINTS and ATT_VERTPOSITION, ATT_VERTNORMAL,ATT_VERTCOLOR - // if i updated, for instance, just the ATT_FACECOLOR, we switch off in the active GLArea the per ATT_VERTCOLOR attribute - // and turn on the ATT_FACECOLOR - // ex2) suppose that the current rendering modality is PR_POINTS and ATT_VERTPOSITION, ATT_VERTNORMAL,ATT_VERTCOLOR - // if i updated, for instance, both the ATT_FACECOLOR and the ATT_VERTCOLOR, we continue to render the updated value of the ATT_VERTCOLOR - // ex3) suppose that in all the GLAreas the current rendering modality is PR_POINTS and we run a surface reconstruction filter - // in the current GLA() we switch from the PR_POINTS to PR_SOLID primitive rendering modality. In the other GLArea we maintain the per points visualization - for(MLRenderingData::PRIMITIVE_MODALITY pm = MLRenderingData::PRIMITIVE_MODALITY(0);pm < MLRenderingData::PR_ARITY;pm = MLRenderingData::next(pm)) - { - bool wasprimitivemodalitymeaningful = MLPoliciesStandAloneFunctions::isPrimitiveModalityCompatibleWithMeshInfo((existit->_nvert > 0),(existit->_nface > 0),(existit->_nedge > 0),existit->_mask,pm); - bool isprimitivemodalitymeaningful = MLPoliciesStandAloneFunctions::isPrimitiveModalityCompatibleWithMesh(mm,pm); - bool isworthtobevisualized = MLPoliciesStandAloneFunctions::isPrimitiveModalityWorthToBeActivated(pm,curr.isPrimitiveActive(pm),wasprimitivemodalitymeaningful,isprimitivemodalitymeaningful); - - - MLRenderingData::RendAtts rd; + connectivitychanged = true; + } + else + { + //masks differences bitwise operator (^) -> remove the attributes that didn't apparently change + the ones that for sure changed according to the postCondition function + //this operation has been introduced in order to minimize problems with filters that didn't declared properly the postCondition mask + updatemask = (existit->_mask ^ mm->dataMask()) | postcondmask; + connectivitychanged = false; + } + + MLRenderingData::RendAtts dttoupdate; + //1) we convert the meshmodel updating mask to a RendAtts structure + MLPoliciesStandAloneFunctions::fromMeshModelMaskToMLRenderingAtts(updatemask,dttoupdate); + //2) The correspondent bos to the updated rendering attributes are set to invalid + shared->meshAttributesUpdated(mm->id(),connectivitychanged,dttoupdate); + + //3) we took the current rendering modality for the mesh in the active gla + MLRenderingData curr; + shared->getRenderInfoPerMeshView(mm->id(),GLA()->context(),curr); + + //4) we add to the current rendering modality in the current GLArea just the minimum attributes having been updated + // WARNING!!!! There are priority policies + // ex1) suppose that the current rendering modality is PR_POINTS and ATT_VERTPOSITION, ATT_VERTNORMAL,ATT_VERTCOLOR + // if i updated, for instance, just the ATT_FACECOLOR, we switch off in the active GLArea the per ATT_VERTCOLOR attribute + // and turn on the ATT_FACECOLOR + // ex2) suppose that the current rendering modality is PR_POINTS and ATT_VERTPOSITION, ATT_VERTNORMAL,ATT_VERTCOLOR + // if i updated, for instance, both the ATT_FACECOLOR and the ATT_VERTCOLOR, we continue to render the updated value of the ATT_VERTCOLOR + // ex3) suppose that in all the GLAreas the current rendering modality is PR_POINTS and we run a surface reconstruction filter + // in the current GLA() we switch from the PR_POINTS to PR_SOLID primitive rendering modality. In the other GLArea we maintain the per points visualization + for(MLRenderingData::PRIMITIVE_MODALITY pm = MLRenderingData::PRIMITIVE_MODALITY(0);pm < MLRenderingData::PR_ARITY;pm = MLRenderingData::next(pm)) + { + bool wasprimitivemodalitymeaningful = MLPoliciesStandAloneFunctions::isPrimitiveModalityCompatibleWithMeshInfo((existit->_nvert > 0),(existit->_nface > 0),(existit->_nedge > 0),existit->_mask,pm); + bool isprimitivemodalitymeaningful = MLPoliciesStandAloneFunctions::isPrimitiveModalityCompatibleWithMesh(mm,pm); + bool isworthtobevisualized = MLPoliciesStandAloneFunctions::isPrimitiveModalityWorthToBeActivated(pm,curr.isPrimitiveActive(pm),wasprimitivemodalitymeaningful,isprimitivemodalitymeaningful); + + + MLRenderingData::RendAtts rd; curr.get(pm, rd); MLPoliciesStandAloneFunctions::updatedRendAttsAccordingToPriorities(pm, dttoupdate, rd, rd); rd[MLRenderingData::ATT_NAMES::ATT_VERTPOSITION] = isworthtobevisualized; - MLPoliciesStandAloneFunctions::filterUselessUdpateAccordingToMeshMask(mm,rd); - curr.set(pm,rd); - } + MLPoliciesStandAloneFunctions::filterUselessUdpateAccordingToMeshMask(mm,rd); + curr.set(pm,rd); + } MLPerViewGLOptions opts; curr.get(opts); - if (fclasses & MeshFilterInterface::MeshColoring) + if (fclasses & FilterPluginInterface::MeshColoring) { bool hasmeshcolor = mm->hasDataMask(MeshModel::MM_COLOR); opts._perpoint_mesh_color_enabled = hasmeshcolor; opts._perwire_mesh_color_enabled = hasmeshcolor; opts._persolid_mesh_color_enabled = hasmeshcolor; - + for (MLRenderingData::PRIMITIVE_MODALITY pm = MLRenderingData::PRIMITIVE_MODALITY(0); pm < MLRenderingData::PR_ARITY; pm = MLRenderingData::next(pm)) { MLRenderingData::RendAtts atts; @@ -1079,8 +1080,8 @@ void MainWindow::updateSharedContextDataAfterFilterExecution(int postcondmask,in curr.set(opts); } MLPoliciesStandAloneFunctions::setPerViewGLOptionsAccordindToWireModality(mm, curr); - MLPoliciesStandAloneFunctions::setPerViewGLOptionsPriorities(curr); - + MLPoliciesStandAloneFunctions::setPerViewGLOptionsPriorities(curr); + if (mm == meshDoc()->mm()) { /*HORRIBLE TRICK IN ORDER TO HAVE VALID ACTIONS ASSOCIATED WITH THE CURRENT WIRE RENDERING MODALITY*/ @@ -1090,15 +1091,15 @@ void MainWindow::updateSharedContextDataAfterFilterExecution(int postcondmask,in delete fauxaction; /****************************************************************************************************/ } - - - shared->setRenderingDataPerMeshView(mm->id(),GLA()->context(),curr); - } - else - { - //A new mesh has been created by the filter. I have to add it in the shared context data structure - newmeshcreated = true; - MLPoliciesStandAloneFunctions::suggestedDefaultPerViewRenderingData(mm,dttoberendered,mwsettings.minpolygonpersmoothrendering); + + + shared->setRenderingDataPerMeshView(mm->id(),GLA()->context(),curr); + } + else + { + //A new mesh has been created by the filter. I have to add it in the shared context data structure + newmeshcreated = true; + MLPoliciesStandAloneFunctions::suggestedDefaultPerViewRenderingData(mm,dttoberendered,mwsettings.minpolygonpersmoothrendering); if (mm == meshDoc()->mm()) { /*HORRIBLE TRICK IN ORDER TO HAVE VALID ACTIONS ASSOCIATED WITH THE CURRENT WIRE RENDERING MODALITY*/ @@ -1109,16 +1110,16 @@ void MainWindow::updateSharedContextDataAfterFilterExecution(int postcondmask,in /****************************************************************************************************/ } foreach(GLArea* gla,mvc->viewerList) - { - if (gla != NULL) - shared->setRenderingDataPerMeshView(mm->id(),gla->context(),dttoberendered); - } + { + if (gla != NULL) + shared->setRenderingDataPerMeshView(mm->id(),gla->context(),dttoberendered); + } } shared->manageBuffers(mm->id()); - } + } updateLayerDialog(); - } - } + } + } } /* @@ -1130,196 +1131,199 @@ from the user defined dialog */ -void MainWindow::executeFilter(QAction *action, RichParameterList ¶ms, bool isPreview) +void MainWindow::executeFilter(const QAction* action, RichParameterList ¶ms, bool isPreview) { - MeshFilterInterface *iFilter = qobject_cast(action->parent()); - qb->show(); - iFilter->setLog(&meshDoc()->Log); - - // Ask for filter requirements (eg a filter can need topology, border flags etc) - // and satisfy them - qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); - MainWindow::globalStatusBar()->showMessage("Starting Filter...",5000); - int req=iFilter->getRequirements(action); - if (!meshDoc()->meshList.isEmpty()) - meshDoc()->mm()->updateDataMask(req); - qApp->restoreOverrideCursor(); - - // (3) save the current filter and its parameters in the history - if(!isPreview) - meshDoc()->Log.ClearBookmark(); - else - meshDoc()->Log.BackToBookmark(); - // (4) Apply the Filter - bool ret; - qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); - QElapsedTimer tt; tt.start(); - meshDoc()->setBusy(true); - RichParameterList mergedenvironment(params); - mergedenvironment.join(currentGlobalParams); - - MLSceneGLSharedDataContext* shar = NULL; - QGLWidget* filterWidget = NULL; - if (currentViewContainer() != NULL) - { - shar = currentViewContainer()->sharedDataContext(); - //GLA() is only the parent - filterWidget = new QGLWidget(NULL,shar); - QGLFormat defForm = QGLFormat::defaultFormat(); - iFilter->glContext = new MLPluginGLContext(defForm,filterWidget->context()->device(),*shar); - iFilter->glContext->create(filterWidget->context()); - - MLRenderingData dt; - MLRenderingData::RendAtts atts; - atts[MLRenderingData::ATT_NAMES::ATT_VERTPOSITION] = true; - atts[MLRenderingData::ATT_NAMES::ATT_VERTNORMAL] = true; - - if (iFilter->filterArity(action) == MeshFilterInterface::SINGLE_MESH) - { - MLRenderingData::PRIMITIVE_MODALITY pm = MLPoliciesStandAloneFunctions::bestPrimitiveModalityAccordingToMesh(meshDoc()->mm()); - if ((pm != MLRenderingData::PR_ARITY) && (meshDoc()->mm() != NULL)) - { - dt.set(pm,atts); - iFilter->glContext->initPerViewRenderingData(meshDoc()->mm()->id(),dt); - } - } - else - { - for(int ii = 0;ii < meshDoc()->meshList.size();++ii) - { - MeshModel* mm = meshDoc()->meshList[ii]; - MLRenderingData::PRIMITIVE_MODALITY pm = MLPoliciesStandAloneFunctions::bestPrimitiveModalityAccordingToMesh(mm); - if ((pm != MLRenderingData::PR_ARITY) && (mm != NULL)) - { - dt.set(pm,atts); - iFilter->glContext->initPerViewRenderingData(mm->id(),dt); - } - } - } - } - bool newmeshcreated = false; - try - { - meshDoc()->meshDocStateData().clear(); + FilterPluginInterface *iFilter = qobject_cast(action->parent()); + qb->show(); + iFilter->setLog(&meshDoc()->Log); + + // Ask for filter requirements (eg a filter can need topology, border flags etc) + // and satisfy them + qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); + MainWindow::globalStatusBar()->showMessage("Starting Filter...",5000); + int req=iFilter->getRequirements(action); + if (!meshDoc()->meshList.isEmpty()) + meshDoc()->mm()->updateDataMask(req); + qApp->restoreOverrideCursor(); + + // (3) save the current filter and its parameters in the history + if(!isPreview) + meshDoc()->Log.ClearBookmark(); + else + meshDoc()->Log.BackToBookmark(); + // (4) Apply the Filter + bool ret; + qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); + QElapsedTimer tt; tt.start(); + meshDoc()->setBusy(true); + RichParameterList mergedenvironment(params); + mergedenvironment.join(currentGlobalParams); + + MLSceneGLSharedDataContext* shar = NULL; + QGLWidget* filterWidget = NULL; + if (currentViewContainer() != NULL) + { + shar = currentViewContainer()->sharedDataContext(); + //GLA() is only the parent + filterWidget = new QGLWidget(NULL,shar); + QGLFormat defForm = QGLFormat::defaultFormat(); + iFilter->glContext = new MLPluginGLContext(defForm,filterWidget->context()->device(),*shar); + iFilter->glContext->create(filterWidget->context()); + + MLRenderingData dt; + MLRenderingData::RendAtts atts; + atts[MLRenderingData::ATT_NAMES::ATT_VERTPOSITION] = true; + atts[MLRenderingData::ATT_NAMES::ATT_VERTNORMAL] = true; + + if (iFilter->filterArity(action) == FilterPluginInterface::SINGLE_MESH) + { + MLRenderingData::PRIMITIVE_MODALITY pm = MLPoliciesStandAloneFunctions::bestPrimitiveModalityAccordingToMesh(meshDoc()->mm()); + if ((pm != MLRenderingData::PR_ARITY) && (meshDoc()->mm() != NULL)) + { + dt.set(pm,atts); + iFilter->glContext->initPerViewRenderingData(meshDoc()->mm()->id(),dt); + } + } + else + { + for(int ii = 0;ii < meshDoc()->meshList.size();++ii) + { + MeshModel* mm = meshDoc()->meshList[ii]; + MLRenderingData::PRIMITIVE_MODALITY pm = MLPoliciesStandAloneFunctions::bestPrimitiveModalityAccordingToMesh(mm); + if ((pm != MLRenderingData::PR_ARITY) && (mm != NULL)) + { + dt.set(pm,atts); + iFilter->glContext->initPerViewRenderingData(mm->id(),dt); + } + } + } + } + bool newmeshcreated = false; + try + { + meshDoc()->meshDocStateData().clear(); meshDoc()->meshDocStateData().create(*meshDoc()); - ret=iFilter->applyFilter(action, *(meshDoc()), mergedenvironment, QCallBack); + unsigned int postCondMask = MeshModel::MM_UNKNOWN; + ret=iFilter->applyFilter(action, *(meshDoc()), postCondMask, mergedenvironment, QCallBack); + if (postCondMask == MeshModel::MM_UNKNOWN) + postCondMask = iFilter->postCondition(action); for (MeshModel* mm = meshDoc()->nextMesh(); mm != NULL; mm = meshDoc()->nextMesh(mm)) vcg::tri::Allocator::CompactEveryVector(mm->cm); - + if (shar != NULL) { shar->removeView(iFilter->glContext); delete filterWidget; } - - meshDoc()->setBusy(false); - - qApp->restoreOverrideCursor(); - - // (5) Apply post filter actions (e.g. recompute non updated stuff if needed) - - if(ret) - { - meshDoc()->Log.Logf(GLLogStream::SYSTEM,"Applied filter %s in %i msec",qUtf8Printable(action->text()),tt.elapsed()); - if (meshDoc()->mm() != NULL) + + meshDoc()->setBusy(false); + + qApp->restoreOverrideCursor(); + + // (5) Apply post filter actions (e.g. recompute non updated stuff if needed) + + if(ret) + { + meshDoc()->Log.Logf(GLLogStream::SYSTEM,"Applied filter %s in %i msec",qUtf8Printable(action->text()),tt.elapsed()); + if (meshDoc()->mm() != NULL) meshDoc()->mm()->setMeshModified(); - MainWindow::globalStatusBar()->showMessage("Filter successfully completed...",2000); - if(GLA()) - { - GLA()->setLastAppliedFilter(action); - } - lastFilterAct->setText(QString("Apply filter ") + action->text()); - lastFilterAct->setEnabled(true); - } - else // filter has failed. show the message error. - { - QMessageBox::warning(this, tr("Filter Failure"), QString("Failure of filter : '%1'

").arg(action->text())+iFilter->errorMsg()); // text - meshDoc()->Log.Logf(GLLogStream::SYSTEM,"Filter failed: %s",qUtf8Printable(iFilter->errorMsg())); - MainWindow::globalStatusBar()->showMessage("Filter failed...",2000); - } - - - MeshFilterInterface::FILTER_ARITY arity = iFilter->filterArity(action); - QList tmp; - switch(arity) - { - case (MeshFilterInterface::SINGLE_MESH): - { - tmp.push_back(meshDoc()->mm()); - break; - } - case (MeshFilterInterface::FIXED): - { - for(const RichParameter& p : mergedenvironment) - { - if (p.value().isMesh()) - { - MeshModel* mm = p.value().getMesh(); - if (mm != NULL) - tmp.push_back(mm); - } - } - break; - } - case (MeshFilterInterface::VARIABLE): - { - for(MeshModel* mm = meshDoc()->nextMesh();mm != NULL;mm=meshDoc()->nextMesh(mm)) - { - if (mm->isVisible()) - tmp.push_back(mm); - } - break; - } - default: - break; - } - - if(iFilter->getClass(action) & MeshFilterInterface::MeshCreation ) - GLA()->resetTrackBall(); - - for(int jj = 0;jj < tmp.size();++jj) - { - MeshModel* mm = tmp[jj]; - if (mm != NULL) - { - // at the end for filters that change the color, or selection set the appropriate rendering mode - if(iFilter->getClass(action) & MeshFilterInterface::FaceColoring ) - mm->updateDataMask(MeshModel::MM_FACECOLOR); - - if(iFilter->getClass(action) & MeshFilterInterface::VertexColoring ) - mm->updateDataMask(MeshModel::MM_VERTCOLOR); - - if(iFilter->getClass(action) & MeshFilterInterface::MeshColoring ) - mm->updateDataMask(MeshModel::MM_COLOR); - - if(iFilter->postCondition(action) & MeshModel::MM_CAMERA) - mm->updateDataMask(MeshModel::MM_CAMERA); - - if(iFilter->getClass(action) & MeshFilterInterface::Texture ) - updateTexture(mm->id()); - } - } - - int fclasses = iFilter->getClass(action); - //MLSceneGLSharedDataContext* sharedcont = GLA()->getSceneGLSharedContext(); - int postCondMask = iFilter->postCondition(action); - updateSharedContextDataAfterFilterExecution(postCondMask,fclasses,newmeshcreated); - meshDoc()->meshDocStateData().clear(); - } - catch (const std::bad_alloc& bdall) - { - meshDoc()->setBusy(false); - qApp->restoreOverrideCursor(); - QMessageBox::warning(this, tr("Filter Failure"), - QString("Operating system was not able to allocate the requested memory.
" - "Failure of filter : '%1'
").arg(action->text())+bdall.what()); // text - MainWindow::globalStatusBar()->showMessage("Filter failed...",2000); - } - qb->reset(); - layerDialog->setVisible(layerDialog->isVisible() || ((newmeshcreated) && (meshDoc()->size() > 0))); - updateLayerDialog(); - updateMenus(); - MultiViewer_Container* mvc = currentViewContainer(); + MainWindow::globalStatusBar()->showMessage("Filter successfully completed...",2000); + if(GLA()) + { + GLA()->setLastAppliedFilter(action); + } + lastFilterAct->setText(QString("Apply filter ") + action->text()); + lastFilterAct->setEnabled(true); + } + else // filter has failed. show the message error. + { + QMessageBox::warning(this, tr("Filter Failure"), QString("Failure of filter : '%1'

").arg(action->text())+iFilter->errorMsg()); // text + meshDoc()->Log.Logf(GLLogStream::SYSTEM,"Filter failed: %s",qUtf8Printable(iFilter->errorMsg())); + MainWindow::globalStatusBar()->showMessage("Filter failed...",2000); + } + + + FilterPluginInterface::FILTER_ARITY arity = iFilter->filterArity(action); + QList tmp; + switch(arity) + { + case (FilterPluginInterface::SINGLE_MESH): + { + tmp.push_back(meshDoc()->mm()); + break; + } + case (FilterPluginInterface::FIXED): + { + for(const RichParameter& p : mergedenvironment) + { + if (p.value().isMesh()) + { + MeshModel* mm = p.value().getMesh(); + if (mm != NULL) + tmp.push_back(mm); + } + } + break; + } + case (FilterPluginInterface::VARIABLE): + { + for(MeshModel* mm = meshDoc()->nextMesh();mm != NULL;mm=meshDoc()->nextMesh(mm)) + { + if (mm->isVisible()) + tmp.push_back(mm); + } + break; + } + default: + break; + } + + if(iFilter->getClass(action) & FilterPluginInterface::MeshCreation ) + GLA()->resetTrackBall(); + + for(int jj = 0;jj < tmp.size();++jj) + { + MeshModel* mm = tmp[jj]; + if (mm != NULL) + { + // at the end for filters that change the color, or selection set the appropriate rendering mode + if(iFilter->getClass(action) & FilterPluginInterface::FaceColoring ) + mm->updateDataMask(MeshModel::MM_FACECOLOR); + + if(iFilter->getClass(action) & FilterPluginInterface::VertexColoring ) + mm->updateDataMask(MeshModel::MM_VERTCOLOR); + + if(iFilter->getClass(action) & FilterPluginInterface::MeshColoring ) + mm->updateDataMask(MeshModel::MM_COLOR); + + if(postCondMask & MeshModel::MM_CAMERA) + mm->updateDataMask(MeshModel::MM_CAMERA); + + if(iFilter->getClass(action) & FilterPluginInterface::Texture ) + updateTexture(mm->id()); + } + } + + int fclasses = iFilter->getClass(action); + //MLSceneGLSharedDataContext* sharedcont = GLA()->getSceneGLSharedContext(); + + updateSharedContextDataAfterFilterExecution(postCondMask,fclasses,newmeshcreated); + meshDoc()->meshDocStateData().clear(); + } + catch (const std::bad_alloc& bdall) + { + meshDoc()->setBusy(false); + qApp->restoreOverrideCursor(); + QMessageBox::warning(this, tr("Filter Failure"), + QString("Operating system was not able to allocate the requested memory.
" + "Failure of filter : '%1'
").arg(action->text())+bdall.what()); // text + MainWindow::globalStatusBar()->showMessage("Filter failed...",2000); + } + qb->reset(); + layerDialog->setVisible(layerDialog->isVisible() || ((newmeshcreated) && (meshDoc()->size() > 0))); + updateLayerDialog(); + updateMenus(); + MultiViewer_Container* mvc = currentViewContainer(); if (mvc) { mvc->updateAllDecoratorsForAllViewers(); @@ -1337,117 +1341,117 @@ void MainWindow::executeFilter(QAction *action, RichParameterList ¶ms, bool void MainWindow::suspendEditMode() { - // return if no window is open - if(!GLA()) return; - - // return if no editing action is currently ongoing - if(!GLA()->getCurrentEditAction()) return; - - GLA()->suspendEditToggle(); - updateMenus(); - GLA()->update(); + // return if no window is open + if(!GLA()) return; + + // return if no editing action is currently ongoing + if(!GLA()->getCurrentEditAction()) return; + + GLA()->suspendEditToggle(); + updateMenus(); + GLA()->update(); } void MainWindow::applyEditMode() { - if(!GLA()) { //prevents crash without mesh - QAction *action = qobject_cast(sender()); - action->setChecked(false); - return; - } - - QAction *action = qobject_cast(sender()); - - if(GLA()->getCurrentEditAction()) //prevents multiple buttons pushed - { - if(action==GLA()->getCurrentEditAction()) // We have double pressed the same action and that means disable that actioon - { - if(GLA()->suspendedEditor) - { - suspendEditMode(); - return; - } + if(!GLA()) { //prevents crash without mesh + QAction *action = qobject_cast(sender()); + action->setChecked(false); + return; + } + + QAction *action = qobject_cast(sender()); + + if(GLA()->getCurrentEditAction()) //prevents multiple buttons pushed + { + if(action==GLA()->getCurrentEditAction()) // We have double pressed the same action and that means disable that actioon + { + if(GLA()->suspendedEditor) + { + suspendEditMode(); + return; + } endEdit(); - updateMenus(); - return; - } - assert(0); // it should be impossible to start an action without having ended the previous one. - return; - } - - //if this GLArea does not have an instance of this action's MeshEdit tool then give it one - if(!GLA()->editorExistsForAction(action)) - { - MeshEditInterfaceFactory *iEditFactory = qobject_cast(action->parent()); - MeshEditInterface *iEdit = iEditFactory->getMeshEditInterface(action); - GLA()->addMeshEditor(action, iEdit); - } + updateMenus(); + return; + } + assert(0); // it should be impossible to start an action without having ended the previous one. + return; + } + + //if this GLArea does not have an instance of this action's MeshEdit tool then give it one + if(!GLA()->editorExistsForAction(action)) + { + EditPluginInterfaceFactory *iEditFactory = qobject_cast(action->parent()); + EditPluginInterface *iEdit = iEditFactory->getMeshEditInterface(action); + GLA()->addMeshEditor(action, iEdit); + } meshDoc()->meshDocStateData().create(*meshDoc()); - GLA()->setCurrentEditAction(action); - updateMenus(); - GLA()->update(); + GLA()->setCurrentEditAction(action); + updateMenus(); + GLA()->update(); } void MainWindow::applyRenderMode() { - QAction *action = qobject_cast(sender()); // find the action which has sent the signal - if ((GLA()!= NULL) && (GLA()->getRenderer() != NULL)) - { - GLA()->getRenderer()->Finalize(GLA()->getCurrentShaderAction(),meshDoc(),GLA()); - GLA()->setRenderer(NULL,NULL); - } - // Make the call to the plugin core - MeshRenderInterface *iRenderTemp = qobject_cast(action->parent()); - bool initsupport = false; - + QAction *action = qobject_cast(sender()); // find the action which has sent the signal + if ((GLA()!= NULL) && (GLA()->getRenderer() != NULL)) + { + GLA()->getRenderer()->Finalize(GLA()->getCurrentShaderAction(),meshDoc(),GLA()); + GLA()->setRenderer(NULL,NULL); + } + // Make the call to the plugin core + RenderPluginInterface *iRenderTemp = qobject_cast(action->parent()); + bool initsupport = false; + if (currentViewContainer() == NULL) return; - + MLSceneGLSharedDataContext* shared = currentViewContainer()->sharedDataContext(); - - if ((shared != NULL) && (iRenderTemp != NULL)) - { + + if ((shared != NULL) && (iRenderTemp != NULL)) + { MLSceneGLSharedDataContext::PerMeshRenderingDataMap rdmap; shared->getRenderInfoPerMeshView(GLA()->context(), rdmap); - iRenderTemp->Init(action,*(meshDoc()),rdmap, GLA()); - initsupport = iRenderTemp->isSupported(); - if (initsupport) - GLA()->setRenderer(iRenderTemp,action); - else - { - if (!initsupport) - { - QString msg = "The selected shader is not supported by your graphic hardware!"; - GLA()->Log(GLLogStream::SYSTEM,qUtf8Printable(msg)); - } - iRenderTemp->Finalize(action,meshDoc(),GLA()); - } - } - - /*I clicked None in renderMenu */ - if ((action->parent() == this) || (!initsupport)) - { - QString msg("No Shader."); - GLA()->Log(GLLogStream::SYSTEM,qUtf8Printable(msg)); - GLA()->setRenderer(0,0); //default opengl pipeline or vertex and fragment programs not supported - } - GLA()->update(); + iRenderTemp->Init(action,*(meshDoc()),rdmap, GLA()); + initsupport = iRenderTemp->isSupported(); + if (initsupport) + GLA()->setRenderer(iRenderTemp,action); + else + { + if (!initsupport) + { + QString msg = "The selected shader is not supported by your graphic hardware!"; + GLA()->Log(GLLogStream::SYSTEM,qUtf8Printable(msg)); + } + iRenderTemp->Finalize(action,meshDoc(),GLA()); + } + } + + /*I clicked None in renderMenu */ + if ((action->parent() == this) || (!initsupport)) + { + QString msg("No Shader."); + GLA()->Log(GLLogStream::SYSTEM,qUtf8Printable(msg)); + GLA()->setRenderer(0,0); //default opengl pipeline or vertex and fragment programs not supported + } + GLA()->update(); } 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()); - - GLA()->toggleDecorator(iDecorateTemp->decorationName(action)); - + if(GLA()->mm() == 0) return; + QAction *action = qobject_cast(sender()); // find the action which has sent the signal + + DecoratePluginInterface *iDecorateTemp = qobject_cast(action->parent()); + + GLA()->toggleDecorator(iDecorateTemp->decorationName(action)); + updateMenus(); - layerDialog->updateDecoratorParsView(); - layerDialog->updateLog(meshDoc()->Log); - layerDialog->update(); - GLA()->update(); + layerDialog->updateDecoratorParsView(); + layerDialog->updateLog(meshDoc()->Log); + layerDialog->update(); + GLA()->update(); } @@ -1456,394 +1460,394 @@ Save project. It saves the info of all the layers and the layer themselves. So */ void MainWindow::saveProject() { - if (meshDoc() == NULL) - return; - //if a mesh has been created by a create filter we must before to save it. Otherwise the project will refer to a mesh without file name path. - foreach(MeshModel * mp, meshDoc()->meshList) - { - if ((mp != NULL) && (mp->fullName().isEmpty())) - { - bool saved = exportMesh(tr(""),mp,false); - if (!saved) - { - QString msg = "Mesh layer " + mp->label() + " cannot be saved on a file.\nProject \"" + meshDoc()->docLabel() + "\" saving has been aborted."; - QMessageBox::warning(this,tr("Project Saving Aborted"),msg); - return; - } - } - } - QFileDialog* saveDiag = new QFileDialog(this,tr("Save Project File"),lastUsedDirectory.path().append(""), tr("MeshLab Project (*.mlp);;MeshLab Binary Project (*.mlb);;Align Project (*.aln)")); + if (meshDoc() == NULL) + return; + //if a mesh has been created by a create filter we must before to save it. Otherwise the project will refer to a mesh without file name path. + foreach(MeshModel * mp, meshDoc()->meshList) + { + if ((mp != NULL) && (mp->fullName().isEmpty())) + { + bool saved = exportMesh(tr(""),mp,false); + if (!saved) + { + QString msg = "Mesh layer " + mp->label() + " cannot be saved on a file.\nProject \"" + meshDoc()->docLabel() + "\" saving has been aborted."; + QMessageBox::warning(this,tr("Project Saving Aborted"),msg); + return; + } + } + } + QFileDialog* saveDiag = new QFileDialog(this,tr("Save Project File"),lastUsedDirectory.path().append(""), tr("MeshLab Project (*.mlp);;MeshLab Binary Project (*.mlb);;Align Project (*.aln)")); #if defined(Q_OS_WIN) - saveDiag->setOption(QFileDialog::DontUseNativeDialog); + saveDiag->setOption(QFileDialog::DontUseNativeDialog); #endif - QCheckBox* saveAllFile = new QCheckBox(QString("Save All Files"),saveDiag); - saveAllFile->setCheckState(Qt::Unchecked); - QCheckBox* onlyVisibleLayers = new QCheckBox(QString("Only Visible Layers"),saveDiag); - onlyVisibleLayers->setCheckState(Qt::Unchecked); + QCheckBox* saveAllFile = new QCheckBox(QString("Save All Files"),saveDiag); + saveAllFile->setCheckState(Qt::Unchecked); + QCheckBox* onlyVisibleLayers = new QCheckBox(QString("Only Visible Layers"),saveDiag); + onlyVisibleLayers->setCheckState(Qt::Unchecked); QCheckBox* saveViewState = new QCheckBox(QString("Save View State"), saveDiag); saveViewState->setCheckState(Qt::Checked); - QGridLayout* layout = qobject_cast(saveDiag->layout()); - if (layout != NULL) - { + QGridLayout* layout = qobject_cast(saveDiag->layout()); + if (layout != NULL) + { layout->addWidget(onlyVisibleLayers, 4, 0); layout->addWidget(saveViewState, 4, 1); layout->addWidget(saveAllFile, 4, 2); - } - saveDiag->setAcceptMode(QFileDialog::AcceptSave); - saveDiag->exec(); - QStringList files = saveDiag->selectedFiles(); - if (files.size() != 1) - return; - QString fileName = files[0]; - // this change of dir is needed for subsequent textures/materials loading - QFileInfo fi(fileName); - if (fi.isDir()) - return; - if (fi.suffix().isEmpty()) - { - QRegExp reg("\\.\\w+"); - saveDiag->selectedNameFilter().indexOf(reg); - QString ext = reg.cap(); - fileName.append(ext); - fi.setFile(fileName); - } - QDir::setCurrent(fi.absoluteDir().absolutePath()); - - /*********WARNING!!!!!! CHANGE IT!!! ALSO IN THE OPENPROJECT FUNCTION********/ - meshDoc()->setDocLabel(fileName); - QMdiSubWindow* sub = mdiarea->currentSubWindow(); - if (sub != NULL) - { - sub->setWindowTitle(meshDoc()->docLabel()); - layerDialog->setWindowTitle(meshDoc()->docLabel()); - } - /****************************************************************************/ - - - bool ret; + } + saveDiag->setAcceptMode(QFileDialog::AcceptSave); + saveDiag->exec(); + QStringList files = saveDiag->selectedFiles(); + if (files.size() != 1) + return; + QString fileName = files[0]; + // this change of dir is needed for subsequent textures/materials loading + QFileInfo fi(fileName); + if (fi.isDir()) + return; + if (fi.suffix().isEmpty()) + { + QRegExp reg("\\.\\w+"); + saveDiag->selectedNameFilter().indexOf(reg); + QString ext = reg.cap(); + fileName.append(ext); + fi.setFile(fileName); + } + QDir::setCurrent(fi.absoluteDir().absolutePath()); + + /*********WARNING!!!!!! CHANGE IT!!! ALSO IN THE OPENPROJECT FUNCTION********/ + meshDoc()->setDocLabel(fileName); + QMdiSubWindow* sub = mdiarea->currentSubWindow(); + if (sub != NULL) + { + sub->setWindowTitle(meshDoc()->docLabel()); + layerDialog->setWindowTitle(meshDoc()->docLabel()); + } + /****************************************************************************/ + + + bool ret; qDebug("Saving aln file %s\n", qUtf8Printable(fileName)); - if (fileName.isEmpty()) return; - else - { - //save path away so we can use it again - QString path = fileName; - path.truncate(path.lastIndexOf("/")); - lastUsedDirectory.setPath(path); - } - if (QString(fi.suffix()).toLower() == "aln") - { - vector meshNameVector; - vector transfVector; - - foreach(MeshModel * mp, meshDoc()->meshList) - { - if((!onlyVisibleLayers->isChecked()) || (mp->visible)) - { + if (fileName.isEmpty()) return; + else + { + //save path away so we can use it again + QString path = fileName; + path.truncate(path.lastIndexOf("/")); + lastUsedDirectory.setPath(path); + } + if (QString(fi.suffix()).toLower() == "aln") + { + vector meshNameVector; + vector transfVector; + + foreach(MeshModel * mp, meshDoc()->meshList) + { + if((!onlyVisibleLayers->isChecked()) || (mp->visible)) + { meshNameVector.push_back(qUtf8Printable(mp->relativePathName())); - transfVector.push_back(mp->cm.Tr); - } - } + transfVector.push_back(mp->cm.Tr); + } + } ret = ALNParser::SaveALN(qUtf8Printable(fileName), meshNameVector, transfVector); - } - else - { - std::map rendOpt; - foreach(MeshModel * mp, meshDoc()->meshList) - { - MLRenderingData ml; - getRenderingData(mp->id(), ml); - rendOpt.insert(std::pair(mp->id(), ml)); - } - ret = MeshDocumentToXMLFile(*meshDoc(), fileName, onlyVisibleLayers->isChecked(), saveViewState->isChecked(), QString(fi.suffix()).toLower() == "mlb", rendOpt); - } - - if (saveAllFile->isChecked()) - { - for(int ii = 0; ii < meshDoc()->meshList.size();++ii) - { - MeshModel* mp = meshDoc()->meshList[ii]; - if((!onlyVisibleLayers->isChecked()) || (mp->visible)) - { - ret |= exportMesh(mp->fullName(),mp,true); - } - } - } - if(!ret) - QMessageBox::critical(this, tr("Meshlab Saving Error"), QString("Unable to save project file %1\n").arg(fileName)); + } + else + { + std::map rendOpt; + foreach(MeshModel * mp, meshDoc()->meshList) + { + MLRenderingData ml; + getRenderingData(mp->id(), ml); + rendOpt.insert(std::pair(mp->id(), ml)); + } + ret = MeshDocumentToXMLFile(*meshDoc(), fileName, onlyVisibleLayers->isChecked(), saveViewState->isChecked(), QString(fi.suffix()).toLower() == "mlb", rendOpt); + } + + if (saveAllFile->isChecked()) + { + for(int ii = 0; ii < meshDoc()->meshList.size();++ii) + { + MeshModel* mp = meshDoc()->meshList[ii]; + if((!onlyVisibleLayers->isChecked()) || (mp->visible)) + { + ret |= exportMesh(mp->fullName(),mp,true); + } + } + } + if(!ret) + QMessageBox::critical(this, tr("Meshlab Saving Error"), QString("Unable to save project file %1\n").arg(fileName)); } bool MainWindow::openProject(QString fileName) { - bool visiblelayer = layerDialog->isVisible(); - //showLayerDlg(false); + bool visiblelayer = layerDialog->isVisible(); + //showLayerDlg(false); globrendtoolbar->setEnabled(false); - if (fileName.isEmpty()) - fileName = QFileDialog::getOpenFileName(this,tr("Open Project File"), lastUsedDirectory.path(), tr("All Project Files (*.mlp *.mlb *.aln *.out *.nvm);;MeshLab Project (*.mlp);;MeshLab Binary Project (*.mlb);;Align Project (*.aln);;Bundler Output (*.out);;VisualSFM Output (*.nvm)")); - - if (fileName.isEmpty()) return false; - - QFileInfo fi(fileName); - lastUsedDirectory = fi.absoluteDir(); - if((fi.suffix().toLower()!="aln") && (fi.suffix().toLower()!="mlp") && (fi.suffix().toLower() != "mlb") && (fi.suffix().toLower()!="out") && (fi.suffix().toLower()!="nvm")) - { - QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unknown project file extension"); - return false; - } - - // Common Part: init a Doc if necessary, and - bool activeDoc = (bool) !mdiarea->subWindowList().empty() && mdiarea->currentSubWindow(); - bool activeEmpty = activeDoc && meshDoc()->meshList.empty(); - - if (!activeEmpty) newProject(fileName); - - meshDoc()->setFileName(fileName); - mdiarea->currentSubWindow()->setWindowTitle(fileName); - meshDoc()->setDocLabel(fileName); - - meshDoc()->setBusy(true); - - // this change of dir is needed for subsequent textures/materials loading - QDir::setCurrent(fi.absoluteDir().absolutePath()); - qb->show(); - - if (QString(fi.suffix()).toLower() == "aln") - { - vector rmv; + if (fileName.isEmpty()) + fileName = QFileDialog::getOpenFileName(this,tr("Open Project File"), lastUsedDirectory.path(), tr("All Project Files (*.mlp *.mlb *.aln *.out *.nvm);;MeshLab Project (*.mlp);;MeshLab Binary Project (*.mlb);;Align Project (*.aln);;Bundler Output (*.out);;VisualSFM Output (*.nvm)")); + + if (fileName.isEmpty()) return false; + + QFileInfo fi(fileName); + lastUsedDirectory = fi.absoluteDir(); + if((fi.suffix().toLower()!="aln") && (fi.suffix().toLower()!="mlp") && (fi.suffix().toLower() != "mlb") && (fi.suffix().toLower()!="out") && (fi.suffix().toLower()!="nvm")) + { + QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unknown project file extension"); + return false; + } + + // Common Part: init a Doc if necessary, and + bool activeDoc = (bool) !mdiarea->subWindowList().empty() && mdiarea->currentSubWindow(); + bool activeEmpty = activeDoc && meshDoc()->meshList.empty(); + + if (!activeEmpty) newProject(fileName); + + meshDoc()->setFileName(fileName); + mdiarea->currentSubWindow()->setWindowTitle(fileName); + meshDoc()->setDocLabel(fileName); + + meshDoc()->setBusy(true); + + // this change of dir is needed for subsequent textures/materials loading + QDir::setCurrent(fi.absoluteDir().absolutePath()); + qb->show(); + + if (QString(fi.suffix()).toLower() == "aln") + { + vector rmv; int retVal = ALNParser::ParseALN(rmv, qUtf8Printable(fileName)); - if(retVal != ALNParser::NoError) - { - QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open ALN file"); - return false; - } - - bool openRes=true; - vector::iterator ir; - for(ir=rmv.begin();ir!=rmv.end() && openRes;++ir) - { - QString relativeToProj = fi.absoluteDir().absolutePath() + "/" + (*ir).filename.c_str(); - meshDoc()->addNewMesh(relativeToProj,relativeToProj); - openRes = loadMeshWithStandardParams(relativeToProj,this->meshDoc()->mm(),ir->trasformation); - if(!openRes) - meshDoc()->delMesh(meshDoc()->mm()); - } - } - - if (QString(fi.suffix()).toLower() == "mlp" || QString(fi.suffix()).toLower() == "mlb") - { - std::map rendOpt; - if (!MeshDocumentFromXML(*meshDoc(), fileName, (QString(fi.suffix()).toLower() == "mlb"), rendOpt)) - { - QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open MeshLab Project file"); - return false; - } + if(retVal != ALNParser::NoError) + { + QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open ALN file"); + return false; + } + + bool openRes=true; + vector::iterator ir; + for(ir=rmv.begin();ir!=rmv.end() && openRes;++ir) + { + QString relativeToProj = fi.absoluteDir().absolutePath() + "/" + (*ir).filename.c_str(); + meshDoc()->addNewMesh(relativeToProj,relativeToProj); + openRes = loadMeshWithStandardParams(relativeToProj,this->meshDoc()->mm(),ir->trasformation); + if(!openRes) + meshDoc()->delMesh(meshDoc()->mm()); + } + } + + if (QString(fi.suffix()).toLower() == "mlp" || QString(fi.suffix()).toLower() == "mlb") + { + std::map rendOpt; + if (!MeshDocumentFromXML(*meshDoc(), fileName, (QString(fi.suffix()).toLower() == "mlb"), rendOpt)) + { + QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open MeshLab Project file"); + return false; + } GLA()->updateMeshSetVisibilities(); - for (int i=0; imeshList.size(); i++) - { - QString fullPath = meshDoc()->meshList[i]->fullName(); - //meshDoc()->setBusy(true); - Matrix44m trm = this->meshDoc()->meshList[i]->cm.Tr; // save the matrix, because loadMeshClear it... - MLRenderingData* ptr = NULL; - if (rendOpt.find(meshDoc()->meshList[i]->id()) != rendOpt.end()) - ptr = &rendOpt[meshDoc()->meshList[i]->id()]; - if (!loadMeshWithStandardParams(fullPath, this->meshDoc()->meshList[i], trm, false, ptr)) - meshDoc()->delMesh(meshDoc()->meshList[i]); - } - } - - ////// BUNDLER - if (QString(fi.suffix()).toLower() == "out"){ - - QString cameras_filename = fileName; - QString image_list_filename; - QString model_filename; - - image_list_filename = QFileDialog::getOpenFileName( - this , tr("Open image list file"), - QFileInfo(fileName).absolutePath(), - tr("Bundler images list file (*.txt)") - ); - if(image_list_filename.isEmpty()) - return false; - - if(!MeshDocumentFromBundler(*meshDoc(),cameras_filename,image_list_filename,model_filename)){ - QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open OUTs file"); - return false; - } - - -//WARNING!!!!! i suppose it's not useful anymore but....... -/*GLA()->setColorMode(GLW::CMPerVert); + for (int i=0; imeshList.size(); i++) + { + QString fullPath = meshDoc()->meshList[i]->fullName(); + //meshDoc()->setBusy(true); + Matrix44m trm = this->meshDoc()->meshList[i]->cm.Tr; // save the matrix, because loadMeshClear it... + MLRenderingData* ptr = NULL; + if (rendOpt.find(meshDoc()->meshList[i]->id()) != rendOpt.end()) + ptr = &rendOpt[meshDoc()->meshList[i]->id()]; + if (!loadMeshWithStandardParams(fullPath, this->meshDoc()->meshList[i], trm, false, ptr)) + meshDoc()->delMesh(meshDoc()->meshList[i]); + } + } + + ////// BUNDLER + if (QString(fi.suffix()).toLower() == "out"){ + + QString cameras_filename = fileName; + QString image_list_filename; + QString model_filename; + + image_list_filename = QFileDialog::getOpenFileName( + this , tr("Open image list file"), + QFileInfo(fileName).absolutePath(), + tr("Bundler images list file (*.txt)") + ); + if(image_list_filename.isEmpty()) + return false; + + if(!MeshDocumentFromBundler(*meshDoc(),cameras_filename,image_list_filename,model_filename)){ + QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open OUTs file"); + return false; + } + + + //WARNING!!!!! i suppose it's not useful anymore but....... + /*GLA()->setColorMode(GLW::CMPerVert); GLA()->setDrawMode(GLW::DMPoints);*/ -///////////////////////////////////////////////////////// - } - - //////NVM - if (QString(fi.suffix()).toLower() == "nvm"){ - - QString cameras_filename = fileName; - QString model_filename; - - if(!MeshDocumentFromNvm(*meshDoc(),cameras_filename,model_filename)){ - QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open NVMs file"); - return false; - } -//WARNING!!!!! i suppose it's not useful anymore but....... -/*GLA()->setColorMode(GLW::CMPerVert); + ///////////////////////////////////////////////////////// + } + + //////NVM + if (QString(fi.suffix()).toLower() == "nvm"){ + + QString cameras_filename = fileName; + QString model_filename; + + if(!MeshDocumentFromNvm(*meshDoc(),cameras_filename,model_filename)){ + QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open NVMs file"); + return false; + } + //WARNING!!!!! i suppose it's not useful anymore but....... + /*GLA()->setColorMode(GLW::CMPerVert); GLA()->setDrawMode(GLW::DMPoints);*/ -///////////////////////////////////////////////////////// - } - - meshDoc()->setBusy(false); - if(this->GLA() == 0) return false; - - MultiViewer_Container* mvc = currentViewContainer(); + ///////////////////////////////////////////////////////// + } + + meshDoc()->setBusy(false); + if(this->GLA() == 0) return false; + + MultiViewer_Container* mvc = currentViewContainer(); if (mvc != NULL) { mvc->resetAllTrackBall(); mvc->updateAllDecoratorsForAllViewers(); } - + setCurrentMeshBestTab(); - qb->reset(); - saveRecentProjectList(fileName); + qb->reset(); + saveRecentProjectList(fileName); globrendtoolbar->setEnabled(true); - showLayerDlg(visiblelayer || (meshDoc()->meshList.size() > 0)); - - return true; + showLayerDlg(visiblelayer || (meshDoc()->meshList.size() > 0)); + + return true; } bool MainWindow::appendProject(QString fileName) { - QStringList fileNameList; + QStringList fileNameList; globrendtoolbar->setEnabled(false); - if (fileName.isEmpty()) - fileNameList = QFileDialog::getOpenFileNames(this, tr("Append Project File"), lastUsedDirectory.path(), "All Project Files (*.mlp *.mlb *.aln *.out *.nvm);;MeshLab Project (*.mlp);;MeshLab Binary Project (*.mlb);;Align Project (*.aln);;Bundler Output (*.out);;VisualSFM Output (*.nvm)"); - else - fileNameList.append(fileName); - - if (fileNameList.isEmpty()) return false; - - // Ccheck if we have a doc and if it is empty - bool activeDoc = (bool) !mdiarea->subWindowList().empty() && mdiarea->currentSubWindow(); + if (fileName.isEmpty()) + fileNameList = QFileDialog::getOpenFileNames(this, tr("Append Project File"), lastUsedDirectory.path(), "All Project Files (*.mlp *.mlb *.aln *.out *.nvm);;MeshLab Project (*.mlp);;MeshLab Binary Project (*.mlb);;Align Project (*.aln);;Bundler Output (*.out);;VisualSFM Output (*.nvm)"); + else + fileNameList.append(fileName); + + if (fileNameList.isEmpty()) return false; + + // Ccheck if we have a doc and if it is empty + bool activeDoc = (bool) !mdiarea->subWindowList().empty() && mdiarea->currentSubWindow(); if (!activeDoc || meshDoc()->meshList.empty()) // it is wrong to try appending to an empty project, even if it is possible - { - QMessageBox::critical(this, tr("Meshlab Opening Error"), "Current project is empty, cannot append"); - return false; - } - - meshDoc()->setBusy(true); - - // load all projects - foreach(fileName,fileNameList) - { - QFileInfo fi(fileName); - lastUsedDirectory = fi.absoluteDir(); - - if((fi.suffix().toLower()!="aln") && (fi.suffix().toLower()!="mlp") && (fi.suffix().toLower() != "mlb") && (fi.suffix().toLower() != "out") && (fi.suffix().toLower() != "nvm")) - { - QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unknown project file extension"); - return false; - } - - // this change of dir is needed for subsequent textures/materials loading - QDir::setCurrent(fi.absoluteDir().absolutePath()); - qb->show(); - - if (QString(fi.suffix()).toLower() == "aln") - { - vector rmv; + { + QMessageBox::critical(this, tr("Meshlab Opening Error"), "Current project is empty, cannot append"); + return false; + } + + meshDoc()->setBusy(true); + + // load all projects + foreach(fileName,fileNameList) + { + QFileInfo fi(fileName); + lastUsedDirectory = fi.absoluteDir(); + + if((fi.suffix().toLower()!="aln") && (fi.suffix().toLower()!="mlp") && (fi.suffix().toLower() != "mlb") && (fi.suffix().toLower() != "out") && (fi.suffix().toLower() != "nvm")) + { + QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unknown project file extension"); + return false; + } + + // this change of dir is needed for subsequent textures/materials loading + QDir::setCurrent(fi.absoluteDir().absolutePath()); + qb->show(); + + if (QString(fi.suffix()).toLower() == "aln") + { + vector rmv; int retVal = ALNParser::ParseALN(rmv, qUtf8Printable(fileName)); - if(retVal != ALNParser::NoError) - { - QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open ALN file"); - return false; - } - - for(vector::iterator ir=rmv.begin();ir!=rmv.end();++ir) - { - QString relativeToProj = fi.absoluteDir().absolutePath() + "/" + (*ir).filename.c_str(); - meshDoc()->addNewMesh(relativeToProj,relativeToProj); - if(!loadMeshWithStandardParams(relativeToProj,this->meshDoc()->mm(),(*ir).trasformation)) - meshDoc()->delMesh(meshDoc()->mm()); - } - } - - if (QString(fi.suffix()).toLower() == "mlp" || QString(fi.suffix()).toLower() == "mlb") - { + if(retVal != ALNParser::NoError) + { + QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open ALN file"); + return false; + } + + for(vector::iterator ir=rmv.begin();ir!=rmv.end();++ir) + { + QString relativeToProj = fi.absoluteDir().absolutePath() + "/" + (*ir).filename.c_str(); + meshDoc()->addNewMesh(relativeToProj,relativeToProj); + if(!loadMeshWithStandardParams(relativeToProj,this->meshDoc()->mm(),(*ir).trasformation)) + meshDoc()->delMesh(meshDoc()->mm()); + } + } + + if (QString(fi.suffix()).toLower() == "mlp" || QString(fi.suffix()).toLower() == "mlb") + { int alreadyLoadedNum = meshDoc()->meshList.size(); - std::map rendOpt; - if (!MeshDocumentFromXML(*meshDoc(),fileName, QString(fi.suffix()).toLower() == "mlb", rendOpt)) - { - QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open MeshLab Project file"); - return false; - } + std::map rendOpt; + if (!MeshDocumentFromXML(*meshDoc(),fileName, QString(fi.suffix()).toLower() == "mlb", rendOpt)) + { + QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open MeshLab Project file"); + return false; + } GLA()->updateMeshSetVisibilities(); for (int i = alreadyLoadedNum; imeshList.size(); i++) - { - QString fullPath = meshDoc()->meshList[i]->fullName(); - meshDoc()->setBusy(true); - Matrix44m trm = this->meshDoc()->meshList[i]->cm.Tr; // save the matrix, because loadMeshClear it... - MLRenderingData* ptr = NULL; - if (rendOpt.find(meshDoc()->meshList[i]->id()) != rendOpt.end()) - ptr = &rendOpt[meshDoc()->meshList[i]->id()]; - if(!loadMeshWithStandardParams(fullPath,this->meshDoc()->meshList[i],trm, false, ptr)) - meshDoc()->delMesh(meshDoc()->meshList[i]); - } - } - - if (QString(fi.suffix()).toLower() == "out") { - - QString cameras_filename = fileName; - QString image_list_filename; - QString model_filename; - - image_list_filename = QFileDialog::getOpenFileName( - this, tr("Open image list file"), - QFileInfo(fileName).absolutePath(), - tr("Bundler images list file (*.txt)") - ); - if (image_list_filename.isEmpty()) - return false; - - if (!MeshDocumentFromBundler(*meshDoc(), cameras_filename, image_list_filename, model_filename)) { - QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open OUTs file"); - return false; - } - } - - if (QString(fi.suffix()).toLower() == "nvm") { - - QString cameras_filename = fileName; - QString model_filename; - - if (!MeshDocumentFromNvm(*meshDoc(), cameras_filename, model_filename)) { - QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open NVMs file"); - return false; - } - } - } - + { + QString fullPath = meshDoc()->meshList[i]->fullName(); + meshDoc()->setBusy(true); + Matrix44m trm = this->meshDoc()->meshList[i]->cm.Tr; // save the matrix, because loadMeshClear it... + MLRenderingData* ptr = NULL; + if (rendOpt.find(meshDoc()->meshList[i]->id()) != rendOpt.end()) + ptr = &rendOpt[meshDoc()->meshList[i]->id()]; + if(!loadMeshWithStandardParams(fullPath,this->meshDoc()->meshList[i],trm, false, ptr)) + meshDoc()->delMesh(meshDoc()->meshList[i]); + } + } + + if (QString(fi.suffix()).toLower() == "out") { + + QString cameras_filename = fileName; + QString image_list_filename; + QString model_filename; + + image_list_filename = QFileDialog::getOpenFileName( + this, tr("Open image list file"), + QFileInfo(fileName).absolutePath(), + tr("Bundler images list file (*.txt)") + ); + if (image_list_filename.isEmpty()) + return false; + + if (!MeshDocumentFromBundler(*meshDoc(), cameras_filename, image_list_filename, model_filename)) { + QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open OUTs file"); + return false; + } + } + + if (QString(fi.suffix()).toLower() == "nvm") { + + QString cameras_filename = fileName; + QString model_filename; + + if (!MeshDocumentFromNvm(*meshDoc(), cameras_filename, model_filename)) { + QMessageBox::critical(this, tr("Meshlab Opening Error"), "Unable to open NVMs file"); + return false; + } + } + } + globrendtoolbar->setEnabled(true); - meshDoc()->setBusy(false); - if(this->GLA() == 0) return false; + meshDoc()->setBusy(false); + if(this->GLA() == 0) return false; MultiViewer_Container* mvc = currentViewContainer(); if (mvc != NULL) { mvc->updateAllDecoratorsForAllViewers(); mvc->resetAllTrackBall(); } - + setCurrentMeshBestTab(); - qb->reset(); - saveRecentProjectList(fileName); - return true; + qb->reset(); + saveRecentProjectList(fileName); + return true; } void MainWindow::setCurrentMeshBestTab() { if (layerDialog == NULL) return; - + MultiViewer_Container* mvc = currentViewContainer(); if (mvc != NULL) { @@ -1859,39 +1863,39 @@ void MainWindow::setCurrentMeshBestTab() void MainWindow::newProject(const QString& projName) { - if (gpumeminfo == NULL) - return; - MultiViewer_Container *mvcont = new MultiViewer_Container(*gpumeminfo,mwsettings.highprecision,mwsettings.perbatchprimitives,mwsettings.minpolygonpersmoothrendering,mdiarea); - connect(&mvcont->meshDoc,SIGNAL(meshAdded(int)),this,SLOT(meshAdded(int))); - connect(&mvcont->meshDoc,SIGNAL(meshRemoved(int)),this,SLOT(meshRemoved(int))); + if (gpumeminfo == NULL) + return; + MultiViewer_Container *mvcont = new MultiViewer_Container(*gpumeminfo,mwsettings.highprecision,mwsettings.perbatchprimitives,mwsettings.minpolygonpersmoothrendering,mdiarea); + connect(&mvcont->meshDoc,SIGNAL(meshAdded(int)),this,SLOT(meshAdded(int))); + connect(&mvcont->meshDoc,SIGNAL(meshRemoved(int)),this,SLOT(meshRemoved(int))); connect(&mvcont->meshDoc, SIGNAL(documentUpdated()), this, SLOT(documentUpdateRequested())); connect(mvcont, SIGNAL(closingMultiViewerContainer()), this, SLOT(closeCurrentDocument())); - mdiarea->addSubWindow(mvcont); - connect(mvcont,SIGNAL(updateMainWindowMenus()),this,SLOT(updateMenus())); - connect(mvcont,SIGNAL(updateDocumentViewer()),this,SLOT(updateLayerDialog())); + mdiarea->addSubWindow(mvcont); + connect(mvcont,SIGNAL(updateMainWindowMenus()),this,SLOT(updateMenus())); + connect(mvcont,SIGNAL(updateDocumentViewer()),this,SLOT(updateLayerDialog())); connect(&mvcont->meshDoc.Log, SIGNAL(logUpdated()), this, SLOT(updateLog())); - filterMenu->setEnabled(!filterMenu->actions().isEmpty()); - if (!filterMenu->actions().isEmpty()) - updateSubFiltersMenu(true,false); - GLArea *gla=new GLArea(this, mvcont, ¤tGlobalParams); + filterMenu->setEnabled(!filterMenu->actions().isEmpty()); + if (!filterMenu->actions().isEmpty()) + updateSubFiltersMenu(true,false); + GLArea *gla=new GLArea(this, mvcont, ¤tGlobalParams); //connect(gla, SIGNAL(insertRenderingDataForNewlyGeneratedMesh(int)), this, SLOT(addRenderingDataIfNewlyGeneratedMesh(int))); - mvcont->addView(gla, Qt::Horizontal); - - if (projName.isEmpty()) - { - static int docCounter = 1; - mvcont->meshDoc.setDocLabel(QString("Project_") + QString::number(docCounter)); - ++docCounter; - } - else - mvcont->meshDoc.setDocLabel(projName); - mvcont->setWindowTitle(mvcont->meshDoc.docLabel()); + mvcont->addView(gla, Qt::Horizontal); + + if (projName.isEmpty()) + { + static int docCounter = 1; + mvcont->meshDoc.setDocLabel(QString("Project_") + QString::number(docCounter)); + ++docCounter; + } + else + mvcont->meshDoc.setDocLabel(projName); + mvcont->setWindowTitle(mvcont->meshDoc.docLabel()); if (layerDialog != NULL) layerDialog->reset(); //if(mdiarea->isVisible()) - updateLayerDialog(); - mvcont->showMaximized(); - connect(mvcont->sharedDataContext(),SIGNAL(currentAllocatedGPUMem(int,int,int,int)),this,SLOT(updateGPUMemBar(int,int,int,int))); + updateLayerDialog(); + mvcont->showMaximized(); + connect(mvcont->sharedDataContext(),SIGNAL(currentAllocatedGPUMem(int,int,int,int)),this,SLOT(updateGPUMemBar(int,int,int,int))); } void MainWindow::documentUpdateRequested() @@ -1917,8 +1921,8 @@ void MainWindow::documentUpdateRequested() void MainWindow::updateGPUMemBar(int nv_allmem, int nv_currentallocated, int ati_free_tex, int ati_free_vbo) { #ifdef Q_OS_WIN - if (nvgpumeminfo != NULL) - { + if (nvgpumeminfo != NULL) + { if (nv_allmem + nv_currentallocated > 0) { nvgpumeminfo->setFormat("Mem %p% %v/%m MB"); @@ -1944,14 +1948,14 @@ void MainWindow::updateGPUMemBar(int nv_allmem, int nv_currentallocated, int ati nvgpumeminfo->setValue(0); nvgpumeminfo->setFixedWidth(300); } - } + } #else - //avoid unused parameter warning - (void) nv_allmem; - (void) nv_currentallocated; - (void) ati_free_tex; - (void) ati_free_vbo; - nvgpumeminfo->hide(); + //avoid unused parameter warning + (void) nv_allmem; + (void) nv_currentallocated; + (void) ati_free_tex; + (void) ati_free_vbo; + nvgpumeminfo->hide(); #endif } //WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -1968,47 +1972,47 @@ bool MainWindow::importRaster(const QString& fileImg) if (!GLA()) return false; } - - QStringList filters; - filters.push_back("Images (*.jpg *.png *.xpm)"); - filters.push_back("*.jpg"); - filters.push_back("*.png"); - filters.push_back("*.xpm"); - - QStringList fileNameList; - if (fileImg.isEmpty()) - fileNameList = QFileDialog::getOpenFileNames(this,tr("Open File"), lastUsedDirectory.path(), filters.join(";;")); - else - fileNameList.push_back(fileImg); - - foreach(QString fileName,fileNameList) - { - QFileInfo fi(fileName); - if( fi.suffix().toLower()=="png" || fi.suffix().toLower()=="xpm" || fi.suffix().toLower()=="jpg") - { - qb->show(); - - if(!fi.exists()) { - QString errorMsgFormat = "Unable to open file:\n\"%1\"\n\nError details: file %1 does not exist."; - QMessageBox::critical(this, tr("Meshlab Opening Error"), errorMsgFormat.arg(fileName)); - return false; - } - if(!fi.isReadable()) { - QString errorMsgFormat = "Unable to open file:\n\"%1\"\n\nError details: file %1 is not readable."; - QMessageBox::critical(this, tr("Meshlab Opening Error"), errorMsgFormat.arg(fileName)); - return false; - } - - this->meshDoc()->setBusy(true); - RasterModel *rm= meshDoc()->addNewRaster(); - rm->setLabel(fileImg); - rm->addPlane(new Plane(fileName,Plane::RGBA)); - meshDoc()->setBusy(false); - showLayerDlg(true); - + + QStringList filters; + filters.push_back("Images (*.jpg *.png *.xpm)"); + filters.push_back("*.jpg"); + filters.push_back("*.png"); + filters.push_back("*.xpm"); + + QStringList fileNameList; + if (fileImg.isEmpty()) + fileNameList = QFileDialog::getOpenFileNames(this,tr("Open File"), lastUsedDirectory.path(), filters.join(";;")); + else + fileNameList.push_back(fileImg); + + foreach(QString fileName,fileNameList) + { + QFileInfo fi(fileName); + if( fi.suffix().toLower()=="png" || fi.suffix().toLower()=="xpm" || fi.suffix().toLower()=="jpg") + { + qb->show(); + + if(!fi.exists()) { + QString errorMsgFormat = "Unable to open file:\n\"%1\"\n\nError details: file %1 does not exist."; + QMessageBox::critical(this, tr("Meshlab Opening Error"), errorMsgFormat.arg(fileName)); + return false; + } + if(!fi.isReadable()) { + QString errorMsgFormat = "Unable to open file:\n\"%1\"\n\nError details: file %1 is not readable."; + QMessageBox::critical(this, tr("Meshlab Opening Error"), errorMsgFormat.arg(fileName)); + return false; + } + + this->meshDoc()->setBusy(true); + RasterModel *rm= meshDoc()->addNewRaster(); + rm->setLabel(fileImg); + rm->addPlane(new Plane(fileName,Plane::RGBA)); + meshDoc()->setBusy(false); + showLayerDlg(true); + /// Intrinsics extraction from EXIF - /// If no CCD Width value is provided, the intrinsics are extracted using the Equivalent 35mm focal - /// If no or invalid EXIF info is found, the Intrinsics are initialized as a "plausible" 35mm sensor, with 50mm focal + /// If no CCD Width value is provided, the intrinsics are extracted using the Equivalent 35mm focal + /// If no or invalid EXIF info is found, the Intrinsics are initialized as a "plausible" 35mm sensor, with 50mm focal // Read the JPEG file into a buffer FILE *fp = fopen(qUtf8Printable(fileName), "rb"); @@ -2054,148 +2058,147 @@ bool MainWindow::importRaster(const QString& fileImg) rm->shot.Intrinsics.PixelSizeMm[1]=(24.0f*ratioFocal)/(float)ImageInfo.ImageHeight; rm->shot.Intrinsics.FocalMm = ImageInfo.FocalLength; } - // End of EXIF reading - + //// Since no extrinsic are available, the current trackball is reset (except for the FOV) and assigned to the raster GLA()->resetTrackBall(); GLA()->fov = rm->shot.GetFovFromFocal(); rm->shot = GLA()->shotFromTrackball().first; GLA()->resetTrackBall(); // and then we reset the trackball again, to have the standard view - + if (_currviewcontainer != NULL) _currviewcontainer->updateAllDecoratorsForAllViewers(); - - // if(mdiarea->isVisible()) GLA()->mvc->showMaximized(); - updateMenus(); - updateLayerDialog(); - - } - else - return false; - } - return true; + + // if(mdiarea->isVisible()) GLA()->mvc->showMaximized(); + updateMenus(); + updateLayerDialog(); + + } + else + return false; + } + return true; } -bool MainWindow::loadMesh(const QString& fileName, MeshIOInterface *pCurrentIOPlugin, MeshModel* mm, int& mask,RichParameterList* prePar, const Matrix44m &mtr, bool isareload, MLRenderingData* rendOpt) +bool MainWindow::loadMesh(const QString& fileName, IOPluginInterface *pCurrentIOPlugin, MeshModel* mm, int& mask,RichParameterList* prePar, const Matrix44m &mtr, bool isareload, MLRenderingData* rendOpt) { - if ((GLA() == NULL) || (mm == NULL)) - return false; - - QFileInfo fi(fileName); - QString extension = fi.suffix(); - if(!fi.exists()) - { - QString errorMsgFormat = "Unable to open file:\n\"%1\"\n\nError details: file %1 does not exist."; - QMessageBox::critical(this, tr("Meshlab Opening Error"), errorMsgFormat.arg(fileName)); - return false; - } - if(!fi.isReadable()) - { - QString errorMsgFormat = "Unable to open file:\n\"%1\"\n\nError details: file %1 is not readable."; - QMessageBox::critical(this, tr("Meshlab Opening Error"), errorMsgFormat.arg(fileName)); - return false; - } - - // the original directory path before we switch it - QString origDir = QDir::current().path(); - - // this change of dir is needed for subsequent textures/materials loading - QDir::setCurrent(fi.absoluteDir().absolutePath()); - - // Adjust the file name after changing the directory - QString fileNameSansDir = fi.fileName(); - - // retrieving corresponding IO plugin - if (pCurrentIOPlugin == 0) - { - QString errorMsgFormat = "Error encountered while opening file:\n\"%1\"\n\nError details: The \"%2\" file extension does not correspond to any supported format."; - QMessageBox::critical(this, tr("Opening Error"), errorMsgFormat.arg(fileName, extension)); - QDir::setCurrent(origDir); // undo the change of directory before leaving - return false; - } - meshDoc()->setBusy(true); - pCurrentIOPlugin->setLog(&meshDoc()->Log); - - if (!pCurrentIOPlugin->open(extension, fileNameSansDir, *mm ,mask,*prePar,QCallBack,this /*gla*/)) - { - QMessageBox::warning(this, tr("Opening Failure"), QString("While opening: '%1'\n\n").arg(fileName)+pCurrentIOPlugin->errorMsg()); // text+ - pCurrentIOPlugin->clearErrorString(); - meshDoc()->setBusy(false); - QDir::setCurrent(origDir); // undo the change of directory before leaving - return false; - } - - + if ((GLA() == NULL) || (mm == NULL)) + return false; + + QFileInfo fi(fileName); + QString extension = fi.suffix(); + if(!fi.exists()) + { + QString errorMsgFormat = "Unable to open file:\n\"%1\"\n\nError details: file %1 does not exist."; + QMessageBox::critical(this, tr("Meshlab Opening Error"), errorMsgFormat.arg(fileName)); + return false; + } + if(!fi.isReadable()) + { + QString errorMsgFormat = "Unable to open file:\n\"%1\"\n\nError details: file %1 is not readable."; + QMessageBox::critical(this, tr("Meshlab Opening Error"), errorMsgFormat.arg(fileName)); + return false; + } + + // the original directory path before we switch it + QString origDir = QDir::current().path(); + + // this change of dir is needed for subsequent textures/materials loading + QDir::setCurrent(fi.absoluteDir().absolutePath()); + + // Adjust the file name after changing the directory + QString fileNameSansDir = fi.fileName(); + + // retrieving corresponding IO plugin + if (pCurrentIOPlugin == 0) + { + QString errorMsgFormat = "Error encountered while opening file:\n\"%1\"\n\nError details: The \"%2\" file extension does not correspond to any supported format."; + QMessageBox::critical(this, tr("Opening Error"), errorMsgFormat.arg(fileName, extension)); + QDir::setCurrent(origDir); // undo the change of directory before leaving + return false; + } + meshDoc()->setBusy(true); + pCurrentIOPlugin->setLog(&meshDoc()->Log); + + if (!pCurrentIOPlugin->open(extension, fileNameSansDir, *mm ,mask,*prePar,QCallBack,this /*gla*/)) + { + QMessageBox::warning(this, tr("Opening Failure"), QString("While opening: '%1'\n\n").arg(fileName)+pCurrentIOPlugin->errorMsg()); // text+ + pCurrentIOPlugin->clearErrorString(); + meshDoc()->setBusy(false); + QDir::setCurrent(origDir); // undo the change of directory before leaving + return false; + } + + //std::cout << "Opened mesh: in " << tm.elapsed() << " secs\n"; // After opening the mesh lets ask to the io plugin if this format - // requires some optional, or userdriven post-opening processing. - // and in that case ask for the required parameters and then - // ask to the plugin to perform that processing - //RichParameterSet par; - //pCurrentIOPlugin->initOpenParameter(extension, *mm, par); - //pCurrentIOPlugin->applyOpenParameter(extension, *mm, par); - - QString err = pCurrentIOPlugin->errorMsg(); - if (!err.isEmpty()) - { - QMessageBox::warning(this, tr("Opening Problems"), QString("While opening: '%1'\n\n").arg(fileName)+pCurrentIOPlugin->errorMsg()); - pCurrentIOPlugin->clearErrorString(); - } - - saveRecentFileList(fileName); - - if (!(mm->cm.textures.empty())) - updateTexture(mm->id()); - - // In case of polygonal meshes the normal should be updated accordingly - if( mask & vcg::tri::io::Mask::IOM_BITPOLYGONAL) - { - mm->updateDataMask(MeshModel::MM_POLYGONAL); // just to be sure. Hopefully it should be done in the plugin... - int degNum = tri::Clean::RemoveDegenerateFace(mm->cm); - if(degNum) - GLA()->Logf(0,"Warning model contains %i degenerate faces. Removed them.",degNum); - mm->updateDataMask(MeshModel::MM_FACEFACETOPO); - vcg::tri::UpdateNormal::PerBitQuadFaceNormalized(mm->cm); - vcg::tri::UpdateNormal::PerVertexFromCurrentFaceNormal(mm->cm); - } // standard case - else - { - vcg::tri::UpdateNormal::PerFaceNormalized(mm->cm); - if(!( mask & vcg::tri::io::Mask::IOM_VERTNORMAL) ) - vcg::tri::UpdateNormal::PerVertexAngleWeighted(mm->cm); - } - - vcg::tri::UpdateBounding::Box(mm->cm); // updates bounding box - if(mm->cm.fn==0 && mm->cm.en==0) - { - if(mask & vcg::tri::io::Mask::IOM_VERTNORMAL) - mm->updateDataMask(MeshModel::MM_VERTNORMAL); - } - - if(mm->cm.fn==0 && mm->cm.en>0) - { - if (mask & vcg::tri::io::Mask::IOM_VERTNORMAL) - mm->updateDataMask(MeshModel::MM_VERTNORMAL); - } - - updateMenus(); - int delVertNum = vcg::tri::Clean::RemoveDegenerateVertex(mm->cm); - int delFaceNum = vcg::tri::Clean::RemoveDegenerateFace(mm->cm); - tri::Allocator::CompactEveryVector(mm->cm); - if(delVertNum>0 || delFaceNum>0 ) - QMessageBox::warning(this, "MeshLab Warning", QString("Warning mesh contains %1 vertices with NAN coords and %2 degenerated faces.\nCorrected.").arg(delVertNum).arg(delFaceNum) ); - mm->cm.Tr = mtr; - + // requires some optional, or userdriven post-opening processing. + // and in that case ask for the required parameters and then + // ask to the plugin to perform that processing + //RichParameterSet par; + //pCurrentIOPlugin->initOpenParameter(extension, *mm, par); + //pCurrentIOPlugin->applyOpenParameter(extension, *mm, par); + + QString err = pCurrentIOPlugin->errorMsg(); + if (!err.isEmpty()) + { + QMessageBox::warning(this, tr("Opening Problems"), QString("While opening: '%1'\n\n").arg(fileName)+pCurrentIOPlugin->errorMsg()); + pCurrentIOPlugin->clearErrorString(); + } + + saveRecentFileList(fileName); + + if (!(mm->cm.textures.empty())) + updateTexture(mm->id()); + + // In case of polygonal meshes the normal should be updated accordingly + if( mask & vcg::tri::io::Mask::IOM_BITPOLYGONAL) + { + mm->updateDataMask(MeshModel::MM_POLYGONAL); // just to be sure. Hopefully it should be done in the plugin... + int degNum = tri::Clean::RemoveDegenerateFace(mm->cm); + if(degNum) + GLA()->Logf(0,"Warning model contains %i degenerate faces. Removed them.",degNum); + mm->updateDataMask(MeshModel::MM_FACEFACETOPO); + vcg::tri::UpdateNormal::PerBitQuadFaceNormalized(mm->cm); + vcg::tri::UpdateNormal::PerVertexFromCurrentFaceNormal(mm->cm); + } // standard case + else + { + vcg::tri::UpdateNormal::PerFaceNormalized(mm->cm); + if(!( mask & vcg::tri::io::Mask::IOM_VERTNORMAL) ) + vcg::tri::UpdateNormal::PerVertexAngleWeighted(mm->cm); + } + + vcg::tri::UpdateBounding::Box(mm->cm); // updates bounding box + if(mm->cm.fn==0 && mm->cm.en==0) + { + if(mask & vcg::tri::io::Mask::IOM_VERTNORMAL) + mm->updateDataMask(MeshModel::MM_VERTNORMAL); + } + + if(mm->cm.fn==0 && mm->cm.en>0) + { + if (mask & vcg::tri::io::Mask::IOM_VERTNORMAL) + mm->updateDataMask(MeshModel::MM_VERTNORMAL); + } + + updateMenus(); + int delVertNum = vcg::tri::Clean::RemoveDegenerateVertex(mm->cm); + int delFaceNum = vcg::tri::Clean::RemoveDegenerateFace(mm->cm); + tri::Allocator::CompactEveryVector(mm->cm); + if(delVertNum>0 || delFaceNum>0 ) + QMessageBox::warning(this, "MeshLab Warning", QString("Warning mesh contains %1 vertices with NAN coords and %2 degenerated faces.\nCorrected.").arg(delVertNum).arg(delFaceNum) ); + mm->cm.Tr = mtr; + computeRenderingDataOnLoading(mm,isareload, rendOpt); updateLayerDialog(); - - - meshDoc()->setBusy(false); - - QDir::setCurrent(origDir); // undo the change of directory before leaving - - return true; + + + meshDoc()->setBusy(false); + + QDir::setCurrent(origDir); // undo the change of directory before leaving + + return true; } void MainWindow::computeRenderingDataOnLoading(MeshModel* mm,bool isareload, MLRenderingData* rendOpt) @@ -2207,9 +2210,9 @@ void MainWindow::computeRenderingDataOnLoading(MeshModel* mm,bool isareload, MLR if ((shared != NULL) && (mm != NULL)) { MLRenderingData defdt; - MLPoliciesStandAloneFunctions::suggestedDefaultPerViewRenderingData(mm, defdt,mwsettings.minpolygonpersmoothrendering); - if (rendOpt != NULL) - defdt = *rendOpt; + MLPoliciesStandAloneFunctions::suggestedDefaultPerViewRenderingData(mm, defdt,mwsettings.minpolygonpersmoothrendering); + if (rendOpt != NULL) + defdt = *rendOpt; for (int glarid = 0; glarid < mv->viewerCounter(); ++glarid) { GLArea* ar = mv->getViewer(glarid); @@ -2238,194 +2241,194 @@ void MainWindow::computeRenderingDataOnLoading(MeshModel* mm,bool isareload, MLR bool MainWindow::importMeshWithLayerManagement(QString fileName) { - bool layervisible = false; - if (layerDialog != NULL) - { - layervisible = layerDialog->isVisible(); - //showLayerDlg(false); - } + bool layervisible = false; + if (layerDialog != NULL) + { + layervisible = layerDialog->isVisible(); + //showLayerDlg(false); + } globrendtoolbar->setEnabled(false); - bool res = importMesh(fileName,false); + bool res = importMesh(fileName,false); globrendtoolbar->setEnabled(true); if (layerDialog != NULL) showLayerDlg(layervisible || meshDoc()->meshList.size()); setCurrentMeshBestTab(); - return res; + return res; } // Opening files in a transparent form (IO plugins contribution is hidden to user) bool MainWindow::importMesh(QString fileName,bool isareload) { - if (!GLA()) - { - this->newProject(); - if(!GLA()) - return false; - } - - - //QStringList suffixList; - // HashTable storing all supported formats together with - // the (1-based) index of first plugin which is able to open it - //QHash allKnownFormats; - //PM.LoadFormats(suffixList, allKnownFormats,PluginManager::IMPORT); - QStringList fileNameList; - if (fileName.isEmpty()) - fileNameList = QFileDialog::getOpenFileNames(this,tr("Import Mesh"), lastUsedDirectory.path(), PM.inpFilters.join(";;")); - else - fileNameList.push_back(fileName); - - if (fileNameList.isEmpty()) return false; - else - { - //save path away so we can use it again - QString path = fileNameList.first(); - path.truncate(path.lastIndexOf("/")); - lastUsedDirectory.setPath(path); - } - - QElapsedTimer allFileTime; - allFileTime.start(); - foreach(fileName,fileNameList) - { - QFileInfo fi(fileName); - QString extension = fi.suffix(); - MeshIOInterface *pCurrentIOPlugin = PM.allKnowInputFormats[extension.toLower()]; - //pCurrentIOPlugin->setLog(gla->log); - if (pCurrentIOPlugin == NULL) - { - QString errorMsgFormat("Unable to open file:\n\"%1\"\n\nError details: file format " + extension + " not supported."); - QMessageBox::critical(this, tr("Meshlab Opening Error"), errorMsgFormat.arg(fileName)); - return false; - } - - RichParameterList prePar; - pCurrentIOPlugin->initPreOpenParameter(extension, fileName,prePar); - if(!prePar.isEmpty()) - { + if (!GLA()) + { + this->newProject(); + if(!GLA()) + return false; + } + + + //QStringList suffixList; + // HashTable storing all supported formats together with + // the (1-based) index of first plugin which is able to open it + //QHash allKnownFormats; + //PM.LoadFormats(suffixList, allKnownFormats,PluginManager::IMPORT); + QStringList fileNameList; + if (fileName.isEmpty()) + fileNameList = QFileDialog::getOpenFileNames(this,tr("Import Mesh"), lastUsedDirectory.path(), PM.inpFilters.join(";;")); + else + fileNameList.push_back(fileName); + + if (fileNameList.isEmpty()) return false; + else + { + //save path away so we can use it again + QString path = fileNameList.first(); + path.truncate(path.lastIndexOf("/")); + lastUsedDirectory.setPath(path); + } + + QElapsedTimer allFileTime; + allFileTime.start(); + foreach(fileName,fileNameList) + { + QFileInfo fi(fileName); + QString extension = fi.suffix(); + IOPluginInterface *pCurrentIOPlugin = PM.allKnowInputFormats[extension.toLower()]; + //pCurrentIOPlugin->setLog(gla->log); + if (pCurrentIOPlugin == NULL) + { + QString errorMsgFormat("Unable to open file:\n\"%1\"\n\nError details: file format " + extension + " not supported."); + QMessageBox::critical(this, tr("Meshlab Opening Error"), errorMsgFormat.arg(fileName)); + return false; + } + + RichParameterList prePar; + pCurrentIOPlugin->initPreOpenParameter(extension, fileName,prePar); + if(!prePar.isEmpty()) + { RichParameterListDialog preOpenDialog(this, prePar, tr("Pre-Open Options")); - preOpenDialog.setFocus(); - preOpenDialog.exec(); - } + preOpenDialog.setFocus(); + preOpenDialog.exec(); + } prePar.join(currentGlobalParams); - int mask = 0; - //MeshModel *mm= new MeshModel(gla->meshDoc); - QFileInfo info(fileName); + int mask = 0; + //MeshModel *mm= new MeshModel(gla->meshDoc); + QFileInfo info(fileName); MeshModel *mm = meshDoc()->addNewMesh(fileName, info.fileName()); - qb->show(); - QElapsedTimer t; + qb->show(); + QElapsedTimer t; t.start(); Matrix44m mtr; mtr.SetIdentity(); - bool open = loadMesh(fileName,pCurrentIOPlugin,mm,mask,&prePar,mtr,isareload); - if(open) - { + bool open = loadMesh(fileName,pCurrentIOPlugin,mm,mask,&prePar,mtr,isareload); + if(open) + { GLA()->Logf(0, "Opened mesh %s in %i msec", qUtf8Printable(fileName), t.elapsed()); - RichParameterList par; - pCurrentIOPlugin->initOpenParameter(extension, *mm, par); - if(!par.isEmpty()) - { + RichParameterList par; + pCurrentIOPlugin->initOpenParameter(extension, *mm, par); + if(!par.isEmpty()) + { RichParameterListDialog postOpenDialog(this, par, tr("Post-Open Processing")); - postOpenDialog.setFocus(); - postOpenDialog.exec(); - pCurrentIOPlugin->applyOpenParameter(extension, *mm, par); - } - /*MultiViewer_Container* mv = GLA()->mvc(); - if (mv != NULL) - { - for(int glarid = 0;glarid < mv->viewerCounter();++glarid) - { - GLArea* ar = mv->getViewer(glarid); - if (ar != NULL) - MLSceneRenderModeAdapter::setupRequestedAttributesAccordingToRenderMode(mm->id(),*ar); - } - }*/ - } - else - { - meshDoc()->delMesh(mm); + postOpenDialog.setFocus(); + postOpenDialog.exec(); + pCurrentIOPlugin->applyOpenParameter(extension, *mm, par); + } + /*MultiViewer_Container* mv = GLA()->mvc(); + if (mv != NULL) + { + for(int glarid = 0;glarid < mv->viewerCounter();++glarid) + { + GLArea* ar = mv->getViewer(glarid); + if (ar != NULL) + MLSceneRenderModeAdapter::setupRequestedAttributesAccordingToRenderMode(mm->id(),*ar); + } + }*/ + } + else + { + meshDoc()->delMesh(mm); GLA()->Logf(0, "Warning: Mesh %s has not been opened", qUtf8Printable(fileName)); - } - }// end foreach file of the input list - GLA()->Logf(0,"All files opened in %i msec",allFileTime.elapsed()); - + } + }// end foreach file of the input list + GLA()->Logf(0,"All files opened in %i msec",allFileTime.elapsed()); + if (_currviewcontainer != NULL) { _currviewcontainer->resetAllTrackBall(); _currviewcontainer->updateAllDecoratorsForAllViewers(); } qb->reset(); - return true; + return true; } void MainWindow::openRecentMesh() { - if(!GLA()) return; - if(meshDoc()->isBusy()) return; - QAction *action = qobject_cast(sender()); - if (action) importMeshWithLayerManagement(action->data().toString()); + if(!GLA()) return; + if(meshDoc()->isBusy()) return; + QAction *action = qobject_cast(sender()); + if (action) importMeshWithLayerManagement(action->data().toString()); } void MainWindow::openRecentProj() { - QAction *action = qobject_cast(sender()); - if (action) openProject(action->data().toString()); + QAction *action = qobject_cast(sender()); + if (action) openProject(action->data().toString()); } bool MainWindow::loadMeshWithStandardParams(QString& fullPath, MeshModel* mm, const Matrix44m &mtr, bool isreload, MLRenderingData* rendOpt) { - if ((meshDoc() == NULL) || (mm == NULL)) - return false; - bool ret = false; - if (!mm->isVisible()) - { - mm->Clear(); - mm->visible = false; - } - else - mm->Clear(); - QFileInfo fi(fullPath); - QString extension = fi.suffix(); - MeshIOInterface *pCurrentIOPlugin = PM.allKnowInputFormats[extension.toLower()]; - - if(pCurrentIOPlugin != NULL) - { - RichParameterList prePar; - pCurrentIOPlugin->initPreOpenParameter(extension, fullPath,prePar); + if ((meshDoc() == NULL) || (mm == NULL)) + return false; + bool ret = false; + if (!mm->isVisible()) + { + mm->Clear(); + mm->visible = false; + } + else + mm->Clear(); + QFileInfo fi(fullPath); + QString extension = fi.suffix(); + IOPluginInterface *pCurrentIOPlugin = PM.allKnowInputFormats[extension.toLower()]; + + if(pCurrentIOPlugin != NULL) + { + RichParameterList prePar; + pCurrentIOPlugin->initPreOpenParameter(extension, fullPath,prePar); prePar.join(currentGlobalParams); - int mask = 0; - QElapsedTimer t;t.start(); - bool open = loadMesh(fullPath,pCurrentIOPlugin,mm,mask,&prePar,mtr,isreload, rendOpt); - if(open) - { + int mask = 0; + QElapsedTimer t;t.start(); + bool open = loadMesh(fullPath,pCurrentIOPlugin,mm,mask,&prePar,mtr,isreload, rendOpt); + if(open) + { GLA()->Logf(0, "Opened mesh %s in %i msec", qUtf8Printable(fullPath), t.elapsed()); - RichParameterList par; - pCurrentIOPlugin->initOpenParameter(extension, *mm, par); - pCurrentIOPlugin->applyOpenParameter(extension,*mm,par); - ret = true; - } - else + RichParameterList par; + pCurrentIOPlugin->initOpenParameter(extension, *mm, par); + pCurrentIOPlugin->applyOpenParameter(extension,*mm,par); + ret = true; + } + else GLA()->Logf(0, "Warning: Mesh %s has not been opened", qUtf8Printable(fullPath)); - } - else + } + else GLA()->Logf(0, "Warning: Mesh %s cannot be opened. Your MeshLab version has not plugin to read %s file format", qUtf8Printable(fullPath), qUtf8Printable(extension)); - return ret; + return ret; } void MainWindow::reloadAllMesh() { - // Discards changes and reloads current file - // save current file name - qb->show(); - foreach(MeshModel *mmm,meshDoc()->meshList) - { - QString fileName = mmm->fullName(); + // Discards changes and reloads current file + // save current file name + qb->show(); + foreach(MeshModel *mmm,meshDoc()->meshList) + { + QString fileName = mmm->fullName(); Matrix44m mat; mat.SetIdentity(); - loadMeshWithStandardParams(fileName,mmm,mat,true); - } - qb->reset(); - + loadMeshWithStandardParams(fileName,mmm,mat,true); + } + qb->reset(); + if (_currviewcontainer != NULL) { _currviewcontainer->updateAllDecoratorsForAllViewers(); @@ -2435,12 +2438,12 @@ void MainWindow::reloadAllMesh() void MainWindow::reload() { - if ((meshDoc() == NULL) || (meshDoc()->mm() == NULL)) - return; - // Discards changes and reloads current file - // save current file name - qb->show(); - QString fileName = meshDoc()->mm()->fullName(); + if ((meshDoc() == NULL) || (meshDoc()->mm() == NULL)) + return; + // Discards changes and reloads current file + // save current file name + qb->show(); + QString fileName = meshDoc()->mm()->fullName(); if (fileName.isEmpty()) { QMessageBox::critical(this, "Reload Error", "Impossible to reload an unsaved mesh model!!"); @@ -2448,8 +2451,8 @@ void MainWindow::reload() } Matrix44m mat; mat.SetIdentity(); - loadMeshWithStandardParams(fileName,meshDoc()->mm(),mat,true); - qb->reset(); + loadMeshWithStandardParams(fileName,meshDoc()->mm(),mat,true); + qb->reset(); if (_currviewcontainer != NULL) { _currviewcontainer->updateAllDecoratorsForAllViewers(); @@ -2459,112 +2462,112 @@ void MainWindow::reload() bool MainWindow::exportMesh(QString fileName,MeshModel* mod,const bool saveAllPossibleAttributes) { - QStringList& suffixList = PM.outFilters; - - //QHash allKnownFormats; - QFileInfo fi(fileName); - //PM.LoadFormats( suffixList, allKnownFormats,PluginManager::EXPORT); - //QString defaultExt = "*." + mod->suffixName().toLower(); - QString defaultExt = "*." + fi.suffix().toLower(); - if(defaultExt == "*.") - defaultExt = "*.ply"; - if (mod == NULL) - return false; + QStringList& suffixList = PM.outFilters; + + //QHash allKnownFormats; + QFileInfo fi(fileName); + //PM.LoadFormats( suffixList, allKnownFormats,PluginManager::EXPORT); + //QString defaultExt = "*." + mod->suffixName().toLower(); + QString defaultExt = "*." + fi.suffix().toLower(); + if(defaultExt == "*.") + defaultExt = "*.ply"; + if (mod == NULL) + return false; mod->setMeshModified(false); - QString laylabel = "Save \"" + mod->label() + "\" Layer"; - QString ss = fi.absoluteFilePath(); - QFileDialog* saveDialog = new QFileDialog(this,laylabel, fi.absolutePath()); + QString laylabel = "Save \"" + mod->label() + "\" Layer"; + QString ss = fi.absoluteFilePath(); + QFileDialog* saveDialog = new QFileDialog(this,laylabel, fi.absolutePath()); #if defined(Q_OS_WIN) - saveDialog->setOption(QFileDialog::DontUseNativeDialog); + saveDialog->setOption(QFileDialog::DontUseNativeDialog); #endif - saveDialog->setNameFilters(suffixList); - saveDialog->setAcceptMode(QFileDialog::AcceptSave); - saveDialog->setFileMode(QFileDialog::AnyFile); - saveDialog->selectFile(fileName); - QStringList matchingExtensions=suffixList.filter(defaultExt); - if(!matchingExtensions.isEmpty()) - saveDialog->selectNameFilter(matchingExtensions.last()); - connect(saveDialog,SIGNAL(filterSelected(const QString&)),this,SLOT(changeFileExtension(const QString&))); - - if (fileName.isEmpty()){ - saveDialog->selectFile(meshDoc()->mm()->fullName()); - int dialogRet = saveDialog->exec(); - if(dialogRet==QDialog::Rejected ) - return false; - fileName=saveDialog->selectedFiles ().first(); - QFileInfo fni(fileName); - if(fni.suffix().isEmpty()) - { - QString ext = saveDialog->selectedNameFilter(); - ext.chop(1); ext = ext.right(4); - fileName = fileName + ext; + saveDialog->setNameFilters(suffixList); + saveDialog->setAcceptMode(QFileDialog::AcceptSave); + saveDialog->setFileMode(QFileDialog::AnyFile); + saveDialog->selectFile(fileName); + QStringList matchingExtensions=suffixList.filter(defaultExt); + if(!matchingExtensions.isEmpty()) + saveDialog->selectNameFilter(matchingExtensions.last()); + connect(saveDialog,SIGNAL(filterSelected(const QString&)),this,SLOT(changeFileExtension(const QString&))); + + if (fileName.isEmpty()){ + saveDialog->selectFile(meshDoc()->mm()->fullName()); + int dialogRet = saveDialog->exec(); + if(dialogRet==QDialog::Rejected ) + return false; + fileName=saveDialog->selectedFiles ().first(); + QFileInfo fni(fileName); + if(fni.suffix().isEmpty()) + { + QString ext = saveDialog->selectedNameFilter(); + ext.chop(1); ext = ext.right(4); + fileName = fileName + ext; qDebug("File without extension adding it by hand '%s'", qUtf8Printable(fileName)); - } - } - - - bool ret = false; - - QStringList fs = fileName.split("."); - - if(!fileName.isEmpty() && fs.size() < 2) - { - QMessageBox::warning(this,"Save Error","You must specify file extension!!"); - return ret; - } - - if (!fileName.isEmpty()) - { - //save path away so we can use it again - QString path = fileName; - path.truncate(path.lastIndexOf("/")); - lastUsedDirectory.setPath(path); - - QString extension = fileName; - extension.remove(0, fileName.lastIndexOf('.')+1); - - QStringListIterator itFilter(suffixList); - - MeshIOInterface *pCurrentIOPlugin = PM.allKnowOutputFormats[extension.toLower()]; - if (pCurrentIOPlugin == 0) - { - QMessageBox::warning(this, "Unknown type", "File extension not supported!"); - return false; - } - //MeshIOInterface* pCurrentIOPlugin = meshIOPlugins[idx-1]; - pCurrentIOPlugin->setLog(&meshDoc()->Log); - - int capability=0,defaultBits=0; - pCurrentIOPlugin->GetExportMaskCapability(extension,capability,defaultBits); - - // optional saving parameters (like ascii/binary encoding) - RichParameterList savePar; - - pCurrentIOPlugin->initSaveParameter(extension,*(mod),savePar); - - SaveMaskExporterDialog maskDialog(new QWidget(),mod,capability,defaultBits,&savePar,this->GLA()); - if (!saveAllPossibleAttributes) - maskDialog.exec(); - else - { - maskDialog.SlotSelectionAllButton(); - maskDialog.updateMask(); - } - int mask = maskDialog.GetNewMask(); - if (!saveAllPossibleAttributes) - { - maskDialog.close(); - if(maskDialog.result() == QDialog::Rejected) - return false; - } - if(mask == -1) - return false; - - qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); - qb->show(); - QElapsedTimer tt; tt.start(); - ret = pCurrentIOPlugin->save(extension, fileName, *mod ,mask,savePar,QCallBack,this); - qb->reset(); + } + } + + + bool ret = false; + + QStringList fs = fileName.split("."); + + if(!fileName.isEmpty() && fs.size() < 2) + { + QMessageBox::warning(this,"Save Error","You must specify file extension!!"); + return ret; + } + + if (!fileName.isEmpty()) + { + //save path away so we can use it again + QString path = fileName; + path.truncate(path.lastIndexOf("/")); + lastUsedDirectory.setPath(path); + + QString extension = fileName; + extension.remove(0, fileName.lastIndexOf('.')+1); + + QStringListIterator itFilter(suffixList); + + IOPluginInterface *pCurrentIOPlugin = PM.allKnowOutputFormats[extension.toLower()]; + if (pCurrentIOPlugin == 0) + { + QMessageBox::warning(this, "Unknown type", "File extension not supported!"); + return false; + } + //MeshIOInterface* pCurrentIOPlugin = meshIOPlugins[idx-1]; + pCurrentIOPlugin->setLog(&meshDoc()->Log); + + int capability=0,defaultBits=0; + pCurrentIOPlugin->GetExportMaskCapability(extension,capability,defaultBits); + + // optional saving parameters (like ascii/binary encoding) + RichParameterList savePar; + + pCurrentIOPlugin->initSaveParameter(extension,*(mod),savePar); + + SaveMaskExporterDialog maskDialog(new QWidget(),mod,capability,defaultBits,&savePar,this->GLA()); + if (!saveAllPossibleAttributes) + maskDialog.exec(); + else + { + maskDialog.SlotSelectionAllButton(); + maskDialog.updateMask(); + } + int mask = maskDialog.GetNewMask(); + if (!saveAllPossibleAttributes) + { + maskDialog.close(); + if(maskDialog.result() == QDialog::Rejected) + return false; + } + if(mask == -1) + return false; + + qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); + qb->show(); + QElapsedTimer tt; tt.start(); + ret = pCurrentIOPlugin->save(extension, fileName, *mod ,mask,savePar,QCallBack,this); + qb->reset(); if (ret) { GLA()->Logf(GLLogStream::SYSTEM, "Saved Mesh %s in %i msec", qUtf8Printable(fileName), tt.elapsed()); @@ -2578,94 +2581,94 @@ bool MainWindow::exportMesh(QString fileName,MeshModel* mod,const bool saveAllPo GLA()->Logf(GLLogStream::SYSTEM, "Error Saving Mesh %s", qUtf8Printable(fileName)); QMessageBox::critical(this, tr("Meshlab Saving Error"), pCurrentIOPlugin->errorMessage); } - qApp->restoreOverrideCursor(); + qApp->restoreOverrideCursor(); updateLayerDialog(); - + if (ret) QDir::setCurrent(fi.absoluteDir().absolutePath()); //set current dir - } - return ret; + } + return ret; } void MainWindow::changeFileExtension(const QString& st) { - QFileDialog* fd = qobject_cast(sender()); - if (fd == NULL) - return; - QRegExp extlist("\\*.\\w+"); - int start = st.indexOf(extlist); - (void)start; - QString ext = extlist.cap().remove("*"); - QStringList stlst = fd->selectedFiles(); - if (!stlst.isEmpty()) - { - QFileInfo fi(stlst[0]); - fd->selectFile(fi.baseName() + ext); - } + QFileDialog* fd = qobject_cast(sender()); + if (fd == NULL) + return; + QRegExp extlist("\\*.\\w+"); + int start = st.indexOf(extlist); + (void)start; + QString ext = extlist.cap().remove("*"); + QStringList stlst = fd->selectedFiles(); + if (!stlst.isEmpty()) + { + QFileInfo fi(stlst[0]); + fd->selectFile(fi.baseName() + ext); + } } bool MainWindow::save(const bool saveAllPossibleAttributes) { - return exportMesh(meshDoc()->mm()->fullName(),meshDoc()->mm(),saveAllPossibleAttributes); + return exportMesh(meshDoc()->mm()->fullName(),meshDoc()->mm(),saveAllPossibleAttributes); } bool MainWindow::saveAs(QString fileName,const bool saveAllPossibleAttributes) { - return exportMesh(fileName,meshDoc()->mm(),saveAllPossibleAttributes); + return exportMesh(fileName,meshDoc()->mm(),saveAllPossibleAttributes); } void MainWindow::readViewFromFile(QString const& filename){ - if(GLA() != 0) - GLA()->readViewFromFile(filename); + if(GLA() != 0) + GLA()->readViewFromFile(filename); } bool MainWindow::saveSnapshot() { if (!GLA()) return false; if (meshDoc()->isBusy()) return false; - - SaveSnapshotDialog dialog(this); - dialog.setValues(GLA()->ss); - - if (dialog.exec()==QDialog::Accepted) - { - GLA()->ss=dialog.getValues(); - GLA()->saveSnapshot(); - return true; - } - - return false; + + SaveSnapshotDialog dialog(this); + dialog.setValues(GLA()->ss); + + if (dialog.exec()==QDialog::Accepted) + { + GLA()->ss=dialog.getValues(); + GLA()->saveSnapshot(); + return true; + } + + return false; } void MainWindow::about() { - QDialog *about_dialog = new QDialog(); - Ui::aboutDialog temp; - temp.setupUi(about_dialog); - temp.labelMLName->setText(MeshLabApplication::completeName(MeshLabApplication::HW_ARCHITECTURE(QSysInfo::WordSize))+" (built on "+__DATE__+")"); - //about_dialog->setFixedSize(566,580); - about_dialog->show(); + QDialog *about_dialog = new QDialog(); + Ui::aboutDialog temp; + temp.setupUi(about_dialog); + temp.labelMLName->setText(MeshLabApplication::completeName(MeshLabApplication::HW_ARCHITECTURE(QSysInfo::WordSize))+" (built on "+__DATE__+")"); + //about_dialog->setFixedSize(566,580); + about_dialog->show(); } void MainWindow::aboutPlugins() { - qDebug( "aboutPlugins(): Current Plugins Dir: %s ",qUtf8Printable(pluginManager().getDefaultPluginDirPath())); - PluginDialog dialog(pluginManager().getDefaultPluginDirPath(), pluginManager().pluginsLoaded, this); - dialog.exec(); + qDebug( "aboutPlugins(): Current Plugins Dir: %s ",qUtf8Printable(pluginManager().getDefaultPluginDirPath())); + PluginDialog dialog(pluginManager().getDefaultPluginDirPath(), pluginManager().pluginsLoaded, this); + dialog.exec(); } void MainWindow::helpOnscreen() { - if(GLA()) GLA()->toggleHelpVisible(); + if(GLA()) GLA()->toggleHelpVisible(); } void MainWindow::helpOnline() { - checkForUpdates(false); - QDesktopServices::openUrl(QUrl("http://www.meshlab.net/#support")); + checkForUpdates(false); + QDesktopServices::openUrl(QUrl("http://www.meshlab.net/#support")); } void MainWindow::showToolbarFile(){ - mainToolBar->setVisible(!mainToolBar->isVisible()); + mainToolBar->setVisible(!mainToolBar->isVisible()); } void MainWindow::showInfoPane() {if(GLA() != 0) GLA()->infoAreaVisible =!GLA()->infoAreaVisible;} @@ -2674,60 +2677,60 @@ void MainWindow::resetTrackBall(){if(GLA() != 0) GLA()->resetTrackBall();} void MainWindow::showRaster() {if(GLA() != 0) GLA()->showRaster((QApplication::keyboardModifiers () & Qt::ShiftModifier));} void MainWindow::showLayerDlg(bool visible) { - if ((GLA() != 0) && (layerDialog != NULL)) - { - layerDialog->setVisible( visible); - showLayerDlgAct->setChecked(visible); - } + if ((GLA() != 0) && (layerDialog != NULL)) + { + layerDialog->setVisible( visible); + showLayerDlgAct->setChecked(visible); + } } void MainWindow::setCustomize() { - MeshLabSettingsDialog dialog(currentGlobalParams,defaultGlobalParams, this); + MeshLabSettingsDialog dialog(currentGlobalParams,defaultGlobalParams, this); connect(&dialog, SIGNAL(applyCustomSetting()), this, SLOT(updateCustomSettings())); - dialog.exec(); + dialog.exec(); } void MainWindow::fullScreen(){ - if(!isFullScreen()) - { - toolbarState = saveState(); - menuBar()->hide(); - mainToolBar->hide(); - globalStatusBar()->hide(); - setWindowState(windowState()^Qt::WindowFullScreen); - bool found=true; - //Caso di piu' finestre aperte in tile: - if((mdiarea->subWindowList()).size()>1){ - foreach(QWidget *w,mdiarea->subWindowList()){if(w->isMaximized()) found=false;} - if (found)mdiarea->tileSubWindows(); - } - } - else - { - menuBar()->show(); - restoreState(toolbarState); - globalStatusBar()->show(); - - setWindowState(windowState()^ Qt::WindowFullScreen); - bool found=true; - //Caso di piu' finestre aperte in tile: - if((mdiarea->subWindowList()).size()>1){ - foreach(QWidget *w,mdiarea->subWindowList()){if(w->isMaximized()) found=false;} - if (found){mdiarea->tileSubWindows();} - } - fullScreenAct->setChecked(false); - } + if(!isFullScreen()) + { + toolbarState = saveState(); + menuBar()->hide(); + mainToolBar->hide(); + globalStatusBar()->hide(); + setWindowState(windowState()^Qt::WindowFullScreen); + bool found=true; + //Caso di piu' finestre aperte in tile: + if((mdiarea->subWindowList()).size()>1){ + foreach(QWidget *w,mdiarea->subWindowList()){if(w->isMaximized()) found=false;} + if (found)mdiarea->tileSubWindows(); + } + } + else + { + menuBar()->show(); + restoreState(toolbarState); + globalStatusBar()->show(); + + setWindowState(windowState()^ Qt::WindowFullScreen); + bool found=true; + //Caso di piu' finestre aperte in tile: + if((mdiarea->subWindowList()).size()>1){ + foreach(QWidget *w,mdiarea->subWindowList()){if(w->isMaximized()) found=false;} + if (found){mdiarea->tileSubWindows();} + } + fullScreenAct->setChecked(false); + } } void MainWindow::keyPressEvent(QKeyEvent *e) { - if(e->key()==Qt::Key_Return && e->modifiers()==Qt::AltModifier) - { - fullScreen(); - e->accept(); - } - else e->ignore(); + if(e->key()==Qt::Key_Return && e->modifiers()==Qt::AltModifier) + { + fullScreen(); + e->accept(); + } + else e->ignore(); } /** @@ -2741,7 +2744,7 @@ bool MainWindow::QCallBack(const int pos, const char * str) int static lastPos = -1; if (pos == lastPos) return true; lastPos = pos; - + static QElapsedTimer currTime; if (currTime.isValid() && currTime.elapsed() < 100) return true; @@ -2752,82 +2755,82 @@ bool MainWindow::QCallBack(const int pos, const char * str) qb->setValue(pos); MainWindow::globalStatusBar()->update(); qApp->processEvents(); - return true; + return true; } void MainWindow::updateTexture(int meshid) { - MultiViewer_Container* mvc = currentViewContainer(); - if ((mvc == NULL) || (meshDoc() == NULL)) - return; - - MLSceneGLSharedDataContext* shared = mvc->sharedDataContext(); - if (shared == NULL) - return; - - MeshModel* mymesh = meshDoc()->getMesh(meshid); - if (mymesh == NULL) - return; - - shared->deAllocateTexturesPerMesh(mymesh->id()); - - int textmemMB = int(mwsettings.maxTextureMemory / ((float) 1024 * 1024)); - - size_t totalTextureNum = 0; - foreach (MeshModel *mp, meshDoc()->meshList) - totalTextureNum+=mp->cm.textures.size(); - - int singleMaxTextureSizeMpx = int(textmemMB/((totalTextureNum != 0)? totalTextureNum : 1)); - bool sometextfailed = false; - QString unexistingtext = "In mesh file " + mymesh->fullName() + " : Failure loading textures:
"; - for(size_t i =0; i< mymesh->cm.textures.size();++i) - { - QImage img; - QFileInfo fi(mymesh->cm.textures[i].c_str()); - QString filename = fi.absoluteFilePath(); - bool res = img.load(filename); - sometextfailed = sometextfailed || !res; - if(!res) - { - res = img.load(filename); - if(!res) - { - QString errmsg = QString("Failure of loading texture %1").arg(fi.fileName()); - meshDoc()->Log.Log(GLLogStream::WARNING,qUtf8Printable(errmsg)); - unexistingtext += "" + filename + "
"; - } - } - -/*PLEASE EXPLAIN ME!*********************************************************************************************************************************************************************************/ - //if(!res && filename.endsWith("dds",Qt::CaseInsensitive)) - //{ - // qDebug("DDS binding!"); - // int newTexId = shared->bindTexture(filename); - // shared->txtcont.push_back(newTexId); - //} -/*PLEASE EXPLAIN ME!*********************************************************************************************************************************************************************************/ - - if (!res) - res = img.load(":/images/dummy.png"); - GLuint textid = shared->allocateTexturePerMesh(meshid,img,singleMaxTextureSizeMpx); - - if (sometextfailed) - QMessageBox::warning(this,"Texture file has not been correctly loaded",unexistingtext); - - for(int tt = 0;tt < mvc->viewerCounter();++tt) - { - GLArea* ar = mvc->getViewer(tt); - if (ar != NULL) - ar->setupTextureEnv(textid); - } - } - if (sometextfailed) - QMessageBox::warning(this,"Texture file has not been correctly loaded",unexistingtext); + MultiViewer_Container* mvc = currentViewContainer(); + if ((mvc == NULL) || (meshDoc() == NULL)) + return; + + MLSceneGLSharedDataContext* shared = mvc->sharedDataContext(); + if (shared == NULL) + return; + + MeshModel* mymesh = meshDoc()->getMesh(meshid); + if (mymesh == NULL) + return; + + shared->deAllocateTexturesPerMesh(mymesh->id()); + + int textmemMB = int(mwsettings.maxTextureMemory / ((float) 1024 * 1024)); + + size_t totalTextureNum = 0; + foreach (MeshModel *mp, meshDoc()->meshList) + totalTextureNum+=mp->cm.textures.size(); + + int singleMaxTextureSizeMpx = int(textmemMB/((totalTextureNum != 0)? totalTextureNum : 1)); + bool sometextfailed = false; + QString unexistingtext = "In mesh file " + mymesh->fullName() + " : Failure loading textures:
"; + for(size_t i =0; i< mymesh->cm.textures.size();++i) + { + QImage img; + QFileInfo fi(mymesh->cm.textures[i].c_str()); + QString filename = fi.absoluteFilePath(); + bool res = img.load(filename); + sometextfailed = sometextfailed || !res; + if(!res) + { + res = img.load(filename); + if(!res) + { + QString errmsg = QString("Failure of loading texture %1").arg(fi.fileName()); + meshDoc()->Log.Log(GLLogStream::WARNING,qUtf8Printable(errmsg)); + unexistingtext += "" + filename + "
"; + } + } + + /*PLEASE EXPLAIN ME!*********************************************************************************************************************************************************************************/ + //if(!res && filename.endsWith("dds",Qt::CaseInsensitive)) + //{ + // qDebug("DDS binding!"); + // int newTexId = shared->bindTexture(filename); + // shared->txtcont.push_back(newTexId); + //} + /*PLEASE EXPLAIN ME!*********************************************************************************************************************************************************************************/ + + if (!res) + res = img.load(":/images/dummy.png"); + GLuint textid = shared->allocateTexturePerMesh(meshid,img,singleMaxTextureSizeMpx); + + if (sometextfailed) + QMessageBox::warning(this,"Texture file has not been correctly loaded",unexistingtext); + + for(int tt = 0;tt < mvc->viewerCounter();++tt) + { + GLArea* ar = mvc->getViewer(tt); + if (ar != NULL) + ar->setupTextureEnv(textid); + } + } + if (sometextfailed) + QMessageBox::warning(this,"Texture file has not been correctly loaded",unexistingtext); } void MainWindow::updateProgressBar( const int pos,const QString& text ) { - this->QCallBack(pos,qUtf8Printable(text)); + this->QCallBack(pos,qUtf8Printable(text)); } //WARNING!!!! Probably it's useless @@ -2920,10 +2923,10 @@ void MainWindow::showEvent(QShowEvent * event) { QWidget::showEvent(event); QSettings settings; - QSettings::setDefaultFormat(QSettings::NativeFormat); + QSettings::setDefaultFormat(QSettings::NativeFormat); const QString versioncheckeddatestring("lastTimeMeshLabVersionCheckedOnStart"); QDate today = QDate::currentDate(); - QString todayStr = today.toString(); + QString todayStr = today.toString(); if (settings.contains(versioncheckeddatestring)) { QDate lasttimechecked = QDate::fromString(settings.value(versioncheckeddatestring).toString()); @@ -2943,52 +2946,52 @@ void MainWindow::showEvent(QShowEvent * event) void MainWindow::meshAdded(int mid) { - MultiViewer_Container* mvc = currentViewContainer(); - if (mvc != NULL) - { - MLSceneGLSharedDataContext* shared = mvc->sharedDataContext(); - if (shared != NULL) - { - shared->meshInserted(mid); - QList contlist; - for(int glarid = 0;glarid < mvc->viewerCounter();++glarid) - { - GLArea* ar = mvc->getViewer(glarid); - if (ar != NULL) - contlist.push_back(ar->context()); - } - MLRenderingData defdt; - if (meshDoc() != NULL) - { - MeshModel* mm = meshDoc()->getMesh(mid); - if (mm != NULL) - { - for(int glarid = 0;glarid < mvc->viewerCounter();++glarid) - { - GLArea* ar = mvc->getViewer(glarid); - if (ar != NULL) - shared->setRenderingDataPerMeshView(mid,ar->context(),defdt); - } - shared->manageBuffers(mid); - } + MultiViewer_Container* mvc = currentViewContainer(); + if (mvc != NULL) + { + MLSceneGLSharedDataContext* shared = mvc->sharedDataContext(); + if (shared != NULL) + { + shared->meshInserted(mid); + QList contlist; + for(int glarid = 0;glarid < mvc->viewerCounter();++glarid) + { + GLArea* ar = mvc->getViewer(glarid); + if (ar != NULL) + contlist.push_back(ar->context()); + } + MLRenderingData defdt; + if (meshDoc() != NULL) + { + MeshModel* mm = meshDoc()->getMesh(mid); + if (mm != NULL) + { + for(int glarid = 0;glarid < mvc->viewerCounter();++glarid) + { + GLArea* ar = mvc->getViewer(glarid); + if (ar != NULL) + shared->setRenderingDataPerMeshView(mid,ar->context(),defdt); + } + shared->manageBuffers(mid); + } //layerDialog->setVisible(meshDoc()->meshList.size() > 0); updateLayerDialog(); - } - } - - } + } + } + + } } void MainWindow::meshRemoved(int mid) { - MultiViewer_Container* mvc = currentViewContainer(); - if (mvc != NULL) - { - MLSceneGLSharedDataContext* shared = mvc->sharedDataContext(); - if (shared != NULL) - shared->meshRemoved(mid); - } - updateLayerDialog(); + MultiViewer_Container* mvc = currentViewContainer(); + if (mvc != NULL) + { + MLSceneGLSharedDataContext* shared = mvc->sharedDataContext(); + if (shared != NULL) + shared->meshRemoved(mid); + } + updateLayerDialog(); } void MainWindow::getRenderingData( int mid,MLRenderingData& dt) const @@ -2996,7 +2999,7 @@ void MainWindow::getRenderingData( int mid,MLRenderingData& dt) const if (mid == -1) { //if (GLA() != NULL) - //GLA()->getPerDocGlobalRenderingData(dt); + //GLA()->getPerDocGlobalRenderingData(dt); } else { @@ -3042,31 +3045,31 @@ void MainWindow::setRenderingData(int mid,const MLRenderingData& dt) void MainWindow::addRenderingSystemLogInfo(unsigned mmid) { - MultiViewer_Container* cont = currentViewContainer(); - if (cont != NULL) - { - MLRenderingData::DebugInfo deb; - MLSceneGLSharedDataContext* share = cont->sharedDataContext(); - if ((share != NULL) && (GLA() != NULL)) - { - share->getLog(mmid,deb); - MeshModel* mm = meshDoc()->getMesh(mmid); - if (mm != NULL) - { - QString data = QString(deb._currentlyallocated.c_str()) + "\n" + QString(deb._tobedeallocated.c_str()) + "\n" + QString(deb._tobeallocated.c_str()) + "\n" + QString(deb._tobeupdated.c_str()) + "\n"; - for(std::vector::iterator it = deb._perviewdata.begin();it != deb._perviewdata.end();++it) - data += QString((*it).c_str()) + "
"; - meshDoc()->Log.Log(GLLogStream::SYSTEM, data); - } - } - } + MultiViewer_Container* cont = currentViewContainer(); + if (cont != NULL) + { + MLRenderingData::DebugInfo deb; + MLSceneGLSharedDataContext* share = cont->sharedDataContext(); + if ((share != NULL) && (GLA() != NULL)) + { + share->getLog(mmid,deb); + MeshModel* mm = meshDoc()->getMesh(mmid); + if (mm != NULL) + { + QString data = QString(deb._currentlyallocated.c_str()) + "\n" + QString(deb._tobedeallocated.c_str()) + "\n" + QString(deb._tobeallocated.c_str()) + "\n" + QString(deb._tobeupdated.c_str()) + "\n"; + for(std::vector::iterator it = deb._perviewdata.begin();it != deb._perviewdata.end();++it) + data += QString((*it).c_str()) + "
"; + meshDoc()->Log.Log(GLLogStream::SYSTEM, data); + } + } + } } void MainWindow::updateRenderingDataAccordingToActionsCommonCode(int meshid, const QList& acts) { if (meshDoc() == NULL) return; - + MLRenderingData olddt; getRenderingData(meshid, olddt); MLRenderingData dt(olddt); @@ -3082,7 +3085,7 @@ void MainWindow::updateRenderingDataAccordingToActionsCommonCode(int meshid, con MLPoliciesStandAloneFunctions::computeRequestedRenderingDataCompatibleWithMeshSameGLOpts(mm, dt, dt); } setRenderingData(meshid, dt); - + /*if (meshid == -1) { foreach(MeshModel* mm, meshDoc()->meshList) @@ -3096,13 +3099,13 @@ void MainWindow::updateRenderingDataAccordingToActionsCommonCode(int meshid, con } else {*/ - if (mm != NULL) - { - MLDefaultMeshDecorators dec(this); - dec.updateMeshDecorationData(*mm, olddt, dt); - } + if (mm != NULL) + { + MLDefaultMeshDecorators dec(this); + dec.updateMeshDecorationData(*mm, olddt, dt); + } /*}*/ - + } @@ -3134,7 +3137,7 @@ void MainWindow::updateRenderingDataAccordingToActions(int /*meshid*/, MLRenderi { if ((meshDoc() == NULL) || (act == NULL)) return; - + QList tmpacts; for (int ii = 0; ii < acts.size(); ++ii) { @@ -3146,20 +3149,20 @@ void MainWindow::updateRenderingDataAccordingToActions(int /*meshid*/, MLRenderi tmpacts.push_back(sisteract); } } - + for (int hh = 0; hh < meshDoc()->meshList.size(); ++hh) { if (meshDoc()->meshList[hh] != NULL) updateRenderingDataAccordingToActionsCommonCode(meshDoc()->meshList[hh]->id(), tmpacts); } - + for (int ii = 0; ii < tmpacts.size(); ++ii) delete tmpacts[ii]; tmpacts.clear(); - + if (GLA() != NULL) GLA()->update(); - + updateLayerDialog(); } @@ -3168,7 +3171,7 @@ void MainWindow::updateRenderingDataAccordingToActionCommonCode(int meshid, MLRe { if ((meshDoc() == NULL) || (act == NULL)) return; - + if (meshid != -1) { MLRenderingData olddt; @@ -3201,7 +3204,7 @@ void MainWindow::updateRenderingDataAccordingToActionToAllVisibleLayers(MLRender { if (meshDoc() == NULL) return; - + for (int ii = 0; ii < meshDoc()->meshList.size(); ++ii) { MeshModel* mm = meshDoc()->meshList[ii]; @@ -3219,7 +3222,7 @@ void MainWindow::updateRenderingDataAccordingToActions(QListmeshList.size(); ++ii) { MeshModel* mm = meshDoc()->meshList[ii]; @@ -3229,7 +3232,7 @@ void MainWindow::updateRenderingDataAccordingToActions(QListmainActions()) updateRenderingDataAccordingToActionCommonCode(mm->id(), ract); - + foreach(MLRenderingAction* ract, act->relatedActions()) updateRenderingDataAccordingToActionCommonCode(mm->id(), ract); } diff --git a/src/meshlab/meshlab.pro b/src/meshlab/meshlab.pro index c5e668b9d..e1cbf1dee 100644 --- a/src/meshlab/meshlab.pro +++ b/src/meshlab/meshlab.pro @@ -26,7 +26,6 @@ DEPENDPATH += \ $$VCGDIR/wrap HEADERS += \ - ../common/interfaces.h \ mainwindow.h \ glarea.h \ meshlab_settings/meshlabsettingsdialog.h \ diff --git a/src/meshlab/meshlab_settings/settingdialog.cpp b/src/meshlab/meshlab_settings/settingdialog.cpp index e69a4fb52..19cd0601f 100644 --- a/src/meshlab/meshlab_settings/settingdialog.cpp +++ b/src/meshlab/meshlab_settings/settingdialog.cpp @@ -23,6 +23,8 @@ #include "settingdialog.h" +#include + SettingDialog::SettingDialog( const RichParameter& currentParam, const RichParameter& defaultParam, diff --git a/src/meshlab/ml_std_par_dialog.cpp b/src/meshlab/ml_std_par_dialog.cpp index 1eb5ec2aa..710829cea 100644 --- a/src/meshlab/ml_std_par_dialog.cpp +++ b/src/meshlab/ml_std_par_dialog.cpp @@ -27,7 +27,7 @@ MeshlabStdDialog::MeshlabStdDialog(QWidget *p) } /* manages the setup of the standard parameter window, when the execution of a plugin filter is requested */ -bool MeshlabStdDialog::showAutoDialog(MeshFilterInterface *mfi, MeshModel *mm, MeshDocument * mdp, QAction *action, MainWindow *mwi, QWidget *gla) +bool MeshlabStdDialog::showAutoDialog(FilterPluginInterface *mfi, MeshModel *mm, MeshDocument * mdp, QAction *action, MainWindow *mwi, QWidget *gla) { validcache = false; curAction = action; @@ -39,7 +39,7 @@ bool MeshlabStdDialog::showAutoDialog(MeshFilterInterface *mfi, MeshModel *mm, M curMeshDoc = mdp; curgla = gla; - mfi->initParameterSet(action, *mdp, curParSet); + mfi->initParameterList(action, *mdp, curParSet); curmask = mfi->postCondition(action); if (curParSet.isEmpty() && !isPreviewable()) return false; @@ -69,7 +69,7 @@ void MeshlabStdDialog::changeCurrentMesh(int meshInd) bool MeshlabStdDialog::isPreviewable() { - if ((curAction == NULL) || (curmfi == NULL) || (curmfi->filterArity(curAction) != MeshFilterInterface::SINGLE_MESH)) + if ((curAction == NULL) || (curmfi == NULL) || (curmfi->filterArity(curAction) != FilterPluginInterface::SINGLE_MESH)) return false; if ((curmask == MeshModel::MM_UNKNOWN) || (curmask == MeshModel::MM_NONE)) @@ -105,7 +105,7 @@ void MeshlabStdDialog::createFrame() void MeshlabStdDialog::resetValues() { curParSet.clear(); - curmfi->initParameterSet(curAction, *curMeshDoc, curParSet); + curmfi->initParameterList(curAction, *curMeshDoc, curParSet); assert(qf); assert(qf->isVisible()); diff --git a/src/meshlab/ml_std_par_dialog.h b/src/meshlab/ml_std_par_dialog.h index b36e9cd0e..a9bf467ab 100644 --- a/src/meshlab/ml_std_par_dialog.h +++ b/src/meshlab/ml_std_par_dialog.h @@ -26,6 +26,7 @@ #include #include "rich_parameter_gui/richparameterlistframe.h" +#include "../common/interfaces/filter_plugin_interface.h" class MainWindow; class MeshlabStdDialog : public QDockWidget @@ -40,7 +41,7 @@ public: void createFrame(); void loadFrameContent(MeshDocument *mdPt=0); - bool showAutoDialog(MeshFilterInterface *mfi, MeshModel *mm, MeshDocument * md, QAction *q, MainWindow *mwi, QWidget *gla=0); + bool showAutoDialog(FilterPluginInterface *mfi, MeshModel *mm, MeshDocument * md, QAction *q, MainWindow *mwi, QWidget *gla=0); bool isPreviewable(); public slots: @@ -67,7 +68,7 @@ public: uint curmask; MeshModel *curModel; MeshDocument * curMeshDoc; - MeshFilterInterface *curmfi; + FilterPluginInterface *curmfi; MainWindow *curmwi; QWidget * curgla; RichParameterList curParSet; diff --git a/src/meshlab/multiViewer_Container.cpp b/src/meshlab/multiViewer_Container.cpp index 051fd6793..524224fcc 100644 --- a/src/meshlab/multiViewer_Container.cpp +++ b/src/meshlab/multiViewer_Container.cpp @@ -23,6 +23,7 @@ #include "multiViewer_Container.h" #include "glarea.h" #include +#include #include "mainwindow.h" #include diff --git a/src/meshlab/plugindialog.cpp b/src/meshlab/plugindialog.cpp index bd3d5f0df..9c88db368 100644 --- a/src/meshlab/plugindialog.cpp +++ b/src/meshlab/plugindialog.cpp @@ -22,9 +22,17 @@ ****************************************************************************/ #include "plugindialog.h" -#include +#include +#include +#include +#include +#include + + #include +#include +#include #include #include #include @@ -116,40 +124,40 @@ void PluginDialog::populateTreeWidget(const QString &path,const QStringList &fil pluginItem->setFont(0, boldFont); if (plugin) { - MeshIOInterface *iMeshIO = qobject_cast(plugin); + IOPluginInterface *iMeshIO = qobject_cast(plugin); if (iMeshIO){ QStringList Templist; - foreach(const MeshIOInterface::Format f,iMeshIO->importFormats()){ + foreach(const IOPluginInterface::Format f,iMeshIO->importFormats()){ QString formats; foreach(const QString s,f.extensions) formats+="Importer_"+s+" "; Templist.push_back(formats); } - foreach(const MeshIOInterface::Format f,iMeshIO->exportFormats()){ + foreach(const IOPluginInterface::Format f,iMeshIO->exportFormats()){ QString formats; foreach(const QString s,f.extensions) formats+="Exporter_"+s+" "; Templist.push_back(formats); } 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());} addItems(pluginItem,Templist); } - MeshFilterInterface *iFilter = qobject_cast(plugin); + FilterPluginInterface *iFilter = qobject_cast(plugin); if (iFilter){ QStringList Templist; foreach(QAction *a,iFilter->actions()){Templist.push_back(a->text());} addItems(pluginItem,Templist); } - MeshRenderInterface *iRender = qobject_cast(plugin); + RenderPluginInterface *iRender = qobject_cast(plugin); if (iRender){ QStringList Templist; foreach(QAction *a,iRender->actions()){Templist.push_back(a->text());} addItems(pluginItem,Templist); } - MeshEditInterfaceFactory *iEdit = qobject_cast(plugin); + EditPluginInterfaceFactory *iEdit = qobject_cast(plugin); if (iEdit){ QStringList Templist; foreach(QAction *a,iEdit->actions()){Templist.push_back(a->text());} @@ -184,36 +192,36 @@ void PluginDialog::displayInfo(QTreeWidgetItem* item,int /* ncolumn*/) qDebug("Trying to load the plugin '%s'", qUtf8Printable(fileName)); QObject *plugin = loader.instance(); if (plugin) { - MeshIOInterface *iMeshIO = qobject_cast(plugin); + IOPluginInterface *iMeshIO = qobject_cast(plugin); if (iMeshIO){ - foreach(const MeshIOInterface::Format f,iMeshIO->importFormats()){ + foreach(const IOPluginInterface::Format f,iMeshIO->importFormats()){ QString formats; foreach(const QString s,f.extensions) formats+="Importer_"+s+" "; if (actionName==formats) labelInfo->setText(f.description); } - foreach(const MeshIOInterface::Format f,iMeshIO->exportFormats()){ + foreach(const IOPluginInterface::Format f,iMeshIO->exportFormats()){ QString formats; foreach(const QString s,f.extensions) formats+="Exporter_"+s+" "; if (actionName==formats) labelInfo->setText(f.description); } } - MeshDecorateInterface *iDecorate = qobject_cast(plugin); + DecoratePluginInterface *iDecorate = qobject_cast(plugin); if (iDecorate) { foreach(QAction *a,iDecorate->actions()) if (actionName==a->text()) labelInfo->setText(iDecorate->decorationInfo(a)); } - MeshFilterInterface *iFilter = qobject_cast(plugin); + FilterPluginInterface *iFilter = qobject_cast(plugin); if (iFilter) { foreach(QAction *a,iFilter->actions()) if (actionName==a->text()) labelInfo->setText(iFilter->filterInfo(iFilter->ID(a))); } - MeshRenderInterface *iRender = qobject_cast(plugin); + RenderPluginInterface *iRender = qobject_cast(plugin); if (iRender){ } - MeshEditInterfaceFactory *iEditFactory = qobject_cast(plugin); + EditPluginInterfaceFactory *iEditFactory = qobject_cast(plugin); if (iEditFactory) { foreach(QAction *a, iEditFactory->actions()) diff --git a/src/meshlab/rich_parameter_gui/richparameterlistframe.h b/src/meshlab/rich_parameter_gui/richparameterlistframe.h index 50cfeacbe..089e649d5 100644 --- a/src/meshlab/rich_parameter_gui/richparameterlistframe.h +++ b/src/meshlab/rich_parameter_gui/richparameterlistframe.h @@ -24,8 +24,6 @@ #ifndef RICHPARAMETERLISTFRAME_H #define RICHPARAMETERLISTFRAME_H -#include "../../common/interfaces.h" - #include "richparameterwidgets.h" #include diff --git a/src/meshlab/rich_parameter_gui/richparameterwidgets.cpp b/src/meshlab/rich_parameter_gui/richparameterwidgets.cpp index dcfe5c365..4215ae78a 100644 --- a/src/meshlab/rich_parameter_gui/richparameterwidgets.cpp +++ b/src/meshlab/rich_parameter_gui/richparameterwidgets.cpp @@ -26,6 +26,8 @@ #include #include #include +#include +#include /******************************************/ // MeshLabWidget Implementation diff --git a/src/meshlab/rich_parameter_gui/richparameterwidgets.h b/src/meshlab/rich_parameter_gui/richparameterwidgets.h index 710ff890e..a82898a0c 100644 --- a/src/meshlab/rich_parameter_gui/richparameterwidgets.h +++ b/src/meshlab/rich_parameter_gui/richparameterwidgets.h @@ -34,8 +34,8 @@ #include #include -#include "common/interfaces.h" #include "common/filter_parameter/rich_parameter_list.h" +#include "common/ml_mesh_type.h" class RichParameterWidget : public QWidget { diff --git a/src/meshlab/savemaskexporter.h b/src/meshlab/savemaskexporter.h index b8b1e358e..ab8c3e570 100644 --- a/src/meshlab/savemaskexporter.h +++ b/src/meshlab/savemaskexporter.h @@ -24,6 +24,8 @@ #ifndef __VCGLIB_SAVEMASK_EXPORT #define __VCGLIB_SAVEMASK_EXPORT +#include + #include #include "rich_parameter_gui/richparameterlistframe.h" diff --git a/src/meshlabplugins/decorate_background/decorate_background.cpp b/src/meshlabplugins/decorate_background/decorate_background.cpp index 0ff45489c..57c4bef65 100644 --- a/src/meshlabplugins/decorate_background/decorate_background.cpp +++ b/src/meshlabplugins/decorate_background/decorate_background.cpp @@ -61,7 +61,7 @@ QString DecorateBackgroundPlugin::pluginName() const return "DecorateBackGround"; } -void DecorateBackgroundPlugin::initGlobalParameterSet(QAction *action, RichParameterList &parset) +void DecorateBackgroundPlugin::initGlobalParameterList(const QAction* action, RichParameterList &parset) { switch(ID(action)) { @@ -85,7 +85,7 @@ void DecorateBackgroundPlugin::initGlobalParameterSet(QAction *action, RichParam } } -bool DecorateBackgroundPlugin::startDecorate( QAction * action, MeshDocument &/*m*/, const RichParameterList * parset, GLArea * gla) +bool DecorateBackgroundPlugin::startDecorate(const QAction * action, MeshDocument &/*m*/, const RichParameterList * parset, GLArea * gla) { if (!GLExtensionsManager::initializeGLextensions_notThrowing()) { return false; @@ -105,7 +105,7 @@ bool DecorateBackgroundPlugin::startDecorate( QAction * action, MeshDocument &/* return true; } -void DecorateBackgroundPlugin::decorateDoc(QAction *a, MeshDocument &m, const RichParameterList * parset,GLArea * gla, QPainter *, GLLogStream &) +void DecorateBackgroundPlugin::decorateDoc(const QAction* a, MeshDocument &m, const RichParameterList * parset, GLArea * gla, QPainter *, GLLogStream &) { static QString lastname("uninitialized"); switch(ID(a)) diff --git a/src/meshlabplugins/decorate_background/decorate_background.h b/src/meshlabplugins/decorate_background/decorate_background.h index b5b3efe9b..182624ebf 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")); @@ -84,11 +85,11 @@ DecorateBackgroundPlugin() QString cubemapFileName; - bool startDecorate(QAction * /*mode*/, MeshDocument &/*m*/, const RichParameterList * /*parent*/ par, GLArea * /*parent*/); - 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; } + bool startDecorate(const QAction* /*mode*/, MeshDocument &/*m*/, const RichParameterList * /*parent*/ par, GLArea * /*parent*/); + void decorateDoc(const QAction *a, MeshDocument &md, const RichParameterList *, GLArea *gla, QPainter *, GLLogStream &_log); + void decorateMesh(const QAction *, MeshModel &, const RichParameterList *, GLArea *, QPainter *, GLLogStream &){} + void initGlobalParameterList(const QAction *, RichParameterList &/*globalparam*/); + int getDecorationClass(const QAction * /*action*/) const { return DecoratePluginInterface::PerDocument; } private: diff --git a/src/meshlabplugins/decorate_base/decorate_base.cpp b/src/meshlabplugins/decorate_base/decorate_base.cpp index 2d8de66ce..7f4fe9da2 100644 --- a/src/meshlabplugins/decorate_base/decorate_base.cpp +++ b/src/meshlabplugins/decorate_base/decorate_base.cpp @@ -79,7 +79,7 @@ QString DecorateBasePlugin::decorationName(FilterIDType filter) const return QString("error!"); } -void DecorateBasePlugin::decorateDoc(QAction *a, MeshDocument &md, const RichParameterList *rm, GLArea *gla, QPainter *painter,GLLogStream &/*_log*/) +void DecorateBasePlugin::decorateDoc(const QAction* a, MeshDocument &md, const RichParameterList *rm, GLArea *gla, QPainter *painter, GLLogStream &/*_log*/) { QFont qf; @@ -107,7 +107,7 @@ void DecorateBasePlugin::decorateDoc(QAction *a, MeshDocument &md, const RichPar } if (md.meshList.size() == 0) - this->RealTimeLog("Show Mesh Camera", md.mm()->label(), "There are no Mesh Layers"); + this->realTimeLog("Show Mesh Camera", md.mm()->label(), "There are no Mesh Layers"); } // draw all visible raster cameras @@ -127,7 +127,7 @@ void DecorateBasePlugin::decorateDoc(QAction *a, MeshDocument &md, const RichPar } if (md.rasterList.size() == 0) - this->RealTimeLog("Show Raster Camera", md.mm()->label(), "There are no Rasters"); + this->realTimeLog("Show Raster Camera", md.mm()->label(), "There are no Rasters"); } } break; @@ -162,7 +162,7 @@ void DecorateBasePlugin::decorateDoc(QAction *a, MeshDocument &md, const RichPar } // end switch } -void DecorateBasePlugin::decorateMesh(QAction *a, MeshModel &m, const RichParameterList *rm, GLArea *gla, QPainter *painter,GLLogStream &_log) +void DecorateBasePlugin::decorateMesh(const QAction* a, MeshModel &m, const RichParameterList *rm, GLArea *gla, QPainter *painter, GLLogStream &_log) { this->setLog(&_log); QFont qf; @@ -251,7 +251,7 @@ void DecorateBasePlugin::decorateMesh(QAction *a, MeshModel &m, const RichParame bmin = m.cm.bbox.min; bmax = m.cm.bbox.max; - this->RealTimeLog("Bounding Box", m.label(), "" + this->realTimeLog("Bounding Box", m.label(), "
" "" "" "" @@ -290,7 +290,7 @@ void DecorateBasePlugin::decorateMesh(QAction *a, MeshModel &m, const RichParame QGLShaderProgram *glp=this->contourShaderProgramMap[&m]; CMeshO::PerMeshAttributeHandle< pair > mmqH = vcg::tri::Allocator::GetPerMeshAttribute >(m.cm,"minmaxQ"); - this->RealTimeLog("Quality Contour", m.label(), + this->realTimeLog("Quality Contour", m.label(), "min Q %f -- max Q %f",mmqH().first,mmqH().second); float stripe_num = rm->getFloat(this->ShowContourFreq()); @@ -510,7 +510,7 @@ void DecorateBasePlugin::DrawBBoxCorner(MeshModel &m, bool absBBoxFlag) glPopAttrib(); } -int DecorateBasePlugin::getDecorationClass(QAction *action) const +int DecorateBasePlugin::getDecorationClass(const QAction *action) const { switch(ID(action)) { @@ -529,7 +529,7 @@ int DecorateBasePlugin::getDecorationClass(QAction *action) const return 0; } -bool DecorateBasePlugin::isDecorationApplicable(QAction *action, const MeshModel& m, QString &ErrorMessage) const +bool DecorateBasePlugin::isDecorationApplicable(const QAction* action, const MeshModel& m, QString &ErrorMessage) const { if( ID(action) == DP_SHOW_LABEL ) { @@ -566,7 +566,7 @@ bool DecorateBasePlugin::isDecorationApplicable(QAction *action, const MeshModel return true; } -bool DecorateBasePlugin::startDecorate(QAction * action, MeshDocument &, const RichParameterList *, GLArea *) +bool DecorateBasePlugin::startDecorate(const QAction * action, MeshDocument &, const RichParameterList *, GLArea *) { switch(ID(action)) { @@ -583,7 +583,7 @@ bool DecorateBasePlugin::startDecorate(QAction * action, MeshDocument &, const R } -void DecorateBasePlugin::endDecorate(QAction * action, MeshModel &m, const RichParameterList *, GLArea *) +void DecorateBasePlugin::endDecorate(const QAction * action, MeshModel &m, const RichParameterList *, GLArea *) { switch(ID(action)) { @@ -598,7 +598,7 @@ void DecorateBasePlugin::endDecorate(QAction * action, MeshModel &m, const RichP } } -bool DecorateBasePlugin::startDecorate(QAction * action, MeshModel &m, const RichParameterList *rm, GLArea *gla) +bool DecorateBasePlugin::startDecorate(const QAction * action, MeshModel &m, const RichParameterList *rm, GLArea *gla) { switch(ID(action)) { @@ -775,11 +775,11 @@ void DecorateBasePlugin::DisplayCamera(QString who, Shotm &ls, int cameraSourceI if(!ls.IsValid()) { if(cameraSourceId == 1 ) - this->RealTimeLog("Show Mesh Camera", who, "Current Mesh Has an invalid Camera"); + this->realTimeLog("Show Mesh Camera", who, "Current Mesh Has an invalid Camera"); else if(cameraSourceId == 2 ) - this->RealTimeLog("Show Raster Camera", who, "Current Raster Has an invalid Camera"); + this->realTimeLog("Show Raster Camera", who, "Current Raster Has an invalid Camera"); else - this->RealTimeLog("Show Camera", who, "Current TrackBall Has an invalid Camera"); + this->realTimeLog("Show Camera", who, "Current TrackBall Has an invalid Camera"); return; } @@ -801,7 +801,7 @@ void DecorateBasePlugin::DisplayCamera(QString who, Shotm &ls, int cameraSourceI // glLabel::render2D(painter,glLabel::TOP_LEFT,ln++, QString("Focal Length %1 (pxsize %2 x %3) ").arg(focal).arg(ls.Intrinsics.PixelSizeMm[0]).arg(ls.Intrinsics.PixelSizeMm[1])); - this->RealTimeLog("Camera Info", who, + this->realTimeLog("Camera Info", who, "
Min: %7.4f %7.4f %7.4f
Max: %7.4f %7.4f %7.4f
Size: %7.4f %7.4f %7.4f
" "" "" @@ -1037,7 +1037,7 @@ void DecorateBasePlugin::DrawTexParam(MeshModel &m, GLArea *gla, QPainter *paint bool faceColor = rm->getBool(this->TextureFaceColorParam()); if (faceColor && !m.hasDataMask(MeshModel::MM_FACECOLOR)) { - this->RealTimeLog("Show UV Tex Param", "The model has no face color", "The model has no Face Color"); + this->realTimeLog("Show UV Tex Param", "The model has no face color", "The model has no Face Color"); faceColor = false; } @@ -1076,7 +1076,7 @@ void DecorateBasePlugin::DrawTexParam(MeshModel &m, GLArea *gla, QPainter *paint glMatrixMode(GL_MODELVIEW); } -void DecorateBasePlugin::initGlobalParameterSet(QAction *action, RichParameterList &parset) +void DecorateBasePlugin::initGlobalParameterList(const QAction* action, RichParameterList &parset) { switch(ID(action)) diff --git a/src/meshlabplugins/decorate_base/decorate_base.h b/src/meshlabplugins/decorate_base/decorate_base.h index 767c34852..f307d7dba 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; @@ -111,14 +113,14 @@ public: - void decorateDoc(QAction *a, MeshDocument &md, const RichParameterList *, GLArea *gla, QPainter *painter, GLLogStream &_log); - void decorateMesh(QAction *a, MeshModel &md, const RichParameterList *, GLArea *gla, QPainter *painter, GLLogStream &_log); - bool startDecorate(QAction * /*mode*/, MeshModel &/*m*/, const RichParameterList *, GLArea * /*parent*/); - void endDecorate(QAction * /*mode*/, MeshModel &/*m*/, const RichParameterList *, GLArea * /*parent*/); - bool startDecorate(QAction * /*mode*/, MeshDocument &/*m*/, const RichParameterList *, GLArea * /*parent*/); - bool isDecorationApplicable(QAction *action, const MeshModel& m, QString &ErrorMessage) const; - int getDecorationClass(QAction * /*action*/) const; - void initGlobalParameterSet(QAction *, RichParameterList &/*globalparam*/); + void decorateDoc(const QAction *a, MeshDocument &md, const RichParameterList *, GLArea *gla, QPainter *painter, GLLogStream &_log); + void decorateMesh(const QAction *a, MeshModel &md, const RichParameterList *, GLArea *gla, QPainter *painter, GLLogStream &_log); + bool startDecorate(const QAction* /*mode*/, MeshModel &/*m*/, const RichParameterList *, GLArea * /*parent*/); + void endDecorate(const QAction* /*mode*/, MeshModel &/*m*/, const RichParameterList *, GLArea * /*parent*/); + bool startDecorate(const QAction * /*mode*/, MeshDocument &/*m*/, const RichParameterList *, GLArea * /*parent*/); + bool isDecorationApplicable(const QAction *action, const MeshModel& m, QString &ErrorMessage) const; + int getDecorationClass(const QAction* /*action*/) const; + void initGlobalParameterList(const QAction *, RichParameterList &/*globalparam*/); inline QString CameraScaleParam() const { return "MeshLab::Decoration::CameraRenderScaleType" ; } inline QString FixedScaleParam() const { return "MeshLab::Decoration::CameraFixedScaleParam" ; } diff --git a/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.cpp b/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.cpp index 85d1dd3da..9b7806fcf 100644 --- a/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.cpp +++ b/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.cpp @@ -189,7 +189,7 @@ QString DecorateRasterProjPlugin::decorationName( FilterIDType id ) const } -int DecorateRasterProjPlugin::getDecorationClass( QAction *act ) const +int DecorateRasterProjPlugin::getDecorationClass(const QAction *act ) const { switch( ID(act) ) { @@ -199,7 +199,7 @@ int DecorateRasterProjPlugin::getDecorationClass( QAction *act ) const } -void DecorateRasterProjPlugin::initGlobalParameterSet( QAction *act, RichParameterList &par ) +void DecorateRasterProjPlugin::initGlobalParameterList(const QAction* act, RichParameterList &par ) { switch( ID(act) ) { @@ -525,10 +525,11 @@ bool DecorateRasterProjPlugin::initShaders(std::string &logs) } -bool DecorateRasterProjPlugin::startDecorate( QAction *act, - MeshDocument & m, - const RichParameterList * /*par*/, - GLArea * /*gla*/ ) +bool DecorateRasterProjPlugin::startDecorate( + const QAction* act, + MeshDocument & m, + const RichParameterList * /*par*/, + GLArea * /*gla*/ ) { switch( ID(act) ) { @@ -572,10 +573,11 @@ bool DecorateRasterProjPlugin::startDecorate( QAction *act, } -void DecorateRasterProjPlugin::endDecorate( QAction *act, - MeshDocument & /*m*/, - const RichParameterList * /*par*/, - GLArea * /*gla*/ ) +void DecorateRasterProjPlugin::endDecorate( + const QAction *act, + MeshDocument & /*m*/, + const RichParameterList * /*par*/, + GLArea * /*gla*/ ) { switch( ID(act) ) { @@ -632,12 +634,13 @@ void DecorateRasterProjPlugin::setPointParameters( MeshDrawer &md, } -void DecorateRasterProjPlugin::decorateDoc( QAction *act, - MeshDocument &m , - const RichParameterList *par, - GLArea *gla, - QPainter *, - GLLogStream &) +void DecorateRasterProjPlugin::decorateDoc( + const QAction* act, + MeshDocument &m , + const RichParameterList *par, + GLArea *gla, + QPainter *, + GLLogStream &) { switch( ID(act) ) { diff --git a/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.h b/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.h index fea51fd2a..2bd49c975 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. @@ -113,12 +114,12 @@ private: public: inline QList actions() const { return actionList; } - bool startDecorate(QAction *act, MeshDocument &m, const RichParameterList *par, GLArea *gla ); - void decorateMesh( QAction * , MeshModel & , const RichParameterList * , GLArea * , QPainter * , GLLogStream & ) {} - void decorateDoc(QAction *act, MeshDocument &m, const RichParameterList* par, GLArea *gla, QPainter *p, GLLogStream & ); - void endDecorate( QAction *act, MeshDocument &m, const RichParameterList *par, GLArea *gla ); - void initGlobalParameterSet( QAction *act, RichParameterList &par ); - int getDecorationClass( QAction *act ) const; + bool startDecorate(const QAction *act, MeshDocument &m, const RichParameterList *par, GLArea *gla ); + void decorateMesh(const QAction * , MeshModel & , const RichParameterList * , GLArea * , QPainter * , GLLogStream & ) {} + void decorateDoc(const QAction *act, MeshDocument &m, const RichParameterList* par, GLArea *gla, QPainter *p, GLLogStream & ); + void endDecorate(const QAction* act, MeshDocument &m, const RichParameterList *par, GLArea *gla ); + void initGlobalParameterList(const QAction *act, RichParameterList &par ); + int getDecorationClass(const QAction* act ) const; }; 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.cpp b/src/meshlabplugins/decorate_shadow/decorate_shadow.cpp index 2ccf2c756..70d40f97d 100644 --- a/src/meshlabplugins/decorate_shadow/decorate_shadow.cpp +++ b/src/meshlabplugins/decorate_shadow/decorate_shadow.cpp @@ -48,7 +48,7 @@ QString DecorateShadowPlugin::pluginName() const return "DecorateShadow"; } -void DecorateShadowPlugin::initGlobalParameterSet(QAction *action, RichParameterList &parset) +void DecorateShadowPlugin::initGlobalParameterList(const QAction* action, RichParameterList &parset) { switch (ID(action)) { case DP_SHOW_SHADOW: { @@ -79,7 +79,7 @@ void DecorateShadowPlugin::initGlobalParameterSet(QAction *action, RichParameter } } -bool DecorateShadowPlugin::startDecorate(QAction* action, MeshDocument& /*m*/, const RichParameterList* parset, GLArea* /*gla*/) +bool DecorateShadowPlugin::startDecorate(const QAction* action, MeshDocument& /*m*/, const RichParameterList* parset, GLArea* /*gla*/) { bool result; @@ -123,7 +123,7 @@ bool DecorateShadowPlugin::startDecorate(QAction* action, MeshDocument& /*m*/, c return false; } -void DecorateShadowPlugin::endDecorate(QAction * action, MeshDocument & /*md*/, const RichParameterList * parset, GLArea * /*gla*/) +void DecorateShadowPlugin::endDecorate(const QAction* action, MeshDocument & /*md*/, const RichParameterList * parset, GLArea * /*gla*/) { switch (ID(action)) { @@ -170,7 +170,7 @@ void DecorateShadowPlugin::endDecorate(QAction * action, MeshDocument & /*md*/, } -void DecorateShadowPlugin::decorateDoc(QAction *action, MeshDocument &md, const RichParameterList *, GLArea *gla, QPainter *, GLLogStream &) +void DecorateShadowPlugin::decorateDoc(const QAction* action, MeshDocument &md, const RichParameterList *, GLArea *gla, QPainter *, GLLogStream &) { switch (ID(action)) { case DP_SHOW_SHADOW: diff --git a/src/meshlabplugins/decorate_shadow/decorate_shadow.h b/src/meshlabplugins/decorate_shadow/decorate_shadow.h index a531bd7c2..3dcd4430d 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, @@ -88,12 +88,12 @@ public: QString pluginName() const; QList actions () const {return actionList;} - bool startDecorate(QAction * /*mode*/, MeshDocument & /*m*/, const RichParameterList * /*parent*/ par, GLArea * /*parent*/); - void decorateMesh(QAction *, MeshModel &, const RichParameterList *, GLArea *, QPainter *, GLLogStream &){} - 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; } + bool startDecorate(const QAction * /*mode*/, MeshDocument & /*m*/, const RichParameterList * /*parent*/ par, GLArea * /*parent*/); + void decorateMesh(const QAction *, MeshModel &, const RichParameterList *, GLArea *, QPainter *, GLLogStream &){} + void decorateDoc(const QAction *a, MeshDocument &m, const RichParameterList*, GLArea *gla, QPainter *p, GLLogStream &); + void endDecorate(const QAction *, MeshDocument &, const RichParameterList *, GLArea *); + void initGlobalParameterList(const QAction *, RichParameterList & globalparam); + int getDecorationClass(const QAction * /*action*/) const { return DecoratePluginInterface::PerDocument; } private: DecorateShader* smShader, *vsmShader, *vsmbShader; diff --git a/src/meshlabplugins/edit_align/AlignPairDialog.h b/src/meshlabplugins/edit_align/AlignPairDialog.h index a4a468240..79a41475f 100644 --- a/src/meshlabplugins/edit_align/AlignPairDialog.h +++ b/src/meshlabplugins/edit_align/AlignPairDialog.h @@ -25,7 +25,6 @@ class QCheckBox; -#include #include "AlignPairWidget.h" #include diff --git a/src/meshlabplugins/edit_align/edit_align.cpp b/src/meshlabplugins/edit_align/edit_align.cpp index 6b66581e5..042afe479 100644 --- a/src/meshlabplugins/edit_align/edit_align.cpp +++ b/src/meshlabplugins/edit_align/edit_align.cpp @@ -37,6 +37,8 @@ $Log: meshedit.cpp,v $ #include #include +#include + using namespace vcg; //todo: remove these orrible defs from here diff --git a/src/meshlabplugins/edit_align/edit_align.h b/src/meshlabplugins/edit_align/edit_align.h index db943b9f3..e4721cdd4 100644 --- a/src/meshlabplugins/edit_align/edit_align.h +++ b/src/meshlabplugins/edit_align/edit_align.h @@ -24,17 +24,17 @@ #ifndef EditAlignPLUGIN_H #define EditAlignPLUGIN_H -#include +#include #include #include "align/OccupancyGrid.h" #include "meshtree.h" #include #include "alignDialog.h" -class EditAlignPlugin : public QObject, public MeshEditInterface +class EditAlignPlugin : public QObject, public EditPluginInterface { Q_OBJECT - Q_INTERFACES(MeshEditInterface) + Q_INTERFACES(EditPluginInterface) enum { diff --git a/src/meshlabplugins/edit_align/edit_align_factory.cpp b/src/meshlabplugins/edit_align/edit_align_factory.cpp index 7aa2d72d2..c601e6d29 100644 --- a/src/meshlabplugins/edit_align/edit_align_factory.cpp +++ b/src/meshlabplugins/edit_align/edit_align_factory.cpp @@ -41,13 +41,13 @@ QList EditAlignFactory::actions() const } //get the edit tool for the given action -MeshEditInterface* EditAlignFactory::getMeshEditInterface(QAction *action) +EditPluginInterface* EditAlignFactory::getMeshEditInterface(const QAction *action) { assert(action == editAlign); (void) action; return new EditAlignPlugin(); } -QString EditAlignFactory::getEditToolDescription(QAction *) +QString EditAlignFactory::getEditToolDescription(const QAction *) { return EditAlignPlugin::Info(); } diff --git a/src/meshlabplugins/edit_align/edit_align_factory.h b/src/meshlabplugins/edit_align/edit_align_factory.h index 2a4570d59..eb60e6b79 100644 --- a/src/meshlabplugins/edit_align/edit_align_factory.h +++ b/src/meshlabplugins/edit_align/edit_align_factory.h @@ -26,13 +26,13 @@ #define EditAlignFactoryPLUGIN_H #include -#include +#include -class EditAlignFactory : public QObject, public MeshEditInterfaceFactory +class EditAlignFactory : public QObject, public EditPluginInterfaceFactory { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_EDIT_INTERFACE_FACTORY_IID) - Q_INTERFACES(MeshEditInterfaceFactory) + MESHLAB_PLUGIN_IID_EXPORTER(EDIT_PLUGIN_INTERFACE_FACTORY_IID) + Q_INTERFACES(EditPluginInterfaceFactory) public: EditAlignFactory(); @@ -42,10 +42,10 @@ public: virtual QList actions() const; //get the edit tool for the given action - virtual MeshEditInterface* getMeshEditInterface(QAction *); + virtual EditPluginInterface* getMeshEditInterface(const QAction*); //get the description for the given action - virtual QString getEditToolDescription(QAction *); + virtual QString getEditToolDescription(const QAction*); private: QList actionList; diff --git a/src/meshlabplugins/edit_align/meshtree.h b/src/meshlabplugins/edit_align/meshtree.h index 856123b90..31e8d854a 100644 --- a/src/meshlabplugins/edit_align/meshtree.h +++ b/src/meshlabplugins/edit_align/meshtree.h @@ -26,7 +26,7 @@ #include -#include +#include #include #include "align/AlignGlobal.h" #include "align/OccupancyGrid.h" diff --git a/src/meshlabplugins/edit_manipulators/edit_manipulators.cpp b/src/meshlabplugins/edit_manipulators/edit_manipulators.cpp index 365af1fa0..f80715068 100644 --- a/src/meshlabplugins/edit_manipulators/edit_manipulators.cpp +++ b/src/meshlabplugins/edit_manipulators/edit_manipulators.cpp @@ -1101,7 +1101,7 @@ void EditManipulatorsPlugin::Decorate(MeshModel &model, GLArea *gla, QPainter* / HelpString3 = "
press RETURN to apply, BACKSPACE to cancel"; } - this->RealTimeLog("Manipulator","",qUtf8Printable(""+StatusString1+""+StatusString2+HelpString1+HelpString2+HelpString3)); + this->realTimeLog("Manipulator","",qUtf8Printable(""+StatusString1+""+StatusString2+HelpString1+HelpString2+HelpString3)); // render original mesh BBox DrawMeshBox(model); diff --git a/src/meshlabplugins/edit_manipulators/edit_manipulators.h b/src/meshlabplugins/edit_manipulators/edit_manipulators.h index 044ca9f5e..61e2c8f2f 100644 --- a/src/meshlabplugins/edit_manipulators/edit_manipulators.h +++ b/src/meshlabplugins/edit_manipulators/edit_manipulators.h @@ -27,12 +27,12 @@ #include #include -#include +#include -class EditManipulatorsPlugin : public QObject, public MeshEditInterface +class EditManipulatorsPlugin : public QObject, public EditPluginInterface { Q_OBJECT - Q_INTERFACES(MeshEditInterface) + Q_INTERFACES(EditPluginInterface) public: diff --git a/src/meshlabplugins/edit_manipulators/edit_manipulators_factory.cpp b/src/meshlabplugins/edit_manipulators/edit_manipulators_factory.cpp index 079e8813c..b219828f8 100644 --- a/src/meshlabplugins/edit_manipulators/edit_manipulators_factory.cpp +++ b/src/meshlabplugins/edit_manipulators/edit_manipulators_factory.cpp @@ -41,7 +41,7 @@ QList EditManipulatorsFactory::actions() const } //get the edit tool for the given action -MeshEditInterface* EditManipulatorsFactory::getMeshEditInterface(QAction *action) +EditPluginInterface* EditManipulatorsFactory::getMeshEditInterface(const QAction *action) { if(action == editManipulators) { @@ -50,7 +50,7 @@ MeshEditInterface* EditManipulatorsFactory::getMeshEditInterface(QAction *action return NULL; } -QString EditManipulatorsFactory::getEditToolDescription(QAction *) +QString EditManipulatorsFactory::getEditToolDescription(const QAction *) { return EditManipulatorsPlugin::Info(); } diff --git a/src/meshlabplugins/edit_manipulators/edit_manipulators_factory.h b/src/meshlabplugins/edit_manipulators/edit_manipulators_factory.h index 0af8668f2..8f56e6c11 100644 --- a/src/meshlabplugins/edit_manipulators/edit_manipulators_factory.h +++ b/src/meshlabplugins/edit_manipulators/edit_manipulators_factory.h @@ -26,13 +26,13 @@ #define EditManipulatorsFactoryPLUGIN_H #include -#include +#include -class EditManipulatorsFactory : public QObject, public MeshEditInterfaceFactory +class EditManipulatorsFactory : public QObject, public EditPluginInterfaceFactory { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_EDIT_INTERFACE_FACTORY_IID) - Q_INTERFACES(MeshEditInterfaceFactory) + MESHLAB_PLUGIN_IID_EXPORTER(EDIT_PLUGIN_INTERFACE_FACTORY_IID) + Q_INTERFACES(EditPluginInterfaceFactory) public: EditManipulatorsFactory(); @@ -42,10 +42,10 @@ public: virtual QList actions() const; //get the edit tool for the given action - virtual MeshEditInterface* getMeshEditInterface(QAction *); + virtual EditPluginInterface* getMeshEditInterface(const QAction*); //get the description for the given action - virtual QString getEditToolDescription(QAction *); + virtual QString getEditToolDescription(const QAction*); private: QList actionList; diff --git a/src/meshlabplugins/edit_measure/edit_measure.cpp b/src/meshlabplugins/edit_measure/edit_measure.cpp index 73f169f4d..aee30fe67 100644 --- a/src/meshlabplugins/edit_measure/edit_measure.cpp +++ b/src/meshlabplugins/edit_measure/edit_measure.cpp @@ -29,6 +29,8 @@ $Log: editmeasure.cpp,v $ #include "edit_measure.h" #include +#include + using namespace vcg; EditMeasurePlugin::EditMeasurePlugin() @@ -91,7 +93,7 @@ void EditMeasurePlugin::Decorate(MeshModel & m, GLArea * gla,QPainter* p) newM.length = measuredDistance; measures.push_back(newM); - this->Log(GLLogStream::FILTER, "Distance %s: %f", newM.ID.toStdString().c_str(), measuredDistance); + this->log(GLLogStream::FILTER, "Distance %s: %f", newM.ID.toStdString().c_str(), measuredDistance); } for (size_t mind = 0; mindRealTimeLog("Point to Point Measure", m.shortName(), + this->realTimeLog("Point to Point Measure", m.shortName(), " -- " ); else - this->RealTimeLog("Point to Point Measure", m.shortName(), + this->realTimeLog("Point to Point Measure", m.shortName(), (instructions + savedmeasure).toStdString().c_str() ); @@ -132,14 +134,14 @@ void EditMeasurePlugin::keyReleaseEvent(QKeyEvent *e, MeshModel &mod, GLArea *gl if (e->key() == Qt::Key_P) // print { - this->Log(GLLogStream::FILTER, "------- Distances -------"); - this->Log(GLLogStream::FILTER, "ID: Dist [pointA][pointB]"); + this->log(GLLogStream::FILTER, "------- Distances -------"); + this->log(GLLogStream::FILTER, "ID: Dist [pointA][pointB]"); for (size_t mind = 0; mindLog(GLLogStream::FILTER, "%s: %f [%f,%f,%f][%f,%f,%f]", measures[mind].ID.toStdString().c_str(), measures[mind].length, + this->log(GLLogStream::FILTER, "%s: %f [%f,%f,%f][%f,%f,%f]", measures[mind].ID.toStdString().c_str(), measures[mind].length, measures[mind].startP[0], measures[mind].startP[1], measures[mind].startP[2], measures[mind].endP[0], measures[mind].endP[1], measures[mind].endP[2]); } - this->Log(GLLogStream::FILTER, "-------------------------"); + this->log(GLLogStream::FILTER, "-------------------------"); } if (e->key() == Qt::Key_S) // save @@ -170,7 +172,7 @@ void EditMeasurePlugin::keyReleaseEvent(QKeyEvent *e, MeshModel &mod, GLArea *gl } else { - this->Log(GLLogStream::WARNING, "- cannot save measures to file -"); + this->log(GLLogStream::WARNING, "- cannot save measures to file -"); } } } diff --git a/src/meshlabplugins/edit_measure/edit_measure.h b/src/meshlabplugins/edit_measure/edit_measure.h index af113697b..48a3fa357 100644 --- a/src/meshlabplugins/edit_measure/edit_measure.h +++ b/src/meshlabplugins/edit_measure/edit_measure.h @@ -32,7 +32,7 @@ $Log: editmeasure.h,v $ #include #include -#include +#include #include //-------------------------------------- @@ -47,10 +47,10 @@ public: //-------------------------------------- -class EditMeasurePlugin : public QObject, public MeshEditInterface +class EditMeasurePlugin : public QObject, public EditPluginInterface { Q_OBJECT - Q_INTERFACES(MeshEditInterface) + Q_INTERFACES(EditPluginInterface) public: EditMeasurePlugin(); diff --git a/src/meshlabplugins/edit_measure/edit_measure_factory.cpp b/src/meshlabplugins/edit_measure/edit_measure_factory.cpp index 31fc2d897..0f023c4c4 100644 --- a/src/meshlabplugins/edit_measure/edit_measure_factory.cpp +++ b/src/meshlabplugins/edit_measure/edit_measure_factory.cpp @@ -41,7 +41,7 @@ QList EditMeasureFactory::actions() const } //get the edit tool for the given action -MeshEditInterface* EditMeasureFactory::getMeshEditInterface(QAction *action) +EditPluginInterface* EditMeasureFactory::getMeshEditInterface(const QAction *action) { if(action == editMeasure) { @@ -50,7 +50,7 @@ MeshEditInterface* EditMeasureFactory::getMeshEditInterface(QAction *action) return NULL; } -QString EditMeasureFactory::getEditToolDescription(QAction *) +QString EditMeasureFactory::getEditToolDescription(const QAction *) { return EditMeasurePlugin::Info(); } diff --git a/src/meshlabplugins/edit_measure/edit_measure_factory.h b/src/meshlabplugins/edit_measure/edit_measure_factory.h index 86e66317a..f92a11c3a 100644 --- a/src/meshlabplugins/edit_measure/edit_measure_factory.h +++ b/src/meshlabplugins/edit_measure/edit_measure_factory.h @@ -26,13 +26,13 @@ #define EditMeasureFactoryPLUGIN_H #include -#include +#include -class EditMeasureFactory : public QObject, public MeshEditInterfaceFactory +class EditMeasureFactory : public QObject, public EditPluginInterfaceFactory { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_EDIT_INTERFACE_FACTORY_IID) - Q_INTERFACES(MeshEditInterfaceFactory) + MESHLAB_PLUGIN_IID_EXPORTER(EDIT_PLUGIN_INTERFACE_FACTORY_IID) + Q_INTERFACES(EditPluginInterfaceFactory) public: EditMeasureFactory(); @@ -42,10 +42,10 @@ public: virtual QList actions() const; //get the edit tool for the given action - virtual MeshEditInterface* getMeshEditInterface(QAction *); + virtual EditPluginInterface* getMeshEditInterface(const QAction*); //get the description for the given action - virtual QString getEditToolDescription(QAction *); + virtual QString getEditToolDescription(const QAction*); private: QList actionList; diff --git a/src/meshlabplugins/edit_mutualcorrs/edit_mutualcorrs.cpp b/src/meshlabplugins/edit_mutualcorrs/edit_mutualcorrs.cpp index 914982e57..e6bfb2f03 100644 --- a/src/meshlabplugins/edit_mutualcorrs/edit_mutualcorrs.cpp +++ b/src/meshlabplugins/edit_mutualcorrs/edit_mutualcorrs.cpp @@ -89,7 +89,7 @@ void EditMutualCorrsPlugin::Decorate(MeshModel &m, GLArea *gla, QPainter *p) else status_line1.sprintf("Check the Info Tab if you need more details
Active Point: %s",pointID[cindex].toStdString().c_str()); - this->RealTimeLog("Raster Alignment", m.shortName(), + this->realTimeLog("Raster Alignment", m.shortName(), "%s
" "%s
" "%s
" @@ -570,12 +570,12 @@ void EditMutualCorrsPlugin::applyMutual() ///// Initialize GLContext - Log("Initialize GL"); + log("Initialize GL"); //glContext->makeCurrent(); if (this->initGL() == false) return; - Log("Done"); + log("Done"); for (int i = 0; i < align.mesh->fn; i++) for (int k = 0; k < 3; k++) @@ -634,7 +634,7 @@ void EditMutualCorrsPlugin::applyMutual() int rounds = (int)(solver.maxiter / 30); for (int i = 0; i -#include +#include #include "edit_mutualcorrsDialog.h" #include "alignset.h" @@ -33,10 +33,10 @@ #include -class EditMutualCorrsPlugin : public QObject, public MeshEditInterface +class EditMutualCorrsPlugin : public QObject, public EditPluginInterface { Q_OBJECT - Q_INTERFACES(MeshEditInterface) + Q_INTERFACES(EditPluginInterface) public: EditMutualCorrsPlugin(); diff --git a/src/meshlabplugins/edit_mutualcorrs/edit_mutualcorrs_factory.cpp b/src/meshlabplugins/edit_mutualcorrs/edit_mutualcorrs_factory.cpp index 6b9b5e1d2..0e73b3cbb 100644 --- a/src/meshlabplugins/edit_mutualcorrs/edit_mutualcorrs_factory.cpp +++ b/src/meshlabplugins/edit_mutualcorrs/edit_mutualcorrs_factory.cpp @@ -41,7 +41,7 @@ QList EditMutualCorrsFactory::actions() const } //get the edit tool for the given action -MeshEditInterface* EditMutualCorrsFactory::getMeshEditInterface(QAction *action) +EditPluginInterface* EditMutualCorrsFactory::getMeshEditInterface(const QAction *action) { if(action == editMutualCorrs) { @@ -50,7 +50,7 @@ MeshEditInterface* EditMutualCorrsFactory::getMeshEditInterface(QAction *action) return NULL; } -QString EditMutualCorrsFactory::getEditToolDescription(QAction *) +QString EditMutualCorrsFactory::getEditToolDescription(const QAction *) { return EditMutualCorrsPlugin::Info(); } diff --git a/src/meshlabplugins/edit_mutualcorrs/edit_mutualcorrs_factory.h b/src/meshlabplugins/edit_mutualcorrs/edit_mutualcorrs_factory.h index a7d4b4827..44bef4b90 100644 --- a/src/meshlabplugins/edit_mutualcorrs/edit_mutualcorrs_factory.h +++ b/src/meshlabplugins/edit_mutualcorrs/edit_mutualcorrs_factory.h @@ -25,13 +25,13 @@ #define EditMutualCorrsPLUGIN_H #include -#include +#include -class EditMutualCorrsFactory : public QObject, public MeshEditInterfaceFactory +class EditMutualCorrsFactory : public QObject, public EditPluginInterfaceFactory { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_EDIT_INTERFACE_FACTORY_IID) - Q_INTERFACES(MeshEditInterfaceFactory) + MESHLAB_PLUGIN_IID_EXPORTER(EDIT_PLUGIN_INTERFACE_FACTORY_IID) + Q_INTERFACES(EditPluginInterfaceFactory) public: EditMutualCorrsFactory(); @@ -41,10 +41,10 @@ public: virtual QList actions() const; //get the edit tool for the given action - virtual MeshEditInterface* getMeshEditInterface(QAction *); + virtual EditPluginInterface* getMeshEditInterface(const QAction*); //get the description for the given action - virtual QString getEditToolDescription(QAction *); + virtual QString getEditToolDescription(const QAction*); private: QList actionList; diff --git a/src/meshlabplugins/edit_paint/edit_paint.h b/src/meshlabplugins/edit_paint/edit_paint.h index 60bad9041..5c54efaa8 100644 --- a/src/meshlabplugins/edit_paint/edit_paint.h +++ b/src/meshlabplugins/edit_paint/edit_paint.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include "paintbox.h" @@ -49,9 +49,9 @@ enum PaintOptions { /** * EditPaint plugin main class (MeshEditing plugin) */ -class EditPaintPlugin : public QObject, public MeshEditInterface { +class EditPaintPlugin : public QObject, public EditPluginInterface { Q_OBJECT - Q_INTERFACES(MeshEditInterface) + Q_INTERFACES(EditPluginInterface) public: EditPaintPlugin(); diff --git a/src/meshlabplugins/edit_paint/edit_paint_factory.cpp b/src/meshlabplugins/edit_paint/edit_paint_factory.cpp index 75599b35c..b56eb10c4 100644 --- a/src/meshlabplugins/edit_paint/edit_paint_factory.cpp +++ b/src/meshlabplugins/edit_paint/edit_paint_factory.cpp @@ -41,7 +41,7 @@ QList EditPaintFactory::actions() const } //get the edit tool for the given action -MeshEditInterface* EditPaintFactory::getMeshEditInterface(QAction *action) +EditPluginInterface* EditPaintFactory::getMeshEditInterface(const QAction *action) { if(action == editPaint) { @@ -50,7 +50,7 @@ MeshEditInterface* EditPaintFactory::getMeshEditInterface(QAction *action) return NULL; } -QString EditPaintFactory::getEditToolDescription(QAction *) +QString EditPaintFactory::getEditToolDescription(const QAction *) { return EditPaintPlugin::Info(); } diff --git a/src/meshlabplugins/edit_paint/edit_paint_factory.h b/src/meshlabplugins/edit_paint/edit_paint_factory.h index b0cfa6034..2ad2056bf 100644 --- a/src/meshlabplugins/edit_paint/edit_paint_factory.h +++ b/src/meshlabplugins/edit_paint/edit_paint_factory.h @@ -26,13 +26,13 @@ #define EditPaintFactoryPLUGIN_H #include -#include +#include -class EditPaintFactory : public QObject, public MeshEditInterfaceFactory +class EditPaintFactory : public QObject, public EditPluginInterfaceFactory { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_EDIT_INTERFACE_FACTORY_IID) - Q_INTERFACES(MeshEditInterfaceFactory) + MESHLAB_PLUGIN_IID_EXPORTER(EDIT_PLUGIN_INTERFACE_FACTORY_IID) + Q_INTERFACES(EditPluginInterfaceFactory) public: EditPaintFactory(); @@ -42,10 +42,10 @@ public: virtual QList actions() const; //get the edit tool for the given action - virtual MeshEditInterface* getMeshEditInterface(QAction *); + virtual EditPluginInterface* getMeshEditInterface(const QAction*); //get the description for the given action - virtual QString getEditToolDescription(QAction *); + virtual QString getEditToolDescription(const QAction*); private: QList actionList; diff --git a/src/meshlabplugins/edit_pickpoints/edit_pickpoints_factory.cpp b/src/meshlabplugins/edit_pickpoints/edit_pickpoints_factory.cpp index dd9be7b87..1fbe5caea 100644 --- a/src/meshlabplugins/edit_pickpoints/edit_pickpoints_factory.cpp +++ b/src/meshlabplugins/edit_pickpoints/edit_pickpoints_factory.cpp @@ -41,7 +41,7 @@ QList EditPickPointsFactory::actions() const } //get the edit tool for the given action -MeshEditInterface* EditPickPointsFactory::getMeshEditInterface(QAction *action) +EditPluginInterface* EditPickPointsFactory::getMeshEditInterface(const QAction *action) { if(action == editPickPoints) { return new EditPickPointsPlugin(); @@ -51,7 +51,7 @@ MeshEditInterface* EditPickPointsFactory::getMeshEditInterface(QAction *action) } } -QString EditPickPointsFactory::getEditToolDescription(QAction *) +QString EditPickPointsFactory::getEditToolDescription(const QAction *) { return EditPickPointsPlugin::Info(); } diff --git a/src/meshlabplugins/edit_pickpoints/edit_pickpoints_factory.h b/src/meshlabplugins/edit_pickpoints/edit_pickpoints_factory.h index eeb9f7747..3d8bb3404 100644 --- a/src/meshlabplugins/edit_pickpoints/edit_pickpoints_factory.h +++ b/src/meshlabplugins/edit_pickpoints/edit_pickpoints_factory.h @@ -26,13 +26,13 @@ #define EditPickPointsFactoryPLUGIN_H #include -#include +#include -class EditPickPointsFactory : public QObject, public MeshEditInterfaceFactory +class EditPickPointsFactory : public QObject, public EditPluginInterfaceFactory { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_EDIT_INTERFACE_FACTORY_IID) - Q_INTERFACES(MeshEditInterfaceFactory) + MESHLAB_PLUGIN_IID_EXPORTER(EDIT_PLUGIN_INTERFACE_FACTORY_IID) + Q_INTERFACES(EditPluginInterfaceFactory) public: EditPickPointsFactory(); @@ -42,10 +42,10 @@ public: virtual QList actions() const; //get the edit tool for the given action - virtual MeshEditInterface* getMeshEditInterface(QAction *); + virtual EditPluginInterface* getMeshEditInterface(const QAction*); //get the description for the given action - QString getEditToolDescription(QAction *); + QString getEditToolDescription(const QAction*); private: QList actionList; diff --git a/src/meshlabplugins/edit_pickpoints/editpickpoints.h b/src/meshlabplugins/edit_pickpoints/editpickpoints.h index 2afe76c62..e6d2168f8 100644 --- a/src/meshlabplugins/edit_pickpoints/editpickpoints.h +++ b/src/meshlabplugins/edit_pickpoints/editpickpoints.h @@ -30,13 +30,13 @@ #ifndef EDIT_PickPoints_PLUGIN_H #define EDIT_PickPoints_PLUGIN_H -#include +#include #include "pickpointsDialog.h" -class EditPickPointsPlugin : public QObject, public MeshEditInterface +class EditPickPointsPlugin : public QObject, public EditPluginInterface { Q_OBJECT - Q_INTERFACES(MeshEditInterface) + Q_INTERFACES(EditPluginInterface) public: //constructor diff --git a/src/meshlabplugins/edit_pickpoints/pickpointsDialog.cpp b/src/meshlabplugins/edit_pickpoints/pickpointsDialog.cpp index bcafa572d..96529e862 100644 --- a/src/meshlabplugins/edit_pickpoints/pickpointsDialog.cpp +++ b/src/meshlabplugins/edit_pickpoints/pickpointsDialog.cpp @@ -40,6 +40,8 @@ #include #include +#include +#include using namespace vcg; diff --git a/src/meshlabplugins/edit_point/edit_point.cpp b/src/meshlabplugins/edit_point/edit_point.cpp index b34e319e7..3e56c0013 100644 --- a/src/meshlabplugins/edit_point/edit_point.cpp +++ b/src/meshlabplugins/edit_point/edit_point.cpp @@ -53,7 +53,7 @@ QString EditPointPlugin::pluginName() const void EditPointPlugin::Decorate(MeshModel &m, GLArea * gla, QPainter */*p*/) { - this->RealTimeLog("Point Selection",m.shortName(), + this->realTimeLog("Point Selection",m.shortName(), "
Viewpoint: %7.4f %7.4f %7.4f
axis 0: %7.4f %7.4f %7.4f
" "" "" diff --git a/src/meshlabplugins/edit_point/edit_point.h b/src/meshlabplugins/edit_point/edit_point.h index 175252bac..003a66dcf 100644 --- a/src/meshlabplugins/edit_point/edit_point.h +++ b/src/meshlabplugins/edit_point/edit_point.h @@ -25,12 +25,12 @@ #define EDITPOINTPLUGIN_H #include -#include +#include -class EditPointPlugin : public QObject, public MeshEditInterface +class EditPointPlugin : public QObject, public EditPluginInterface { Q_OBJECT - Q_INTERFACES(MeshEditInterface) + Q_INTERFACES(EditPluginInterface) public: enum {SELECT_DEFAULT_MODE, SELECT_FITTING_PLANE_MODE}; diff --git a/src/meshlabplugins/edit_point/edit_point_factory.cpp b/src/meshlabplugins/edit_point/edit_point_factory.cpp index c318ea87a..4fff642e9 100644 --- a/src/meshlabplugins/edit_point/edit_point_factory.cpp +++ b/src/meshlabplugins/edit_point/edit_point_factory.cpp @@ -43,7 +43,7 @@ QList PointEditFactory::actions() const } //get the edit tool for the given action -MeshEditInterface* PointEditFactory::getMeshEditInterface(QAction *action) +EditPluginInterface* PointEditFactory::getMeshEditInterface(const QAction *action) { if(action == editPoint) return new EditPointPlugin(EditPointPlugin::SELECT_DEFAULT_MODE); @@ -54,7 +54,7 @@ MeshEditInterface* PointEditFactory::getMeshEditInterface(QAction *action) return nullptr; } -QString PointEditFactory::getEditToolDescription(QAction *) +QString PointEditFactory::getEditToolDescription(const QAction *) { return EditPointPlugin::Info(); } diff --git a/src/meshlabplugins/edit_point/edit_point_factory.h b/src/meshlabplugins/edit_point/edit_point_factory.h index 6aa44d2c0..a35ebe9ae 100644 --- a/src/meshlabplugins/edit_point/edit_point_factory.h +++ b/src/meshlabplugins/edit_point/edit_point_factory.h @@ -26,13 +26,13 @@ #define EditPointFactoryPLUGIN_H #include -#include +#include -class PointEditFactory : public QObject, public MeshEditInterfaceFactory +class PointEditFactory : public QObject, public EditPluginInterfaceFactory { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_EDIT_INTERFACE_FACTORY_IID) - Q_INTERFACES(MeshEditInterfaceFactory) + MESHLAB_PLUGIN_IID_EXPORTER(EDIT_PLUGIN_INTERFACE_FACTORY_IID) + Q_INTERFACES(EditPluginInterfaceFactory) public: PointEditFactory(); @@ -42,10 +42,10 @@ public: virtual QList actions() const; //get the edit tool for the given action - virtual MeshEditInterface* getMeshEditInterface(QAction *); + virtual EditPluginInterface* getMeshEditInterface(const QAction*); //get the description for the given action - virtual QString getEditToolDescription(QAction *); + virtual QString getEditToolDescription(const QAction*); private: QList actionList; diff --git a/src/meshlabplugins/edit_quality/edit_quality_factory.cpp b/src/meshlabplugins/edit_quality/edit_quality_factory.cpp index 0fca870ca..669290f4a 100644 --- a/src/meshlabplugins/edit_quality/edit_quality_factory.cpp +++ b/src/meshlabplugins/edit_quality/edit_quality_factory.cpp @@ -42,7 +42,7 @@ QList QualityMapperFactory::actions() const } //get the edit tool for the given action -MeshEditInterface* QualityMapperFactory::getMeshEditInterface(QAction *action) +EditPluginInterface* QualityMapperFactory::getMeshEditInterface(const QAction *action) { if(action == editQuality) { @@ -51,7 +51,7 @@ MeshEditInterface* QualityMapperFactory::getMeshEditInterface(QAction *action) return nullptr; } -QString QualityMapperFactory::getEditToolDescription(QAction *) +QString QualityMapperFactory::getEditToolDescription(const QAction *) { return QualityMapperPlugin::Info(); } diff --git a/src/meshlabplugins/edit_quality/edit_quality_factory.h b/src/meshlabplugins/edit_quality/edit_quality_factory.h index cae2391fc..810daeed1 100644 --- a/src/meshlabplugins/edit_quality/edit_quality_factory.h +++ b/src/meshlabplugins/edit_quality/edit_quality_factory.h @@ -26,13 +26,13 @@ #define QualityMapperFactoryPLUGIN_H #include -#include +#include -class QualityMapperFactory : public QObject, public MeshEditInterfaceFactory +class QualityMapperFactory : public QObject, public EditPluginInterfaceFactory { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_EDIT_INTERFACE_FACTORY_IID) - Q_INTERFACES(MeshEditInterfaceFactory) + MESHLAB_PLUGIN_IID_EXPORTER(EDIT_PLUGIN_INTERFACE_FACTORY_IID) + Q_INTERFACES(EditPluginInterfaceFactory) public: QualityMapperFactory(); @@ -42,10 +42,10 @@ public: virtual QList actions() const; //get the edit tool for the given action - virtual MeshEditInterface* getMeshEditInterface(QAction *); + virtual EditPluginInterface* getMeshEditInterface(const QAction*); //get the description for the given action - virtual QString getEditToolDescription(QAction *); + virtual QString getEditToolDescription(const QAction*); private: QList actionList; diff --git a/src/meshlabplugins/edit_quality/qualitymapper.cpp b/src/meshlabplugins/edit_quality/qualitymapper.cpp index 0937766f8..6c2f2773d 100644 --- a/src/meshlabplugins/edit_quality/qualitymapper.cpp +++ b/src/meshlabplugins/edit_quality/qualitymapper.cpp @@ -32,6 +32,7 @@ FIRST RELEASE #include #include "qualitymapper.h" #include //for quality +#include using namespace vcg; diff --git a/src/meshlabplugins/edit_quality/qualitymapper.h b/src/meshlabplugins/edit_quality/qualitymapper.h index df4d1108a..d31e61eb1 100644 --- a/src/meshlabplugins/edit_quality/qualitymapper.h +++ b/src/meshlabplugins/edit_quality/qualitymapper.h @@ -34,14 +34,14 @@ FIRST RELEASE #include #include -#include +#include #include "qualitymapperdialog.h" //This class defines the plugin interface -class QualityMapperPlugin : public QObject, public MeshEditInterface +class QualityMapperPlugin : public QObject, public EditPluginInterface { Q_OBJECT - Q_INTERFACES(MeshEditInterface) + Q_INTERFACES(EditPluginInterface) private: QualityMapperDialog *_qualityMapperDialog; diff --git a/src/meshlabplugins/edit_quality/qualitymapperdialog.cpp b/src/meshlabplugins/edit_quality/qualitymapperdialog.cpp index 59428d945..4cab4aed4 100644 --- a/src/meshlabplugins/edit_quality/qualitymapperdialog.cpp +++ b/src/meshlabplugins/edit_quality/qualitymapperdialog.cpp @@ -27,6 +27,7 @@ #include #include #include +#include using namespace vcg; diff --git a/src/meshlabplugins/edit_referencing/edit_referencing.cpp b/src/meshlabplugins/edit_referencing/edit_referencing.cpp index c442133ab..3e09e2d43 100644 --- a/src/meshlabplugins/edit_referencing/edit_referencing.cpp +++ b/src/meshlabplugins/edit_referencing/edit_referencing.cpp @@ -30,6 +30,7 @@ #include "edit_referencingDialog.h" #include +#include #define MAX_REFPOINTS 128 @@ -107,7 +108,7 @@ void EditReferencingPlugin::DecorateAbsolute(MeshModel &m, GLArea * /*gla*/, QPa else status_line1.sprintf("Active Point: %s",pointID[cindex].toStdString().c_str()); - this->RealTimeLog("Edit Referencing", m.shortName(), + this->realTimeLog("Edit Referencing", m.shortName(), "Absolute Referencing
" "%s
" "%s
" @@ -229,7 +230,7 @@ void EditReferencingPlugin::DecorateScale(MeshModel &m, GLArea * /*gla*/, QPaint else status_line3.sprintf("NO VALID SCENE SCALE"); - this->RealTimeLog("Edit Referencing", m.shortName(), + this->realTimeLog("Edit Referencing", m.shortName(), "Scale Referencing
" "%s
" "%s

" @@ -741,7 +742,7 @@ void EditReferencingPlugin::calculateMatrix() if(referencingDialog->ui->cbAllowScaling->checkState() == Qt::Checked) { - this->Log(GLLogStream::FILTER, "calculating NON RIGID transformation using %d reference points:", FixP.size()); + this->log(GLLogStream::FILTER, "calculating NON RIGID transformation using %d reference points:", FixP.size()); referencingResults.append(QString("NON RIGID transformation from %1 reference points:\n").arg(QString::number(FixP.size()))); ComputeSimilarityMatchMatrix(FixP, MovP, transfMatrix); validMatrix=true; @@ -749,7 +750,7 @@ void EditReferencingPlugin::calculateMatrix() } else { - this->Log(GLLogStream::FILTER, "calculating RIGID transformation using %d reference points:", FixP.size()); + this->log(GLLogStream::FILTER, "calculating RIGID transformation using %d reference points:", FixP.size()); referencingResults.append(QString("RIGID transformation from %1 reference points:\n").arg(QString::number(FixP.size()))); ComputeRigidMatchMatrix(FixP, MovP, transfMatrix); validMatrix=true; @@ -774,16 +775,16 @@ void EditReferencingPlugin::calculateMatrix() if(isMatrixRigid) - this->Log(GLLogStream::FILTER, "RIGID MATRIX:"); + this->log(GLLogStream::FILTER, "RIGID MATRIX:"); else - this->Log(GLLogStream::FILTER, "NON-RIGID MATRIX:"); - this->Log(GLLogStream::FILTER, "%f %f %f %f",transfMatrix[0][0],transfMatrix[0][1],transfMatrix[0][2],transfMatrix[0][3]); - this->Log(GLLogStream::FILTER, "%f %f %f %f",transfMatrix[1][0],transfMatrix[1][1],transfMatrix[1][2],transfMatrix[1][3]); - this->Log(GLLogStream::FILTER, "%f %f %f %f",transfMatrix[2][0],transfMatrix[2][1],transfMatrix[2][2],transfMatrix[2][3]); - this->Log(GLLogStream::FILTER, "%f %f %f %f",transfMatrix[3][0],transfMatrix[3][1],transfMatrix[3][2],transfMatrix[3][3]); + this->log(GLLogStream::FILTER, "NON-RIGID MATRIX:"); + this->log(GLLogStream::FILTER, "%f %f %f %f",transfMatrix[0][0],transfMatrix[0][1],transfMatrix[0][2],transfMatrix[0][3]); + this->log(GLLogStream::FILTER, "%f %f %f %f",transfMatrix[1][0],transfMatrix[1][1],transfMatrix[1][2],transfMatrix[1][3]); + this->log(GLLogStream::FILTER, "%f %f %f %f",transfMatrix[2][0],transfMatrix[2][1],transfMatrix[2][2],transfMatrix[2][3]); + this->log(GLLogStream::FILTER, "%f %f %f %f",transfMatrix[3][0],transfMatrix[3][1],transfMatrix[3][2],transfMatrix[3][3]); - this->Log(GLLogStream::FILTER, " "); - this->Log(GLLogStream::FILTER, "Residual Errors:"); + this->log(GLLogStream::FILTER, " "); + this->log(GLLogStream::FILTER, "Residual Errors:"); referencingResults.append("\n\nResidual Errors:\n\n"); @@ -792,7 +793,7 @@ void EditReferencingPlugin::calculateMatrix() if (usePoint[pindex]) { pointError[pindex] = (refPoints[pindex] - (transfMatrix * pickedPoints[pindex])).Norm(); - this->Log(GLLogStream::FILTER, "%s: %f", pointID[pindex].toStdString().c_str(), pointError[pindex]); + this->log(GLLogStream::FILTER, "%s: %f", pointID[pindex].toStdString().c_str(), pointError[pindex]); referencingResults.append(QString("Point %1: %2\n").arg(pointID[pindex]).arg(QString::number(pointError[pindex]))); } else diff --git a/src/meshlabplugins/edit_referencing/edit_referencing.h b/src/meshlabplugins/edit_referencing/edit_referencing.h index f92844e5d..24efc090c 100644 --- a/src/meshlabplugins/edit_referencing/edit_referencing.h +++ b/src/meshlabplugins/edit_referencing/edit_referencing.h @@ -25,17 +25,17 @@ #define EDITREFERENCINGPLUGIN_H #include -#include +#include #include "edit_referencingDialog.h" // function to calculate rototranslaton and rototranslaton+scale matrices from series of points #include -class EditReferencingPlugin : public QObject, public MeshEditInterface +class EditReferencingPlugin : public QObject, public EditPluginInterface { Q_OBJECT - Q_INTERFACES(MeshEditInterface) + Q_INTERFACES(EditPluginInterface) public: diff --git a/src/meshlabplugins/edit_referencing/edit_referencing_factory.cpp b/src/meshlabplugins/edit_referencing/edit_referencing_factory.cpp index c75414d8b..fbe41c788 100644 --- a/src/meshlabplugins/edit_referencing/edit_referencing_factory.cpp +++ b/src/meshlabplugins/edit_referencing/edit_referencing_factory.cpp @@ -41,7 +41,7 @@ QList EditReferencingFactory::actions() const } //get the edit tool for the given action -MeshEditInterface* EditReferencingFactory::getMeshEditInterface(QAction *action) +EditPluginInterface* EditReferencingFactory::getMeshEditInterface(const QAction *action) { if(action == editReferencing) { @@ -50,7 +50,7 @@ MeshEditInterface* EditReferencingFactory::getMeshEditInterface(QAction *action) return nullptr; } -QString EditReferencingFactory::getEditToolDescription(QAction *) +QString EditReferencingFactory::getEditToolDescription(const QAction *) { return EditReferencingPlugin::Info(); } diff --git a/src/meshlabplugins/edit_referencing/edit_referencing_factory.h b/src/meshlabplugins/edit_referencing/edit_referencing_factory.h index 5fe2f93bf..503d4c97e 100644 --- a/src/meshlabplugins/edit_referencing/edit_referencing_factory.h +++ b/src/meshlabplugins/edit_referencing/edit_referencing_factory.h @@ -25,13 +25,13 @@ #define EditReferencingFactoryPLUGIN_H #include -#include +#include -class EditReferencingFactory : public QObject, public MeshEditInterfaceFactory +class EditReferencingFactory : public QObject, public EditPluginInterfaceFactory { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_EDIT_INTERFACE_FACTORY_IID) - Q_INTERFACES(MeshEditInterfaceFactory) + MESHLAB_PLUGIN_IID_EXPORTER(EDIT_PLUGIN_INTERFACE_FACTORY_IID) + Q_INTERFACES(EditPluginInterfaceFactory) public: EditReferencingFactory(); @@ -41,10 +41,10 @@ public: virtual QList actions() const; //get the edit tool for the given action - virtual MeshEditInterface* getMeshEditInterface(QAction *); + virtual EditPluginInterface* getMeshEditInterface(const QAction*); //get the description for the given action - virtual QString getEditToolDescription(QAction *); + virtual QString getEditToolDescription(const QAction*); private: QList actionList; diff --git a/src/meshlabplugins/edit_sample/edit_sample.cpp b/src/meshlabplugins/edit_sample/edit_sample.cpp index 4d1f64703..220b3f8af 100644 --- a/src/meshlabplugins/edit_sample/edit_sample.cpp +++ b/src/meshlabplugins/edit_sample/edit_sample.cpp @@ -129,7 +129,7 @@ void SampleEditPlugin::Decorate(MeshModel &m, GLArea * gla, QPainter *p) } } - this->RealTimeLog("Geometry Info", m.shortName(), + this->realTimeLog("Geometry Info", m.shortName(), "%s %s %s", line1.toStdString().c_str(), line2.toStdString().c_str(), line3.toStdString().c_str()); // finally, the actual decoration @@ -267,39 +267,39 @@ void SampleEditPlugin::keyReleaseEvent(QKeyEvent *e, MeshModel &m, GLArea *gla) // print on log if (pickmode == 0) { - this->Log(GLLogStream::FILTER, "------"); - this->Log(GLLogStream::FILTER, "face# %i : vert# (%i %i %i)", tri::Index(m.cm, curFacePtr), tri::Index(m.cm, curFacePtr->V(0)), tri::Index(m.cm, curFacePtr->V(1)), tri::Index(m.cm, curFacePtr->V(2))); + this->log(GLLogStream::FILTER, "------"); + this->log(GLLogStream::FILTER, "face# %i : vert# (%i %i %i)", tri::Index(m.cm, curFacePtr), tri::Index(m.cm, curFacePtr->V(0)), tri::Index(m.cm, curFacePtr->V(1)), tri::Index(m.cm, curFacePtr->V(2))); if (m.hasDataMask(MeshModel::MM_FACECOLOR)) - this->Log(GLLogStream::FILTER, "face color (%i %i %i %i)", curFacePtr->C()[0], curFacePtr->C()[1], curFacePtr->C()[2], curFacePtr->C()[3]); + this->log(GLLogStream::FILTER, "face color (%i %i %i %i)", curFacePtr->C()[0], curFacePtr->C()[1], curFacePtr->C()[2], curFacePtr->C()[3]); for (int i = 0; i < 3; ++i) { - this->Log(GLLogStream::FILTER, "face vert %i : vert# %i", i, tri::Index(m.cm, curFacePtr->V(i))); - this->Log(GLLogStream::FILTER, "position [%f %f %f]", curFacePtr->V(i)->P()[0], curFacePtr->V(i)->P()[1], curFacePtr->V(i)->P()[2]); - this->Log(GLLogStream::FILTER, "normal [%f %f %f]", curFacePtr->V(i)->N()[0], curFacePtr->V(i)->N()[1], curFacePtr->V(i)->N()[2]); + this->log(GLLogStream::FILTER, "face vert %i : vert# %i", i, tri::Index(m.cm, curFacePtr->V(i))); + this->log(GLLogStream::FILTER, "position [%f %f %f]", curFacePtr->V(i)->P()[0], curFacePtr->V(i)->P()[1], curFacePtr->V(i)->P()[2]); + this->log(GLLogStream::FILTER, "normal [%f %f %f]", curFacePtr->V(i)->N()[0], curFacePtr->V(i)->N()[1], curFacePtr->V(i)->N()[2]); if (m.hasDataMask(MeshModel::MM_VERTQUALITY)) - this->Log(GLLogStream::FILTER, "quality %f", curFacePtr->V(i)->Q()); + this->log(GLLogStream::FILTER, "quality %f", curFacePtr->V(i)->Q()); if (m.hasDataMask(MeshModel::MM_VERTCOLOR)) - this->Log(GLLogStream::FILTER, "color (%f %f %f %f)", curFacePtr->V(i)->C()[0], curFacePtr->V(i)->C()[1], curFacePtr->V(i)->C()[2], curFacePtr->V(i)->C()[3]); + this->log(GLLogStream::FILTER, "color (%f %f %f %f)", curFacePtr->V(i)->C()[0], curFacePtr->V(i)->C()[1], curFacePtr->V(i)->C()[2], curFacePtr->V(i)->C()[3]); if (m.hasDataMask(MeshModel::MM_WEDGTEXCOORD)) - this->Log(GLLogStream::FILTER, "wedge UV (%f %f) texID %i)", curFacePtr->WT(i).U(), curFacePtr->WT(i).V(), curFacePtr->WT(i).N()); + this->log(GLLogStream::FILTER, "wedge UV (%f %f) texID %i)", curFacePtr->WT(i).U(), curFacePtr->WT(i).V(), curFacePtr->WT(i).N()); if (m.hasDataMask(MeshModel::MM_VERTTEXCOORD)) - this->Log(GLLogStream::FILTER, "vertex UV (%f %f) texID %i)", curFacePtr->V(i)->T().U(), curFacePtr->V(i)->T().U(), curFacePtr->V(i)->T().N()); + this->log(GLLogStream::FILTER, "vertex UV (%f %f) texID %i)", curFacePtr->V(i)->T().U(), curFacePtr->V(i)->T().U(), curFacePtr->V(i)->T().N()); } - this->Log(GLLogStream::FILTER, "------"); + this->log(GLLogStream::FILTER, "------"); } else if (pickmode == 1) { - this->Log(GLLogStream::FILTER, "------"); - this->Log(GLLogStream::FILTER, "vertex# %i", tri::Index(m.cm, curVertPtr)); - this->Log(GLLogStream::FILTER, "position [%f %f %f]", curVertPtr->P()[0], curVertPtr->P()[1], curVertPtr->P()[2]); - this->Log(GLLogStream::FILTER, "normal [%f %f %f]", curVertPtr->N()[0], curVertPtr->N()[1], curVertPtr->N()[2]); + this->log(GLLogStream::FILTER, "------"); + this->log(GLLogStream::FILTER, "vertex# %i", tri::Index(m.cm, curVertPtr)); + this->log(GLLogStream::FILTER, "position [%f %f %f]", curVertPtr->P()[0], curVertPtr->P()[1], curVertPtr->P()[2]); + this->log(GLLogStream::FILTER, "normal [%f %f %f]", curVertPtr->N()[0], curVertPtr->N()[1], curVertPtr->N()[2]); if (m.hasDataMask(MeshModel::MM_VERTQUALITY)) - this->Log(GLLogStream::FILTER, "quality %f", curVertPtr->Q()); + this->log(GLLogStream::FILTER, "quality %f", curVertPtr->Q()); if (m.hasDataMask(MeshModel::MM_VERTCOLOR)) - this->Log(GLLogStream::FILTER, "color (%f %f %f %f)", curVertPtr->C()[0], curVertPtr->C()[1], curVertPtr->C()[2], curVertPtr->C()[3]); + this->log(GLLogStream::FILTER, "color (%f %f %f %f)", curVertPtr->C()[0], curVertPtr->C()[1], curVertPtr->C()[2], curVertPtr->C()[3]); if (m.hasDataMask(MeshModel::MM_VERTTEXCOORD)) - this->Log(GLLogStream::FILTER, "vertex UV (%f %f) texID %i)", curVertPtr->T().U(), curVertPtr->T().U(), curVertPtr->T().N()); - this->Log(GLLogStream::FILTER, "------"); + this->log(GLLogStream::FILTER, "vertex UV (%f %f) texID %i)", curVertPtr->T().U(), curVertPtr->T().U(), curVertPtr->T().N()); + this->log(GLLogStream::FILTER, "------"); } gla->update(); } diff --git a/src/meshlabplugins/edit_sample/edit_sample.h b/src/meshlabplugins/edit_sample/edit_sample.h index 1e3a3600a..4f43f247e 100644 --- a/src/meshlabplugins/edit_sample/edit_sample.h +++ b/src/meshlabplugins/edit_sample/edit_sample.h @@ -25,12 +25,12 @@ #define SAMPLEEDITPLUGIN_H #include -#include +#include -class SampleEditPlugin : public QObject, public MeshEditInterface +class SampleEditPlugin : public QObject, public EditPluginInterface { Q_OBJECT - Q_INTERFACES(MeshEditInterface) + Q_INTERFACES(EditPluginInterface) public: SampleEditPlugin(); diff --git a/src/meshlabplugins/edit_sample/edit_sample_factory.cpp b/src/meshlabplugins/edit_sample/edit_sample_factory.cpp index c108229a5..3077e730a 100644 --- a/src/meshlabplugins/edit_sample/edit_sample_factory.cpp +++ b/src/meshlabplugins/edit_sample/edit_sample_factory.cpp @@ -41,7 +41,7 @@ QList SampleEditFactory::actions() const } //get the edit tool for the given action -MeshEditInterface* SampleEditFactory::getMeshEditInterface(QAction *action) +EditPluginInterface* SampleEditFactory::getMeshEditInterface(const QAction *action) { if(action == editSample) { @@ -50,7 +50,7 @@ MeshEditInterface* SampleEditFactory::getMeshEditInterface(QAction *action) return nullptr; } -QString SampleEditFactory::getEditToolDescription(QAction *) +QString SampleEditFactory::getEditToolDescription(const QAction *) { return SampleEditPlugin::Info(); } diff --git a/src/meshlabplugins/edit_sample/edit_sample_factory.h b/src/meshlabplugins/edit_sample/edit_sample_factory.h index 5c9faf6c1..e597f9d21 100644 --- a/src/meshlabplugins/edit_sample/edit_sample_factory.h +++ b/src/meshlabplugins/edit_sample/edit_sample_factory.h @@ -26,13 +26,13 @@ #define SampleEditFactoryPLUGIN_H #include -#include +#include -class SampleEditFactory : public QObject, public MeshEditInterfaceFactory +class SampleEditFactory : public QObject, public EditPluginInterfaceFactory { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_EDIT_INTERFACE_FACTORY_IID) - Q_INTERFACES(MeshEditInterfaceFactory) + MESHLAB_PLUGIN_IID_EXPORTER(EDIT_PLUGIN_INTERFACE_FACTORY_IID) + Q_INTERFACES(EditPluginInterfaceFactory) public: SampleEditFactory(); @@ -42,10 +42,10 @@ public: virtual QList actions() const; //get the edit tool for the given action - virtual MeshEditInterface* getMeshEditInterface(QAction *); + virtual EditPluginInterface* getMeshEditInterface(const QAction*); //get the description for the given action - virtual QString getEditToolDescription(QAction *); + virtual QString getEditToolDescription(const QAction*); private: QList actionList; diff --git a/src/meshlabplugins/edit_select/edit_select.cpp b/src/meshlabplugins/edit_select/edit_select.cpp index 600449b31..e4805dc33 100644 --- a/src/meshlabplugins/edit_select/edit_select.cpp +++ b/src/meshlabplugins/edit_select/edit_select.cpp @@ -27,6 +27,7 @@ #include #include #include +#include using namespace std; @@ -519,7 +520,7 @@ void EditSelectPlugin::Decorate(MeshModel &m, GLArea * gla) line4 = "
A select all, D de-select all, I invert all"; - this->RealTimeLog("Selection from Area", m.shortName(), + this->realTimeLog("Selection from Area", m.shortName(), "%s
%s
%s
%s", line1.toStdString().c_str(), line2.toStdString().c_str(), line3.toStdString().c_str(), line4.toStdString().c_str()); return; @@ -535,7 +536,7 @@ void EditSelectPlugin::Decorate(MeshModel &m, GLArea * gla) line2 = "you may hold:
- CTRL to add
- SHIFT to subtract"; line3 = "
A select all, D de-select all, I invert all"; - this->RealTimeLog("Interactive Selection", m.shortName(), "%s
%s
%s", line1.toStdString().c_str(), line2.toStdString().c_str(), line3.toStdString().c_str()); + this->realTimeLog("Interactive Selection", m.shortName(), "%s
%s
%s", line1.toStdString().c_str(), line2.toStdString().c_str(), line3.toStdString().c_str()); } if (isDragging) diff --git a/src/meshlabplugins/edit_select/edit_select.h b/src/meshlabplugins/edit_select/edit_select.h index 1b71edb82..a5a95d619 100644 --- a/src/meshlabplugins/edit_select/edit_select.h +++ b/src/meshlabplugins/edit_select/edit_select.h @@ -23,12 +23,12 @@ #ifndef EDITPLUGIN_H #define EDITPLUGIN_H -#include +#include -class EditSelectPlugin : public QObject, public MeshEditInterface +class EditSelectPlugin : public QObject, public EditPluginInterface { Q_OBJECT - Q_INTERFACES(MeshEditInterface) + Q_INTERFACES(EditPluginInterface) public: diff --git a/src/meshlabplugins/edit_select/edit_select_factory.cpp b/src/meshlabplugins/edit_select/edit_select_factory.cpp index 306fa337d..f3b46d18a 100644 --- a/src/meshlabplugins/edit_select/edit_select_factory.cpp +++ b/src/meshlabplugins/edit_select/edit_select_factory.cpp @@ -47,7 +47,7 @@ QList EditSelectFactory::actions() const } //get the edit tool for the given action -MeshEditInterface* EditSelectFactory::getMeshEditInterface(QAction *action) +EditPluginInterface* EditSelectFactory::getMeshEditInterface(const QAction *action) { if(action == editSelect) return new EditSelectPlugin(EditSelectPlugin::SELECT_FACE_MODE); @@ -62,7 +62,7 @@ MeshEditInterface* EditSelectFactory::getMeshEditInterface(QAction *action) return nullptr; } -QString EditSelectFactory::getEditToolDescription(QAction * /*a*/) +QString EditSelectFactory::getEditToolDescription(const QAction * /*a*/) { return EditSelectPlugin::Info(); } diff --git a/src/meshlabplugins/edit_select/edit_select_factory.h b/src/meshlabplugins/edit_select/edit_select_factory.h index 6ed1ecc2e..825a0380f 100644 --- a/src/meshlabplugins/edit_select/edit_select_factory.h +++ b/src/meshlabplugins/edit_select/edit_select_factory.h @@ -25,13 +25,13 @@ #ifndef EditSelectFactoryPLUGIN_H #define EditSelectFactoryPLUGIN_H -#include +#include -class EditSelectFactory : public QObject, public MeshEditInterfaceFactory +class EditSelectFactory : public QObject, public EditPluginInterfaceFactory { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_EDIT_INTERFACE_FACTORY_IID) - Q_INTERFACES(MeshEditInterfaceFactory) + MESHLAB_PLUGIN_IID_EXPORTER(EDIT_PLUGIN_INTERFACE_FACTORY_IID) + Q_INTERFACES(EditPluginInterfaceFactory) public: EditSelectFactory(); @@ -41,10 +41,10 @@ public: virtual QList actions() const; //get the edit tool for the given action - virtual MeshEditInterface* getMeshEditInterface(QAction *); + virtual EditPluginInterface* getMeshEditInterface(const QAction*); //get the description for the given action - virtual QString getEditToolDescription(QAction *); + virtual QString getEditToolDescription(const QAction*); private: QList actionList; diff --git a/src/meshlabplugins/filter_ao/filter_ao.cpp b/src/meshlabplugins/filter_ao/filter_ao.cpp index 3b9dcb83a..ef2bf4544 100644 --- a/src/meshlabplugins/filter_ao/filter_ao.cpp +++ b/src/meshlabplugins/filter_ao/filter_ao.cpp @@ -24,6 +24,8 @@ #include #include "filter_ao.h" #include +#include +#include #include #include @@ -91,26 +93,26 @@ QString AmbientOcclusionPlugin::filterInfo(FilterIDType filterId) const return QString(""); } -int AmbientOcclusionPlugin::getRequirements(QAction * /*action*/) +int AmbientOcclusionPlugin::getRequirements(const QAction * /*action*/) { //no requirements needed return 0; } -MeshFilterInterface::FILTER_ARITY AmbientOcclusionPlugin::filterArity(QAction*) const +FilterPluginInterface::FILTER_ARITY AmbientOcclusionPlugin::filterArity(const QAction*) const { return SINGLE_MESH; } int getRequirements(QAction *action); -MeshFilterInterface::FilterClass AmbientOcclusionPlugin::getClass(QAction * /*filter*/) +FilterPluginInterface::FilterClass AmbientOcclusionPlugin::getClass(const QAction * /*filter*/) const { - return MeshFilterInterface::VertexColoring; + return FilterPluginInterface::VertexColoring; //return MeshFilterInterface::FilterClass(MeshFilterInterface::FaceColoring | MeshFilterInterface::VertexColoring); }; -void AmbientOcclusionPlugin::initParameterSet(QAction *action, MeshModel & /*m*/, RichParameterList &parlst) +void AmbientOcclusionPlugin::initParameterList(const QAction *action, MeshModel & /*m*/, RichParameterList &parlst) { switch(ID(action)) { @@ -130,7 +132,7 @@ void AmbientOcclusionPlugin::initParameterSet(QAction *action, MeshModel & /*m*/ default: break; // do not add any parameter for the other filters } } -bool AmbientOcclusionPlugin::applyFilter(QAction * /*filter*/, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) +bool AmbientOcclusionPlugin::applyFilter(const QAction * /*filter*/, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { MeshModel &m=*(md.mm()); @@ -344,7 +346,7 @@ bool AmbientOcclusionPlugin::processGL(MeshModel &m, vector &posVect) } } - Log(GLLogStream::SYSTEM,"Successfully calculated A.O. after %3.2f sec, %3.2f of which is due to initialization", ((float)tAll.elapsed()/1000.0f), ((float)tInitElapsed/1000.0f) ); + log(GLLogStream::SYSTEM,"Successfully calculated A.O. after %3.2f sec, %3.2f of which is due to initialization", ((float)tAll.elapsed()/1000.0f), ((float)tInitElapsed/1000.0f) ); /********** Clean up the mess ************/ @@ -385,7 +387,7 @@ void AmbientOcclusionPlugin::initGL(vcg::CallBackPos *cb, unsigned int numVertic cb(0, "Initializing: Glew and Hardware Capabilities"); if (!GLExtensionsManager::initializeGLextensions_notThrowing()) { - Log(GLLogStream::SYSTEM, "Error initializing OpenGL extensions"); + log(GLLogStream::SYSTEM, "Error initializing OpenGL extensions"); errInit = true; return; } @@ -396,13 +398,13 @@ void AmbientOcclusionPlugin::initGL(vcg::CallBackPos *cb, unsigned int numVertic if (depthTexSize < 16) { - Log(GLLogStream::SYSTEM, "Texture size is too small, 16x16 used instead"); + log(GLLogStream::SYSTEM, "Texture size is too small, 16x16 used instead"); depthTexSize = 16; depthTexArea = depthTexSize*depthTexSize; } if (depthTexSize > maxTexSize) { - Log(GLLogStream::SYSTEM, "Texture size is too large, %dx%d used instead",maxTexSize,maxTexSize); + log(GLLogStream::SYSTEM, "Texture size is too large, %dx%d used instead",maxTexSize,maxTexSize); depthTexSize = maxTexSize; depthTexArea = depthTexSize*depthTexSize; } @@ -419,14 +421,14 @@ void AmbientOcclusionPlugin::initGL(vcg::CallBackPos *cb, unsigned int numVertic { if (!glewIsSupported("GL_EXT_vertex_shader GL_EXT_fragment_shader")) { - Log(GLLogStream::SYSTEM, "Your hardware doesn't support Shaders, which are required for hw occlusion"); + log(GLLogStream::SYSTEM, "Your hardware doesn't support Shaders, which are required for hw occlusion"); errInit = true; return; } } if ( !glewIsSupported("GL_EXT_framebuffer_object") ) { - Log(GLLogStream::SYSTEM, "Your hardware doesn't support FBOs, which are required for hw occlusion"); + log(GLLogStream::SYSTEM, "Your hardware doesn't support FBOs, which are required for hw occlusion"); errInit = true; return; } @@ -438,7 +440,7 @@ void AmbientOcclusionPlugin::initGL(vcg::CallBackPos *cb, unsigned int numVertic //colorFormat = GL_RGB16F_ARB; //dataTypeFP = GL_HALF_FLOAT_ARB; - Log(GLLogStream::SYSTEM,"Your hardware can't do FP32 blending, and currently the FP16 version is not yet implemented."); + log(GLLogStream::SYSTEM,"Your hardware can't do FP32 blending, and currently the FP16 version is not yet implemented."); errInit = true; return; } @@ -448,7 +450,7 @@ void AmbientOcclusionPlugin::initGL(vcg::CallBackPos *cb, unsigned int numVertic } else { - Log(GLLogStream::SYSTEM,"Your hardware doesn't support floating point textures, which are required for hw occlusion"); + log(GLLogStream::SYSTEM,"Your hardware doesn't support floating point textures, which are required for hw occlusion"); errInit = true; return; } @@ -459,7 +461,7 @@ void AmbientOcclusionPlugin::initGL(vcg::CallBackPos *cb, unsigned int numVertic //******* CHECK MODEL SIZE ***********/ if ((maxTexSize*maxTexSize*maxTexPages) < numVertices && useGPU) { - Log(GLLogStream::SYSTEM, "That's a really huge model, I can't handle it in hardware, sorry.."); + log(GLLogStream::SYSTEM, "That's a really huge model, I can't handle it in hardware, sorry.."); errInit = true; return; } @@ -471,7 +473,7 @@ void AmbientOcclusionPlugin::initGL(vcg::CallBackPos *cb, unsigned int numVertic if (smartTexSize > maxTexSize) { //should ever enter this point, just exit with error - Log(GLLogStream::SYSTEM,"There was an error while determining best texture size, unable to continue"); + log(GLLogStream::SYSTEM,"There was an error while determining best texture size, unable to continue"); errInit = true; return; } @@ -621,25 +623,25 @@ bool AmbientOcclusionPlugin::checkFramebuffer() switch (fboStatus) { case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: - Log(GLLogStream::SYSTEM, "FBO Incomplete: Attachment"); + log(GLLogStream::SYSTEM, "FBO Incomplete: Attachment"); break; case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT: - Log(GLLogStream::SYSTEM, "FBO Incomplete: Missing Attachment"); + log(GLLogStream::SYSTEM, "FBO Incomplete: Missing Attachment"); break; case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: - Log(GLLogStream::SYSTEM, "FBO Incomplete: Dimensions"); + log(GLLogStream::SYSTEM, "FBO Incomplete: Dimensions"); break; case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: - Log(GLLogStream::SYSTEM, "FBO Incomplete: Formats"); + log(GLLogStream::SYSTEM, "FBO Incomplete: Formats"); break; case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: - Log(GLLogStream::SYSTEM, "FBO Incomplete: Draw Buffer"); + log(GLLogStream::SYSTEM, "FBO Incomplete: Draw Buffer"); break; case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: - Log(GLLogStream::SYSTEM, "FBO Incomplete: Read Buffer"); + log(GLLogStream::SYSTEM, "FBO Incomplete: Read Buffer"); break; default: - Log(GLLogStream::SYSTEM, "Undefined FBO error"); + log(GLLogStream::SYSTEM, "Undefined FBO error"); assert(0); } diff --git a/src/meshlabplugins/filter_ao/filter_ao.h b/src/meshlabplugins/filter_ao/filter_ao.h index 9bfb05d17..6320f7170 100644 --- a/src/meshlabplugins/filter_ao/filter_ao.h +++ b/src/meshlabplugins/filter_ao/filter_ao.h @@ -26,14 +26,14 @@ #include -#include +#include #include class AOGLWidget; -class AmbientOcclusionPlugin : public QObject, public MeshFilterInterface +class AmbientOcclusionPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) // Attributes protected: @@ -71,12 +71,12 @@ public: QString pluginName() const; QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filterId) const; - FILTER_ARITY filterArity(QAction*) const; - int getRequirements (QAction *action); - FilterClass getClass(QAction *filter); + FILTER_ARITY filterArity(const QAction*) const; + int getRequirements (const QAction* action); + FilterClass getClass(const QAction* filter) const; - void initParameterSet(QAction *,MeshModel &/*m*/,RichParameterList & /*parent*/); - bool applyFilter(QAction *filter,MeshDocument &md,const RichParameterList & /*parent*/,vcg::CallBackPos * cb) ; + void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); + bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; void initTextures(void); void initGL(vcg::CallBackPos *cb,unsigned int numVertices); bool processGL(MeshModel &m, std::vector &posVect); diff --git a/src/meshlabplugins/filter_camera/filter_camera.cpp b/src/meshlabplugins/filter_camera/filter_camera.cpp index 0eb7117e8..428ac9eb7 100644 --- a/src/meshlabplugins/filter_camera/filter_camera.cpp +++ b/src/meshlabplugins/filter_camera/filter_camera.cpp @@ -87,7 +87,7 @@ QString FilterCameraPlugin::filterInfo(FilterIDType filterId) const } // This function define the needed parameters for each filter. -void FilterCameraPlugin::initParameterSet(QAction *action, MeshDocument &/*m*/, RichParameterList & parlst) +void FilterCameraPlugin::initParameterList(const QAction *action, MeshDocument &/*m*/, RichParameterList & parlst) { Shotf defShot; switch(ID(action)) @@ -184,7 +184,7 @@ void FilterCameraPlugin::initParameterSet(QAction *action, MeshDocument &/*m*/, } // Core Function doing the actual mesh processing. -bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos * /*cb*/) +bool FilterCameraPlugin::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos * /*cb*/) { MeshModel* mesh = md.mm(); CMeshO* cm = NULL; @@ -226,7 +226,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri case 0: if (rm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); return false; } tranVec=rm->shot.Extrinsics.Tra(); @@ -234,7 +234,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri case 1: if (cm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); return false; } tranVec=cm->shot.Extrinsics.Tra(); @@ -290,7 +290,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri { if (rm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); return false; } rm->shot.ApplyRigidTransformation(transf); @@ -300,7 +300,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri { if (cm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); return false; } cm->shot.ApplyRigidTransformation(transf); @@ -331,7 +331,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri case 0: if (rm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); return false; } tranVec=rm->shot.Extrinsics.Tra(); @@ -339,7 +339,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri case 1: if (cm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); return false; } tranVec=cm->shot.Extrinsics.Tra(); @@ -400,7 +400,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri { if (rm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); return false; } rm->shot.ApplyRigidTransformation(trTran); @@ -412,7 +412,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri { if (cm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); return false; } cm->shot.ApplyRigidTransformation(trTran); @@ -440,7 +440,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri case 0: if (rm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); return false; } trTran.SetTranslate(-rm->shot.Extrinsics.Tra()); @@ -448,7 +448,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri case 1: if (cm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); return false; } trTran.SetTranslate(-cm->shot.Extrinsics.Tra()); @@ -491,7 +491,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri { if (rm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); return false; } rm->shot.ApplyRigidTransformation(trTran); @@ -501,7 +501,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri { if (cm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); return false; } cm->shot.ApplyRigidTransformation(trTran); @@ -521,7 +521,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri { if (rm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); return false; } inv = rm->shot.Extrinsics.Rot(); @@ -568,7 +568,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri { if (rm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); return false; } rm->shot.ApplyRigidTransformation(mat); @@ -578,7 +578,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri { if (cm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); return false; } cm->shot.ApplyRigidTransformation(mat); @@ -593,7 +593,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri { if (rm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Raster Model to apply this filter!"); return false; } Shotm shotGot=par.getShotm("Shot"); @@ -610,7 +610,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri case FP_SET_MESH_CAMERA : if (cm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); return false; } cm->shot = par.getShotm("Shot"); @@ -619,7 +619,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri { if (cm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); return false; } if(!cm->shot.IsValid()) @@ -661,7 +661,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri { if (cm == NULL) { - Log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); + log(GLLogStream::SYSTEM, "You need a Mesh Model to apply this filter!"); return false; } struct Correspondence{unsigned int id_img;float padding[3];}; @@ -690,7 +690,7 @@ bool FilterCameraPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ri return true; } -int FilterCameraPlugin::postCondition(QAction * filter) const +int FilterCameraPlugin::postCondition(const QAction * filter) const { switch (ID(filter)) { @@ -707,7 +707,7 @@ int FilterCameraPlugin::postCondition(QAction * filter) const } } -FilterCameraPlugin::FilterClass FilterCameraPlugin::getClass(QAction *a) +FilterCameraPlugin::FilterClass FilterCameraPlugin::getClass(const QAction *a) const { switch(ID(a)) { @@ -716,19 +716,19 @@ FilterCameraPlugin::FilterClass FilterCameraPlugin::getClass(QAction *a) case FP_CAMERA_TRANSLATE : case FP_CAMERA_TRANSFORM: case FP_SET_RASTER_CAMERA : - return FilterClass (MeshFilterInterface::Camera + MeshFilterInterface::RasterLayer) ; + return FilterClass (FilterPluginInterface::Camera + FilterPluginInterface::RasterLayer) ; case FP_QUALITY_FROM_CAMERA: - return FilterClass(MeshFilterInterface::Camera + MeshFilterInterface::RasterLayer + MeshFilterInterface::Quality); + return FilterClass(FilterPluginInterface::Camera + FilterPluginInterface::RasterLayer + FilterPluginInterface::Quality); case FP_ORIENT_NORMALS_WITH_CAMERAS: - return FilterClass(MeshFilterInterface::Camera + MeshFilterInterface::Normal); + return FilterClass(FilterPluginInterface::Camera + FilterPluginInterface::Normal); case FP_SET_MESH_CAMERA: - return FilterClass(MeshFilterInterface::Camera + MeshFilterInterface::Layer); + return FilterClass(FilterPluginInterface::Camera + FilterPluginInterface::Layer); } assert(0); - return MeshFilterInterface::Camera; + return FilterPluginInterface::Camera; } -int FilterCameraPlugin::getPreConditions( QAction * a) const +int FilterCameraPlugin::getPreConditions(const QAction * a) const { switch (ID(a)) { @@ -747,7 +747,7 @@ int FilterCameraPlugin::getPreConditions( QAction * a) const return 0; } -MeshFilterInterface::FILTER_ARITY FilterCameraPlugin::filterArity( QAction* act ) const +FilterPluginInterface::FILTER_ARITY FilterCameraPlugin::filterArity(const QAction* act ) const { switch (ID(act)) { diff --git a/src/meshlabplugins/filter_camera/filter_camera.h b/src/meshlabplugins/filter_camera/filter_camera.h index e21cb8dde..76d9fb6ce 100644 --- a/src/meshlabplugins/filter_camera/filter_camera.h +++ b/src/meshlabplugins/filter_camera/filter_camera.h @@ -26,13 +26,13 @@ #include -#include +#include -class FilterCameraPlugin : public QObject, public MeshFilterInterface +class FilterCameraPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { FP_SET_MESH_CAMERA, @@ -46,14 +46,14 @@ public: FilterCameraPlugin(); QString pluginName() const; - int getPreConditions(QAction *) const; - int postCondition(QAction * filter) const; + int getPreConditions(const QAction*) const; + int postCondition(const QAction* filter) const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual FilterClass getClass(QAction *); - virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterList & /*parent*/); - virtual bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - FILTER_ARITY filterArity(QAction* act) const; + virtual FilterClass getClass(const QAction*) const; + virtual void initParameterList(const QAction*, MeshDocument &/*m*/, RichParameterList & /*parent*/); + virtual bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + FILTER_ARITY filterArity(const QAction* act) const; }; #endif diff --git a/src/meshlabplugins/filter_clean/cleanfilter.cpp b/src/meshlabplugins/filter_clean/cleanfilter.cpp index b79d18c2d..447c7d6bc 100644 --- a/src/meshlabplugins/filter_clean/cleanfilter.cpp +++ b/src/meshlabplugins/filter_clean/cleanfilter.cpp @@ -61,7 +61,7 @@ CleanFilter::CleanFilter() FilterIDType tt; foreach(tt , types()) actionList << new QAction(filterName(tt), this); - AC(FP_SNAP_MISMATCHED_BORDER)->setShortcut(QKeySequence("ALT+`")); + getFilterAction(FP_SNAP_MISMATCHED_BORDER)->setShortcut(QKeySequence("ALT+`")); } CleanFilter::~CleanFilter() { @@ -139,7 +139,7 @@ QString CleanFilter::filterName(FilterIDType filter) const return QString("error!"); } - CleanFilter::FilterClass CleanFilter::getClass(QAction *a) + CleanFilter::FilterClass CleanFilter::getClass(const QAction *a) const { switch(ID(a)) { @@ -159,15 +159,15 @@ QString CleanFilter::filterName(FilterIDType filter) const case FP_REMOVE_UNREFERENCED_VERTEX: case FP_REMOVE_DUPLICATED_VERTEX: case FP_COMPACT_VERT: - case FP_COMPACT_FACE: return MeshFilterInterface::Cleaning; - case FP_BALL_PIVOTING: return MeshFilterInterface::Remeshing; - case FP_MERGE_WEDGE_TEX: return MeshFilterInterface::FilterClass(MeshFilterInterface::Cleaning + MeshFilterInterface::Texture); + case FP_COMPACT_FACE: return FilterPluginInterface::Cleaning; + case FP_BALL_PIVOTING: return FilterPluginInterface::Remeshing; + case FP_MERGE_WEDGE_TEX: return FilterPluginInterface::FilterClass(FilterPluginInterface::Cleaning + FilterPluginInterface::Texture); default : assert(0); } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } -int CleanFilter::getRequirements(QAction *action) +int CleanFilter::getRequirements(const QAction *action) { switch(ID(action)) { @@ -195,7 +195,7 @@ int CleanFilter::getRequirements(QAction *action) return 0; } -int CleanFilter::postCondition(QAction* action) const +int CleanFilter::postCondition(const QAction* action) const { switch (ID(action)) { @@ -222,7 +222,7 @@ int CleanFilter::postCondition(QAction* action) const return MeshModel::MM_ALL; } -void CleanFilter::initParameterSet(QAction *action,MeshDocument &md, RichParameterList & parlst) +void CleanFilter::initParameterList(const QAction *action,MeshDocument &md, RichParameterList & parlst) { pair qualityRange; switch(ID(action)) @@ -269,7 +269,7 @@ void CleanFilter::initParameterSet(QAction *action,MeshDocument &md, RichParamet } } -bool CleanFilter::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos * cb) +bool CleanFilter::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos * cb) { MeshModel &m=*(md.mm()); switch(ID(filter)) @@ -291,18 +291,18 @@ bool CleanFilter::applyFilter(QAction *filter, MeshDocument &md, const RichParam // the main processing pivot.BuildMesh(cb); m.clearDataMask(MeshModel::MM_FACEFACETOPO); - Log("Reconstructed surface. Added %i faces",m.cm.fn-startingFn); + log("Reconstructed surface. Added %i faces",m.cm.fn-startingFn); } break; case FP_REMOVE_ISOLATED_DIAMETER: { float minCC= par.getAbsPerc("MinComponentDiag"); std::pair delInfo= tri::Clean::RemoveSmallConnectedComponentsDiameter(m.cm,minCC); - Log("Removed %i connected components out of %i", delInfo.second, delInfo.first); + log("Removed %i connected components out of %i", delInfo.second, delInfo.first); if (par.getBool("removeUnref")) { int delvert = tri::Clean::RemoveUnreferencedVertex(m.cm); - Log("Removed %d unreferenced vertices", delvert); + log("Removed %d unreferenced vertices", delvert); } m.UpdateBoxAndNormals(); }break; @@ -310,11 +310,11 @@ bool CleanFilter::applyFilter(QAction *filter, MeshDocument &md, const RichParam { float minCC= par.getInt("MinComponentSize"); std::pair delInfo=tri::Clean::RemoveSmallConnectedComponentsSize(m.cm,minCC); - Log("Removed %i connected components out of %i", delInfo.second, delInfo.first); + log("Removed %i connected components out of %i", delInfo.second, delInfo.first); if (par.getBool("removeUnref")) { int delvert = tri::Clean::RemoveUnreferencedVertex(m.cm); - Log("Removed %d unreferenced vertices", delvert); + log("Removed %d unreferenced vertices", delvert); } m.UpdateBoxAndNormals(); } break; @@ -341,7 +341,7 @@ bool CleanFilter::applyFilter(QAction *filter, MeshDocument &md, const RichParam } m.clearDataMask(MeshModel::MM_FACEFACETOPO); - Log("Deleted %i vertices and %i faces with a quality lower than %f", deletedVN,deletedFN,val); + log("Deleted %i vertices and %i faces with a quality lower than %f", deletedVN,deletedFN,val); m.UpdateBoxAndNormals(); } break; @@ -350,7 +350,7 @@ bool CleanFilter::applyFilter(QAction *filter, MeshDocument &md, const RichParam float threshold = par.getFloat("Threshold"); bool repeat = par.getBool("Repeat"); int total = tri::Clean::RemoveTVertexByCollapse(m.cm, threshold, repeat); - Log("Successfully removed %d t-vertices", total); + log("Successfully removed %d t-vertices", total); } break; case FP_REMOVE_TVERTEX_FLIP : @@ -358,7 +358,7 @@ bool CleanFilter::applyFilter(QAction *filter, MeshDocument &md, const RichParam float threshold = par.getFloat("Threshold"); bool repeat = par.getBool("Repeat"); int total = tri::Clean::RemoveTVertexByFlip(m.cm, threshold, repeat); - Log("Successfully removed %d t-vertices", total); + log("Successfully removed %d t-vertices", total); } break; case FP_MERGE_WEDGE_TEX : @@ -366,41 +366,41 @@ bool CleanFilter::applyFilter(QAction *filter, MeshDocument &md, const RichParam float threshold = par.getFloat("MergeThr"); tri::UpdateTopology::VertexFace(m.cm); int total = tri::UpdateTexture::WedgeTexMergeClose(m.cm, threshold); - Log("Successfully merged %d wedge tex coord distant less than %f", total,threshold); + log("Successfully merged %d wedge tex coord distant less than %f", total,threshold); } break; case FP_MERGE_CLOSE_VERTEX : { float threshold = par.getAbsPerc("Threshold"); int total = tri::Clean::MergeCloseVertex(m.cm, threshold); - Log("Successfully merged %d vertices", total); + log("Successfully merged %d vertices", total); } break; case FP_REMOVE_DUPLICATE_FACE : { int total = tri::Clean::RemoveDuplicateFace(m.cm); - Log("Successfully deleted %d duplicated faces", total); + log("Successfully deleted %d duplicated faces", total); } break; case FP_REMOVE_FOLD_FACE: { m.updateDataMask(MeshModel::MM_FACECOLOR); int total = tri::Clean::RemoveFaceFoldByFlip(m.cm); - Log("Successfully flipped %d folded faces", total); + log("Successfully flipped %d folded faces", total); m.UpdateBoxAndNormals(); } break; case FP_REMOVE_NON_MANIF_EDGE : { int total = tri::Clean::RemoveNonManifoldFace(m.cm); - Log("Successfully removed %d non-manifold faces", total); + log("Successfully removed %d non-manifold faces", total); m.UpdateBoxAndNormals(); } break; case FP_REMOVE_NON_MANIF_EDGE_SPLIT : { int total = tri::Clean::SplitManifoldComponents(m.cm); - Log("Successfully split the mesh into %d edge manifold components", total); + log("Successfully split the mesh into %d edge manifold components", total); m.UpdateBoxAndNormals(); } break; @@ -408,28 +408,28 @@ bool CleanFilter::applyFilter(QAction *filter, MeshDocument &md, const RichParam { float threshold = par.getFloat("VertDispRatio"); int total = tri::Clean::SplitNonManifoldVertex(m.cm,threshold); - Log("Successfully split %d non manifold vertices faces", total); + log("Successfully split %d non manifold vertices faces", total); m.UpdateBoxAndNormals(); } break; case FP_REMOVE_FACE_ZERO_AREA: { int nullFaces = tri::Clean::RemoveFaceOutOfRangeArea(m.cm, 0); - Log("Removed %d null faces", nullFaces); + log("Removed %d null faces", nullFaces); m.clearDataMask(MeshModel::MM_FACEFACETOPO); } break; case FP_REMOVE_UNREFERENCED_VERTEX: { int delvert = tri::Clean::RemoveUnreferencedVertex(m.cm); - Log("Removed %d unreferenced vertices", delvert); + log("Removed %d unreferenced vertices", delvert); if (delvert != 0) m.UpdateBoxAndNormals(); } break; case FP_REMOVE_DUPLICATED_VERTEX: { int delvert = tri::Clean::RemoveDuplicateVertex(m.cm); - Log("Removed %d duplicated vertices", delvert); + log("Removed %d duplicated vertices", delvert); if (delvert != 0) m.UpdateBoxAndNormals(); m.clearDataMask(MeshModel::MM_FACEFACETOPO); m.clearDataMask(MeshModel::MM_VERTFACETOPO); @@ -439,7 +439,7 @@ bool CleanFilter::applyFilter(QAction *filter, MeshDocument &md, const RichParam { float threshold = par.getFloat("EdgeDistRatio"); int total = SnapVertexBorder(m.cm, threshold,cb); - Log("Successfully Split %d faces to snap", total); + log("Successfully Split %d faces to snap", total); m.clearDataMask(MeshModel::MM_FACEFACETOPO); m.clearDataMask(MeshModel::MM_VERTFACETOPO); } break; diff --git a/src/meshlabplugins/filter_clean/cleanfilter.h b/src/meshlabplugins/filter_clean/cleanfilter.h index c89bc8df0..d182676fb 100644 --- a/src/meshlabplugins/filter_clean/cleanfilter.h +++ b/src/meshlabplugins/filter_clean/cleanfilter.h @@ -25,13 +25,13 @@ #define __CLEAN_FILTER_H__ #include -#include +#include -class CleanFilter : public QObject, public MeshFilterInterface +class CleanFilter : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: /* naming convention : @@ -67,13 +67,13 @@ public: virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual FilterClass getClass(QAction *); - virtual int getRequirements(QAction *); - int postCondition(QAction* ) const; - int getPreConditions(QAction *) const { return MeshModel::MM_NONE; } - virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterList & /*parent*/); - virtual bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - FILTER_ARITY filterArity(QAction *) const {return SINGLE_MESH;} + virtual FilterClass getClass(const QAction*) const; + virtual int getRequirements(const QAction*); + int postCondition(const QAction* ) const; + int getPreConditions(const QAction *) const { return MeshModel::MM_NONE; } + virtual void initParameterList(const QAction*, MeshDocument &/*m*/, RichParameterList & /*parent*/); + virtual bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + FILTER_ARITY filterArity(const QAction *) const {return SINGLE_MESH;} }; diff --git a/src/meshlabplugins/filter_color_projection/filter_color_projection.cpp b/src/meshlabplugins/filter_color_projection/filter_color_projection.cpp index ad0603b8e..a2e01ba31 100644 --- a/src/meshlabplugins/filter_color_projection/filter_color_projection.cpp +++ b/src/meshlabplugins/filter_color_projection/filter_color_projection.cpp @@ -96,7 +96,7 @@ QString FilterColorProjectionPlugin::filterInfo(FilterIDType filterId) const } // What "new" properties the plugin requires -int FilterColorProjectionPlugin::getRequirements(QAction *action){ +int FilterColorProjectionPlugin::getRequirements(const QAction *action){ switch(ID(action)){ case FP_SINGLEIMAGEPROJ: return MeshModel::MM_VERTCOLOR; case FP_MULTIIMAGETRIVIALPROJ: return MeshModel::MM_VERTCOLOR; @@ -108,7 +108,7 @@ int FilterColorProjectionPlugin::getRequirements(QAction *action){ // This function define the needed parameters for each filter. -void FilterColorProjectionPlugin::initParameterSet(QAction *action, MeshDocument &md, RichParameterList & parlst) +void FilterColorProjectionPlugin::initParameterList(const QAction *action, MeshDocument &md, RichParameterList & parlst) { switch(ID(action)) { @@ -218,7 +218,7 @@ void FilterColorProjectionPlugin::initParameterSet(QAction *action, MeshDocument } // Core Function doing the actual mesh processing. -bool FilterColorProjectionPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) +bool FilterColorProjectionPlugin::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { //CMeshO::FaceIterator fi; CMeshO::VertexIterator vi; @@ -265,7 +265,7 @@ bool FilterColorProjectionPlugin::applyFilter(QAction *filter, MeshDocument &md, delete rendermanager; return false; } - Log("init GL"); + log("init GL"); //if( rendermanager->initializeMeshBuffers(model, cb) != 0 ) // return false; //Log("init Buffers"); @@ -364,7 +364,7 @@ bool FilterColorProjectionPlugin::applyFilter(QAction *filter, MeshDocument &md, tri::UpdateBounding::Box(model->cm); // init accumulation buffers for colors and weights - Log("init color accumulation buffers"); + log("init color accumulation buffers"); weights = new double[model->cm.vn]; acc_red = new double[model->cm.vn]; acc_grn = new double[model->cm.vn]; @@ -423,7 +423,7 @@ bool FilterColorProjectionPlugin::applyFilter(QAction *filter, MeshDocument &md, rendermanager = new RenderHelper(); if( rendermanager->initializeGL(cb) != 0 ) return false; - Log("init GL"); + log("init GL"); /*if( rendermanager->initializeMeshBuffers(model, cb) != 0 ) return false; Log("init Buffers");*/ @@ -738,7 +738,7 @@ bool FilterColorProjectionPlugin::applyFilter(QAction *filter, MeshDocument &md, rendermanager = new RenderHelper(); if( rendermanager->initializeGL(cb) != 0 ) return false; - Log("init GL"); + log("init GL"); /*if( rendermanager->initializeMeshBuffers(model, cb) != 0 ) return false; Log("init Buffers");*/ @@ -899,7 +899,7 @@ bool FilterColorProjectionPlugin::applyFilter(QAction *filter, MeshDocument &md, // Save texture cb(90, "Saving texture ..."); CheckError(!img.save(filePath), "Texture file cannot be saved"); - Log( "Texture \"%s\" Created", filePath.toStdString().c_str()); + log( "Texture \"%s\" Created", filePath.toStdString().c_str()); assert(QFile(filePath).exists()); // Assign texture @@ -919,7 +919,7 @@ bool FilterColorProjectionPlugin::applyFilter(QAction *filter, MeshDocument &md, return true; } -FilterColorProjectionPlugin::FilterClass FilterColorProjectionPlugin::getClass(QAction *a) +FilterColorProjectionPlugin::FilterClass FilterColorProjectionPlugin::getClass(const QAction *a) const { switch(ID(a)) { case FP_SINGLEIMAGEPROJ: @@ -932,11 +932,11 @@ FilterColorProjectionPlugin::FilterClass FilterColorProjectionPlugin::getClass(Q return FilterClass(Camera + Texture); break; default : assert(0); - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } } -int FilterColorProjectionPlugin::postCondition( QAction* a ) const{ +int FilterColorProjectionPlugin::postCondition( const QAction* a ) const{ switch(ID(a)) { case FP_SINGLEIMAGEPROJ: return MeshModel::MM_VERTCOLOR; diff --git a/src/meshlabplugins/filter_color_projection/filter_color_projection.h b/src/meshlabplugins/filter_color_projection/filter_color_projection.h index dcf5e8831..d20e29c29 100644 --- a/src/meshlabplugins/filter_color_projection/filter_color_projection.h +++ b/src/meshlabplugins/filter_color_projection/filter_color_projection.h @@ -25,13 +25,13 @@ #define FILTER_COLORPROJ_H #include -#include +#include -class FilterColorProjectionPlugin : public QObject, public MeshFilterInterface +class FilterColorProjectionPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { FP_SINGLEIMAGEPROJ, FP_MULTIIMAGETRIVIALPROJ, FP_MULTIIMAGETRIVIALPROJTEXTURE }; @@ -41,14 +41,14 @@ public: QString pluginName() const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - int postCondition( QAction* ) const; + int postCondition( const QAction* ) const; - virtual FilterClass getClass(QAction *); - virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterList & /*parent*/); - virtual int getRequirements(QAction *); - virtual bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb); + virtual FilterClass getClass(const QAction*) const; + virtual void initParameterList(const QAction*, MeshDocument &/*m*/, RichParameterList & /*parent*/); + virtual int getRequirements(const QAction*); + virtual bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb); - FILTER_ARITY filterArity(QAction *) const {return SINGLE_MESH;} + FILTER_ARITY filterArity(const QAction *) const {return SINGLE_MESH;} private: diff --git a/src/meshlabplugins/filter_color_projection/rastering.h b/src/meshlabplugins/filter_color_projection/rastering.h index a470eec19..5ee63315b 100644 --- a/src/meshlabplugins/filter_color_projection/rastering.h +++ b/src/meshlabplugins/filter_color_projection/rastering.h @@ -25,16 +25,16 @@ #define _RASTERING_H #include -#include #include #include +#include // texel descriptor--------------------------------- typedef struct{ - Point2i texcoord; + vcg::Point2i texcoord; Point3m meshpoint; Point3m meshnormal; diff --git a/src/meshlabplugins/filter_color_projection/render_helper.cpp b/src/meshlabplugins/filter_color_projection/render_helper.cpp index dd143405f..ad9861414 100644 --- a/src/meshlabplugins/filter_color_projection/render_helper.cpp +++ b/src/meshlabplugins/filter_color_projection/render_helper.cpp @@ -22,11 +22,11 @@ ****************************************************************************/ #include +#include #include #include #include -#include #include "render_helper.h" diff --git a/src/meshlabplugins/filter_colorproc/filter_colorproc.cpp b/src/meshlabplugins/filter_colorproc/filter_colorproc.cpp index 9e83bb98c..a8bd6509c 100644 --- a/src/meshlabplugins/filter_colorproc/filter_colorproc.cpp +++ b/src/meshlabplugins/filter_colorproc/filter_colorproc.cpp @@ -170,7 +170,7 @@ QString FilterColorProc::pluginName() const return QString("error!"); } - int FilterColorProc::getRequirements(QAction *action) + int FilterColorProc::getRequirements(const QAction *action) { switch(ID(action)) { @@ -180,7 +180,7 @@ QString FilterColorProc::pluginName() const assert(0); } -void FilterColorProc::initParameterSet(QAction *a, MeshDocument& md, RichParameterList & par) +void FilterColorProc::initParameterList(const QAction *a, MeshDocument& md, RichParameterList & par) { switch(ID(a)) { @@ -368,7 +368,7 @@ void FilterColorProc::initParameterSet(QAction *a, MeshDocument& md, RichParamet } } -bool FilterColorProc::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList &par, vcg::CallBackPos *cb) +bool FilterColorProc::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList &par, vcg::CallBackPos *cb) { MeshModel *m = md.mm(); //get current mesh from document @@ -550,7 +550,7 @@ bool FilterColorProc::applyFilter(QAction *filter, MeshDocument &md, const RichP m->updateDataMask(MeshModel::MM_VERTCOLOR); tri::UpdateColor::PerVertexQualityRamp(m->cm, H.Percentile(0.1f), H.Percentile(0.9f)); } - Log("Saturated Vertex Quality"); + log("Saturated Vertex Quality"); return true; } @@ -579,11 +579,11 @@ bool FilterColorProc::applyFilter(QAction *filter, MeshDocument &md, const RichP if (usePerc) { tri::UpdateColor::PerVertexQualityRamp(m->cm, PercLo, PercHi); - Log("Quality Range: %f %f; Used (%f %f) percentile (%f %f) ", H.MinV(), H.MaxV(), PercLo, PercHi, par.getDynamicFloat("perc"), 100 - par.getDynamicFloat("perc")); + log("Quality Range: %f %f; Used (%f %f) percentile (%f %f) ", H.MinV(), H.MaxV(), PercLo, PercHi, par.getDynamicFloat("perc"), 100 - par.getDynamicFloat("perc")); } else { tri::UpdateColor::PerVertexQualityRamp(m->cm, RangeMin, RangeMax); - Log("Quality Range: %f %f; Used (%f %f)", H.MinV(), H.MaxV(), RangeMin, RangeMax); + log("Quality Range: %f %f; Used (%f %f)", H.MinV(), H.MaxV(), RangeMin, RangeMax); } return true; } @@ -611,11 +611,11 @@ bool FilterColorProc::applyFilter(QAction *filter, MeshDocument &md, const RichP if (usePerc) { tri::UpdateQuality::VertexClamp(m->cm, PercLo, PercHi); - Log("Quality Range: %f %f; Used (%f %f) percentile (%f %f) ", H.MinV(), H.MaxV(), PercLo, PercHi, par.getDynamicFloat("perc"), 100 - par.getDynamicFloat("perc")); + log("Quality Range: %f %f; Used (%f %f) percentile (%f %f) ", H.MinV(), H.MaxV(), PercLo, PercHi, par.getDynamicFloat("perc"), 100 - par.getDynamicFloat("perc")); } else { tri::UpdateQuality::VertexClamp(m->cm, RangeMin, RangeMax); - Log("Quality Range: %f %f; Used (%f %f)", H.MinV(), H.MaxV(), RangeMin, RangeMax); + log("Quality Range: %f %f; Used (%f %f)", H.MinV(), H.MaxV(), RangeMin, RangeMax); } return true; } @@ -644,12 +644,12 @@ bool FilterColorProc::applyFilter(QAction *filter, MeshDocument &md, const RichP if (usePerc){ tri::UpdateColor::PerFaceQualityRamp(m->cm, PercLo, PercHi); - Log("Quality Range: %f %f; Used (%f %f) percentile (%f %f) ", + log("Quality Range: %f %f; Used (%f %f) percentile (%f %f) ", H.MinV(), H.MaxV(), PercLo, PercHi, perc, 100 - perc); } else { tri::UpdateColor::PerFaceQualityRamp(m->cm, RangeMin, RangeMax); - Log("Quality Range: %f %f; Used (%f %f)", H.MinV(), H.MaxV(), RangeMin, RangeMax); + log("Quality Range: %f %f; Used (%f %f)", H.MinV(), H.MaxV(), RangeMin, RangeMax); } return true; } @@ -666,24 +666,24 @@ bool FilterColorProc::applyFilter(QAction *filter, MeshDocument &md, const RichP } int delvert = tri::Clean::RemoveUnreferencedVertex(m->cm); - if (delvert) Log("Pre-Curvature Cleaning: Removed %d unreferenced vertices", delvert); + if (delvert) log("Pre-Curvature Cleaning: Removed %d unreferenced vertices", delvert); tri::Allocator::CompactVertexVector(m->cm); tri::UpdateCurvature::MeanAndGaussian(m->cm); int curvType = par.getEnum("CurvatureType"); switch (curvType) { - case 0: tri::UpdateQuality::VertexFromMeanCurvatureHG(m->cm); Log("Computed Mean Curvature"); break; - case 1: tri::UpdateQuality::VertexFromGaussianCurvatureHG(m->cm); Log("Computed Gaussian Curvature"); break; - case 2: tri::UpdateQuality::VertexFromRMSCurvature(m->cm); Log("Computed RMS Curvature"); break; - case 3: tri::UpdateQuality::VertexFromAbsoluteCurvature(m->cm); Log("Computed ABS Curvature"); break; + case 0: tri::UpdateQuality::VertexFromMeanCurvatureHG(m->cm); log("Computed Mean Curvature"); break; + case 1: tri::UpdateQuality::VertexFromGaussianCurvatureHG(m->cm); log("Computed Gaussian Curvature"); break; + case 2: tri::UpdateQuality::VertexFromRMSCurvature(m->cm); log("Computed RMS Curvature"); break; + case 3: tri::UpdateQuality::VertexFromAbsoluteCurvature(m->cm); log("Computed ABS Curvature"); break; default: assert(0); } Histogramf H; tri::Stat::ComputePerVertexQualityHistogram(m->cm, H); tri::UpdateColor::PerVertexQualityRamp(m->cm, H.Percentile(0.1f), H.Percentile(0.9f)); - Log("Curvature Range: %f %f (Used 90 percentile %f %f) ", H.MinV(), H.MaxV(), H.Percentile(0.1f), H.Percentile(0.9f)); + log("Curvature Range: %f %f (Used 90 percentile %f %f) ", H.MinV(), H.MaxV(), H.Percentile(0.1f), H.Percentile(0.9f)); return true; } @@ -915,7 +915,7 @@ bool FilterColorProc::applyFilter(QAction *filter, MeshDocument &md, const RichP return false; } - MeshFilterInterface::FilterClass FilterColorProc::getClass(QAction *a) + FilterPluginInterface::FilterClass FilterColorProc::getClass(const QAction *a) const { switch(ID(a)) { @@ -933,10 +933,10 @@ bool FilterColorProc::applyFilter(QAction *filter, MeshDocument &md, const RichP case CP_MAP_VQUALITY_INTO_COLOR: case CP_VERTEX_SMOOTH: case CP_FACE_TO_VERTEX: - case CP_TEXTURE_TO_VERTEX: return MeshFilterInterface::VertexColoring; - case CP_SCATTER_PER_MESH: return MeshFilterInterface::MeshColoring; + case CP_TEXTURE_TO_VERTEX: return FilterPluginInterface::VertexColoring; + case CP_SCATTER_PER_MESH: return FilterPluginInterface::MeshColoring; case CP_SATURATE_QUALITY: - case CP_CLAMP_QUALITY: return MeshFilterInterface::Quality; + case CP_CLAMP_QUALITY: return FilterPluginInterface::Quality; case CP_DISCRETE_CURVATURE: return FilterClass(Normal + VertexColoring); case CP_TRIANGLE_QUALITY: return FilterClass(Quality + FaceColoring); case CP_RANDOM_FACE: @@ -944,13 +944,13 @@ bool FilterColorProc::applyFilter(QAction *filter, MeshDocument &md, const RichP case CP_FACE_SMOOTH: case CP_VERTEX_TO_FACE: case CP_MESH_TO_FACE: - case CP_MAP_FQUALITY_INTO_COLOR: return MeshFilterInterface::FaceColoring; + case CP_MAP_FQUALITY_INTO_COLOR: return FilterPluginInterface::FaceColoring; default: assert(0); } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } -int FilterColorProc::postCondition( QAction* filter ) const +int FilterColorProc::postCondition( const QAction* filter ) const { switch(ID(filter)) { @@ -986,7 +986,7 @@ int FilterColorProc::postCondition( QAction* filter ) const return MeshModel::MM_NONE; } -int FilterColorProc::getPreConditions( QAction * filter ) const +int FilterColorProc::getPreConditions(const QAction* filter ) const { switch(ID(filter)) { @@ -1022,7 +1022,7 @@ int FilterColorProc::getPreConditions( QAction * filter ) const return MeshModel::MM_NONE; } -MeshFilterInterface::FILTER_ARITY FilterColorProc::filterArity( QAction *act ) const +FilterPluginInterface::FILTER_ARITY FilterColorProc::filterArity(const QAction* act ) const { switch(ID(act)) { @@ -1050,12 +1050,12 @@ MeshFilterInterface::FILTER_ARITY FilterColorProc::filterArity( QAction *act ) c case CP_MAP_FQUALITY_INTO_COLOR: case CP_FACE_TO_VERTEX: case CP_FACE_SMOOTH: - case CP_TEXTURE_TO_VERTEX: return MeshFilterInterface::SINGLE_MESH; - case CP_SCATTER_PER_MESH: return MeshFilterInterface::VARIABLE; + case CP_TEXTURE_TO_VERTEX: return FilterPluginInterface::SINGLE_MESH; + case CP_SCATTER_PER_MESH: return FilterPluginInterface::VARIABLE; default: assert(0); } - return MeshFilterInterface::SINGLE_MESH; + return FilterPluginInterface::SINGLE_MESH; } diff --git a/src/meshlabplugins/filter_colorproc/filter_colorproc.h b/src/meshlabplugins/filter_colorproc/filter_colorproc.h index ea19bc85d..9238117a1 100644 --- a/src/meshlabplugins/filter_colorproc/filter_colorproc.h +++ b/src/meshlabplugins/filter_colorproc/filter_colorproc.h @@ -25,14 +25,14 @@ #define FILTERCOLORPROCPLUGIN_H #include -#include +#include -class FilterColorProc : public QObject, public MeshFilterInterface +class FilterColorProc : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { CP_FILLING, @@ -68,16 +68,16 @@ public: ~FilterColorProc(); QString pluginName() const; - virtual FilterClass getClass(QAction *); + virtual FilterClass getClass(const QAction*) const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual int getRequirements(QAction *); + virtual int getRequirements(const QAction*); - virtual void initParameterSet(QAction *,MeshDocument&, RichParameterList & /*parent*/); - virtual bool applyFilter(QAction *filter, MeshDocument&, const RichParameterList & /*parent*/, vcg::CallBackPos * cb); - int postCondition(QAction* filter) const; - int getPreConditions(QAction *) const; - FILTER_ARITY filterArity(QAction *act) const; + virtual void initParameterList(const QAction*, MeshDocument&, RichParameterList & /*parent*/); + virtual bool applyFilter(const QAction* filter, MeshDocument&, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb); + int postCondition(const QAction* filter) const; + int getPreConditions(const QAction *) const; + FILTER_ARITY filterArity(const QAction *act) const; }; #endif diff --git a/src/meshlabplugins/filter_create/filter_create.cpp b/src/meshlabplugins/filter_create/filter_create.cpp index 9aeb6acb4..4c1988462 100644 --- a/src/meshlabplugins/filter_create/filter_create.cpp +++ b/src/meshlabplugins/filter_create/filter_create.cpp @@ -98,7 +98,7 @@ QString FilterCreate::filterInfo(FilterIDType filterId) const // - the string shown in the dialog // - the default value // - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog) -void FilterCreate::initParameterSet(QAction *action, MeshModel & /*m*/, RichParameterList & parlst) +void FilterCreate::initParameterList(const QAction *action, MeshModel & /*m*/, RichParameterList & parlst) { switch(ID(action)) { @@ -167,7 +167,7 @@ void FilterCreate::initParameterSet(QAction *action, MeshModel & /*m*/, RichPara } // The Real Core Function doing the actual mesh processing. -bool FilterCreate::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, CallBackPos * /*cb*/) +bool FilterCreate::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, CallBackPos * /*cb*/) { MeshModel *currM = md.mm(); MeshModel *m = nullptr; @@ -240,7 +240,7 @@ bool FilterCreate::applyFilter(QAction *filter, MeshDocument &md, const RichPara selected_pts.push_back(p); Naccum = Naccum + (*vi).N(); } - Log("Using %i vertices to build a fitting plane", int(selected_pts.size())); + log("Using %i vertices to build a fitting plane", int(selected_pts.size())); Plane3m plane; FitPlaneToPointSet(selected_pts, plane); plane.Normalize(); @@ -253,9 +253,9 @@ bool FilterCreate::applyFilter(QAction *filter, MeshDocument &md, const RichPara float errorSum = 0; for (size_t i = 0; i < selected_pts.size(); ++i) errorSum += fabs(SignedDistancePlanePoint(plane, selected_pts[i])); - Log("Fitting Plane avg error is %f", errorSum / float(selected_pts.size())); - Log("Fitting Plane normal is [%f, %f, %f]", plane.Direction().X(), plane.Direction().Y(), plane.Direction().Z()); - Log("Fitting Plane offset is %f", plane.Offset()); + log("Fitting Plane avg error is %f", errorSum / float(selected_pts.size())); + log("Fitting Plane normal is [%f, %f, %f]", plane.Direction().X(), plane.Direction().Y(), plane.Direction().Z()); + log("Fitting Plane offset is %f", plane.Offset()); // find center of selection on plane Point3m centerP; @@ -264,7 +264,7 @@ bool FilterCreate::applyFilter(QAction *filter, MeshDocument &md, const RichPara centerP += plane.Projection(selected_pts[i]); } centerP /= selected_pts.size(); - Log("center [%f, %f, %f]", centerP.X(), centerP.Y(), centerP.Z()); + log("center [%f, %f, %f]", centerP.X(), centerP.Y(), centerP.Z()); // find horizontal and vertical axis Point3m dirH, dirV; @@ -360,8 +360,8 @@ bool FilterCreate::applyFilter(QAction *filter, MeshDocument &md, const RichPara } } - Log("H [%f, %f, %f]", dirH.X(), dirH.Y(), dirH.Z()); - Log("V [%f, %f, %f]", dirV.X(), dirV.Y(), dirV.Z()); + log("H [%f, %f, %f]", dirH.X(), dirH.Y(), dirH.Z()); + log("V [%f, %f, %f]", dirV.X(), dirV.Y(), dirV.Z()); // find extent @@ -381,7 +381,7 @@ bool FilterCreate::applyFilter(QAction *filter, MeshDocument &md, const RichPara float exScale = par.getFloat("extent"); dimV = dimV * exScale; dimH = dimH * exScale; - Log("extent on plane [%f, %f]", dimV, dimH); + log("extent on plane [%f, %f]", dimV, dimH); int vertNum = par.getInt("subdiv") + 1; if (vertNum <= 1) vertNum = 2; @@ -527,7 +527,7 @@ bool FilterCreate::applyFilter(QAction *filter, MeshDocument &md, const RichPara return true; } - MeshFilterInterface::FilterClass FilterCreate::getClass(QAction *a) + FilterPluginInterface::FilterClass FilterCreate::getClass(const QAction *a) const { switch(ID(a)) { @@ -543,11 +543,11 @@ bool FilterCreate::applyFilter(QAction *filter, MeshDocument &md, const RichPara case CR_CONE: case CR_TORUS: case CR_FITPLANE: - return MeshFilterInterface::MeshCreation; + return FilterPluginInterface::MeshCreation; break; default: assert(0); - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } } diff --git a/src/meshlabplugins/filter_create/filter_create.h b/src/meshlabplugins/filter_create/filter_create.h index f120351b9..fc643a7c7 100644 --- a/src/meshlabplugins/filter_create/filter_create.h +++ b/src/meshlabplugins/filter_create/filter_create.h @@ -23,13 +23,13 @@ #ifndef FILTER_CREATE_H #define FILTER_CREATE_H -#include +#include -class FilterCreate : public QObject, public MeshFilterInterface +class FilterCreate : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { @@ -52,11 +52,11 @@ class FilterCreate : public QObject, public MeshFilterInterface QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - FilterClass getClass(QAction *); - void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterList & /*parent*/); - bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + FilterClass getClass(const QAction*) const; + void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); + bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; QString filterScriptFunctionName(FilterIDType filterID); - FILTER_ARITY filterArity(QAction *) const {return NONE;} + FILTER_ARITY filterArity(const QAction *) const {return NONE;} }; #endif diff --git a/src/meshlabplugins/filter_createiso/filter_createiso.cpp b/src/meshlabplugins/filter_createiso/filter_createiso.cpp index 8367c58f8..0857cd7c9 100644 --- a/src/meshlabplugins/filter_createiso/filter_createiso.cpp +++ b/src/meshlabplugins/filter_createiso/filter_createiso.cpp @@ -79,16 +79,16 @@ QString FilterCreateIso::pluginName() const return QString("error!"); } - FilterCreateIso::FilterClass FilterCreateIso::getClass(QAction *a) + FilterCreateIso::FilterClass FilterCreateIso::getClass(const QAction *a) const { switch(ID(a)) { - case FP_CREATEISO : return MeshFilterInterface::MeshCreation; - default : return MeshFilterInterface::Generic; + case FP_CREATEISO : return FilterPluginInterface::MeshCreation; + default : return FilterPluginInterface::Generic; } } - int FilterCreateIso::getRequirements(QAction *action) + int FilterCreateIso::getRequirements(const QAction *action) { switch(ID(action)) { @@ -98,7 +98,7 @@ QString FilterCreateIso::pluginName() const return 0; } - bool FilterCreateIso::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos * cb) + bool FilterCreateIso::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos * cb) { md.addNewMesh("",this->filterName(ID(filter))); MeshModel &m=*(md.mm()); @@ -126,7 +126,7 @@ QString FilterCreateIso::pluginName() const } return true; } - void FilterCreateIso::initParameterSet(QAction *action,MeshModel & /*m*/, RichParameterList & parlst) + void FilterCreateIso::initParameterList(const QAction *action,MeshModel & /*m*/, RichParameterList & parlst) { pair qualityRange; switch(ID(action)) diff --git a/src/meshlabplugins/filter_createiso/filter_createiso.h b/src/meshlabplugins/filter_createiso/filter_createiso.h index 9aeafe072..efe3f57d4 100644 --- a/src/meshlabplugins/filter_createiso/filter_createiso.h +++ b/src/meshlabplugins/filter_createiso/filter_createiso.h @@ -33,14 +33,14 @@ Added the new sample filter plugin that removes border faces #define FILTERCREATEISO_PLUGIN_H #include -#include +#include -class FilterCreateIso : public QObject, public MeshFilterInterface +class FilterCreateIso : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: /* naming convention : @@ -59,12 +59,12 @@ public: virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual FilterClass getClass(QAction *); - virtual int getRequirements(QAction *); - virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterList & /*parent*/); + virtual FilterClass getClass(const QAction*) const; + virtual int getRequirements(const QAction*); + virtual void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); - virtual bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - FILTER_ARITY filterArity(QAction*) const {return NONE;} + virtual bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + FILTER_ARITY filterArity(const QAction*) const {return NONE;} }; diff --git a/src/meshlabplugins/filter_csg/filter_csg.cpp b/src/meshlabplugins/filter_csg/filter_csg.cpp index 974c676e9..278a20a5e 100644 --- a/src/meshlabplugins/filter_csg/filter_csg.cpp +++ b/src/meshlabplugins/filter_csg/filter_csg.cpp @@ -74,7 +74,7 @@ QString FilterCSG::filterInfo(FilterIDType filterId) const } } -void FilterCSG::initParameterSet(QAction *action, MeshDocument & md, RichParameterList & parlst) +void FilterCSG::initParameterList(const QAction *action, MeshDocument & md, RichParameterList & parlst) { switch (ID(action)) { case FP_CSG: @@ -116,7 +116,7 @@ void FilterCSG::initParameterSet(QAction *action, MeshDocument & md, RichParamet } } -bool FilterCSG::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) +bool FilterCSG::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { switch(ID(filter)) { case FP_CSG: @@ -125,20 +125,20 @@ bool FilterCSG::applyFilter(QAction *filter, MeshDocument &md, const RichParamet MeshModel *secondMesh = par.getMesh("SecondMesh"); if ((firstMesh == NULL) || (secondMesh == NULL)) { - Log("CSG filter: cannot compute, mesh does not exist"); + log("CSG filter: cannot compute, mesh does not exist"); errorMessage = "cannot compute, mesh does not exist"; return false; } if ((firstMesh->cm.fn == 0) || (secondMesh->cm.fn == 0)) { - Log("CSG filter: cannot compute, mesh has no faces"); + log("CSG filter: cannot compute, mesh has no faces"); errorMessage = "cannot compute, mesh has no faces"; return false; } if (firstMesh == secondMesh){ - Log("CSG filter: cannot compute, it is the same mesh"); + log("CSG filter: cannot compute, it is the same mesh"); errorMessage = "Cannot compute, it is the same mesh"; return false; // can't continue, mesh can't be processed } @@ -168,27 +168,27 @@ bool FilterCSG::applyFilter(QAction *filter, MeshDocument &md, const RichParamet const Scalarm d = par.getFloat("Delta"); const Point3m delta(d, d, d); const int subFreq = par.getInt("SubDelta"); - Log(GLLogStream::SYSTEM, "Rasterizing first volume..."); + log(GLLogStream::SYSTEM, "Rasterizing first volume..."); InterceptVolume v = InterceptSet3(tmpfirstmesh.cm, delta, subFreq, cb); - Log(GLLogStream::SYSTEM, "Rasterizing second volume..."); + log(GLLogStream::SYSTEM, "Rasterizing second volume..."); InterceptVolume tmp = InterceptSet3(tmpsecondmesh.cm, delta, subFreq, cb); MeshModel *mesh; switch(par.getEnum("Operator")){ case CSG_OPERATION_INTERSECTION: - Log(GLLogStream::SYSTEM, "Intersection..."); + log(GLLogStream::SYSTEM, "Intersection..."); v &= tmp; mesh = md.addNewMesh("","intersection"); break; case CSG_OPERATION_UNION: - Log(GLLogStream::SYSTEM, "Union..."); + log(GLLogStream::SYSTEM, "Union..."); v |= tmp; mesh = md.addNewMesh("","union"); break; case CSG_OPERATION_DIFFERENCE: - Log(GLLogStream::SYSTEM, "Difference..."); + log(GLLogStream::SYSTEM, "Difference..."); v -= tmp; mesh = md.addNewMesh("","difference"); break; @@ -198,13 +198,13 @@ bool FilterCSG::applyFilter(QAction *filter, MeshDocument &md, const RichParamet return true; } - Log(GLLogStream::SYSTEM, "Building mesh..."); + log(GLLogStream::SYSTEM, "Building mesh..."); typedef vcg::intercept::Walker MyWalker; typedef vcg::tri::MarchingCubes MyMarchingCubes; MyWalker walker; MyMarchingCubes mc(mesh->cm, walker); walker.BuildMesh(mesh->cm, v, mc, cb); - Log(GLLogStream::SYSTEM, "Done"); + log(GLLogStream::SYSTEM, "Done"); vcg::tri::UpdateBounding::Box(mesh->cm); vcg::tri::UpdateNormal::PerFaceFromCurrentVertexNormal(mesh->cm); diff --git a/src/meshlabplugins/filter_csg/filter_csg.h b/src/meshlabplugins/filter_csg/filter_csg.h index 403d63d53..9a74e20e4 100644 --- a/src/meshlabplugins/filter_csg/filter_csg.h +++ b/src/meshlabplugins/filter_csg/filter_csg.h @@ -28,18 +28,17 @@ #include #include -#include -#include +#include //FILE _iob[] = { *stdin, *stdout, *stderr }; //extern "C" FILE * __cdecl __iob_func(void) { return _iob; } -class FilterCSG : public QObject, public MeshFilterInterface +class FilterCSG : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) enum { CSG_OPERATION_INTERSECTION = 0, @@ -59,14 +58,12 @@ public: virtual bool autoDialog(QAction *) { return true; } - virtual void initParameterSet(QAction *, MeshDocument &, RichParameterList &); - virtual void initParameterSet(QAction *, MeshModel &, RichParameterList &) { assert(0); } + virtual void initParameterList(const QAction*, MeshDocument &, RichParameterList &); - virtual bool applyFilter(QAction *, MeshDocument &, const RichParameterList &, vcg::CallBackPos *); - virtual bool applyFilter(QAction *, MeshModel &, const RichParameterList &, vcg::CallBackPos *) { assert(0); return false; } + virtual bool applyFilter(const QAction*, MeshDocument &, unsigned int& postConditionMask, const RichParameterList &, vcg::CallBackPos *); - virtual FilterClass getClass(QAction *) { return MeshFilterInterface::FilterClass( MeshFilterInterface::Layer + MeshFilterInterface::Remeshing ); } - FILTER_ARITY filterArity(QAction*) const {return FIXED;} + virtual FilterClass getClass(const QAction *) const { return FilterPluginInterface::FilterClass( FilterPluginInterface::Layer + FilterPluginInterface::Remeshing ); } + FILTER_ARITY filterArity(const QAction*) const {return FIXED;} }; diff --git a/src/meshlabplugins/filter_dirt/dirt_utils.h b/src/meshlabplugins/filter_dirt/dirt_utils.h index d6308b580..b0860697f 100644 --- a/src/meshlabplugins/filter_dirt/dirt_utils.h +++ b/src/meshlabplugins/filter_dirt/dirt_utils.h @@ -32,7 +32,6 @@ #include #include #include -#include #include "particle.h" using namespace vcg; diff --git a/src/meshlabplugins/filter_dirt/dustparticle.h b/src/meshlabplugins/filter_dirt/dustparticle.h index c69abecb7..16321f176 100644 --- a/src/meshlabplugins/filter_dirt/dustparticle.h +++ b/src/meshlabplugins/filter_dirt/dustparticle.h @@ -24,7 +24,6 @@ #define DUSTPARTICLE_H #include #include -#include #include #include #include diff --git a/src/meshlabplugins/filter_dirt/filter_dirt.cpp b/src/meshlabplugins/filter_dirt/filter_dirt.cpp index 83d2fcef3..61cef6020 100644 --- a/src/meshlabplugins/filter_dirt/filter_dirt.cpp +++ b/src/meshlabplugins/filter_dirt/filter_dirt.cpp @@ -99,7 +99,7 @@ QString FilterDirt::filterInfo(FilterIDType filterId) const } } -void FilterDirt::initParameterSet(QAction* filter,MeshDocument & /*md*/, RichParameterList &par){ +void FilterDirt::initParameterList(const QAction* filter,MeshDocument & /*md*/, RichParameterList &par){ switch(ID(filter)){ @@ -128,12 +128,12 @@ void FilterDirt::initParameterSet(QAction* filter,MeshDocument & /*md*/, RichPar } } -int FilterDirt::getRequirements(QAction * /*action*/) +int FilterDirt::getRequirements(const QAction * /*action*/) { return MeshModel::MM_FACEFACETOPO | MeshModel::MM_VERTCOLOR |MeshModel::MM_FACECOLOR; } -bool FilterDirt::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList &par, vcg::CallBackPos *cb){ +bool FilterDirt::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList &par, vcg::CallBackPos *cb){ switch(ID(filter)){ @@ -243,7 +243,7 @@ bool FilterDirt::applyFilter(QAction *filter, MeshDocument &md, const RichParame return true; }//End applyFilter -int FilterDirt::postCondition( QAction *a) const +int FilterDirt::postCondition(const QAction *a) const { switch (ID(a)){ case FP_DIRT: return MeshModel::MM_ALL; @@ -253,14 +253,14 @@ int FilterDirt::postCondition( QAction *a) const return MeshModel::MM_ALL; } -MeshFilterInterface::FilterClass FilterDirt::getClass(QAction *filter) +FilterPluginInterface::FilterClass FilterDirt::getClass(const QAction *filter) const { switch (ID(filter)) { - case FP_DIRT:return MeshFilterInterface::Sampling; - case FP_CLOUD_MOVEMENT:return MeshFilterInterface::Remeshing; + case FP_DIRT:return FilterPluginInterface::Sampling; + case FP_CLOUD_MOVEMENT:return FilterPluginInterface::Remeshing; default:assert(0); } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } MESHLAB_PLUGIN_NAME_EXPORTER(FilterDirt) diff --git a/src/meshlabplugins/filter_dirt/filter_dirt.h b/src/meshlabplugins/filter_dirt/filter_dirt.h index 4b5093b40..0da1b087a 100644 --- a/src/meshlabplugins/filter_dirt/filter_dirt.h +++ b/src/meshlabplugins/filter_dirt/filter_dirt.h @@ -27,8 +27,7 @@ #include #include #include -#include -#include +#include #include #include //#include "muParser.h" @@ -37,11 +36,11 @@ using namespace vcg; //using namespace mu; -class FilterDirt : public QObject, public MeshFilterInterface +class FilterDirt : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) protected: double x,y,z,nx,ny,nz,r,g,b,q,rad; //double x0,y0,z0,x1,y1,z1,x2,y2,z2,nx0,ny0,nz0,nx1,ny1,nz1,nx2,ny2,nz2,r0,g0,b0,r1,g1,b1,r2,g2,b2,q0,q1,q2; @@ -62,15 +61,14 @@ public: QString pluginName() const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual int getRequirements(QAction *); + virtual int getRequirements(const QAction*); virtual bool autoDialog(QAction *) {return true;} // virtual void initParameterSet(QAction* filter,MeshModel &,RichParameterSet &){}; - virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterList & /*parent*/); - virtual bool applyFilter(QAction* filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb); - virtual bool applyFilter(QAction * /*filter */, MeshModel &, const RichParameterList & /*parent*/, vcg::CallBackPos *) { assert(0); return false;} ; - virtual int postCondition(QAction*) const; - virtual FilterClass getClass(QAction *); - FILTER_ARITY filterArity(QAction*) const {return SINGLE_MESH;} + virtual void initParameterList(const QAction*, MeshDocument &/*m*/, RichParameterList & /*parent*/); + virtual bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & par, vcg::CallBackPos *cb); + virtual int postCondition(const QAction*) const; + virtual FilterClass getClass (const QAction *) const; + FILTER_ARITY filterArity(const QAction*) const {return SINGLE_MESH;} }; diff --git a/src/meshlabplugins/filter_dirt/particle.h b/src/meshlabplugins/filter_dirt/particle.h index 21445155d..2822ceb31 100644 --- a/src/meshlabplugins/filter_dirt/particle.h +++ b/src/meshlabplugins/filter_dirt/particle.h @@ -25,7 +25,6 @@ #include #include -#include #include template diff --git a/src/meshlabplugins/filter_fractal/filter_fractal.cpp b/src/meshlabplugins/filter_fractal/filter_fractal.cpp index d7c6d8c58..c0031a810 100644 --- a/src/meshlabplugins/filter_fractal/filter_fractal.cpp +++ b/src/meshlabplugins/filter_fractal/filter_fractal.cpp @@ -165,7 +165,7 @@ QString FilterFractal::filterInfo(FilterIDType filterId) const return description; } -void FilterFractal::initParameterSet(QAction* filter,MeshDocument &md, RichParameterList &par) +void FilterFractal::initParameterList(const QAction* filter,MeshDocument &md, RichParameterList &par) { switch(ID(filter)) { @@ -179,7 +179,7 @@ void FilterFractal::initParameterSet(QAction* filter,MeshDocument &md, RichParam } } -void FilterFractal::initParameterSetForFractalDisplacement(QAction *filter, MeshDocument &md, RichParameterList &par) +void FilterFractal::initParameterSetForFractalDisplacement(const QAction *filter, MeshDocument &md, RichParameterList &par) { bool terrain_filter = (ID(filter) == CR_FRACTAL_TERRAIN); @@ -255,9 +255,9 @@ void FilterFractal::initParameterSetForCratersGeneration(MeshDocument &md, RichP return; } -bool FilterFractal::applyFilter(QAction* filter, MeshDocument &md, const RichParameterList &par, vcg::CallBackPos* cb) +bool FilterFractal::applyFilter(const QAction* filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList &par, vcg::CallBackPos* cb) { - if(this->getClass(filter) == MeshFilterInterface::MeshCreation) + if(this->getClass(filter) == FilterPluginInterface::MeshCreation) md.addNewMesh("",this->filterName(ID(filter))); switch(ID(filter)) { @@ -338,22 +338,22 @@ bool FilterFractal::applyFilter(QAction* filter, MeshDocument &md, const RichPar return false; } -MeshFilterInterface::FilterClass FilterFractal::getClass(QAction* filter) +FilterPluginInterface::FilterClass FilterFractal::getClass(const QAction* filter) const { switch(ID(filter)) { case CR_FRACTAL_TERRAIN: - return MeshFilterInterface::MeshCreation; + return FilterPluginInterface::MeshCreation; break; case FP_FRACTAL_MESH: case FP_CRATERS: - return MeshFilterInterface::Smoothing; + return FilterPluginInterface::Smoothing; break; default: assert(0); - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } } -int FilterFractal::getRequirements(QAction *filter) +int FilterFractal::getRequirements(const QAction *filter) { switch(ID(filter)) { case CR_FRACTAL_TERRAIN: @@ -368,7 +368,7 @@ int FilterFractal::getRequirements(QAction *filter) return MeshModel::MM_NONE; } -int FilterFractal::postCondition(QAction *filter) const +int FilterFractal::postCondition(const QAction *filter) const { switch(ID(filter)) { @@ -382,18 +382,18 @@ int FilterFractal::postCondition(QAction *filter) const return MeshModel::MM_ALL; } -MeshFilterInterface::FILTER_ARITY FilterFractal::filterArity( QAction* act ) const +FilterPluginInterface::FILTER_ARITY FilterFractal::filterArity(const QAction* act ) const { switch(ID(act)) { case FP_FRACTAL_MESH: - return MeshFilterInterface::SINGLE_MESH; + return FilterPluginInterface::SINGLE_MESH; case CR_FRACTAL_TERRAIN: - return MeshFilterInterface::NONE; + return FilterPluginInterface::NONE; case FP_CRATERS: - return MeshFilterInterface::VARIABLE; + return FilterPluginInterface::VARIABLE; } - return MeshFilterInterface::NONE; + return FilterPluginInterface::NONE; } // ---------------------------------------------------------------------- diff --git a/src/meshlabplugins/filter_fractal/filter_fractal.h b/src/meshlabplugins/filter_fractal/filter_fractal.h index ea082a418..1362d4499 100644 --- a/src/meshlabplugins/filter_fractal/filter_fractal.h +++ b/src/meshlabplugins/filter_fractal/filter_fractal.h @@ -28,14 +28,14 @@ #include #include -#include +#include #include "craters_utils.h" -class FilterFractal : public QObject, public MeshFilterInterface +class FilterFractal : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: FilterFractal(); @@ -45,17 +45,16 @@ public: QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - int getRequirements(QAction *); - void initParameterSet(QAction*, MeshModel&, RichParameterList &){assert(0);} - void initParameterSet(QAction *, MeshDocument &, RichParameterList &); + int getRequirements(const QAction*); + void initParameterList(const QAction*, MeshDocument &, RichParameterList &); - bool applyFilter (QAction* filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb); + bool applyFilter (const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & par, vcg::CallBackPos *cb); - int postCondition(QAction *action) const; - FilterClass getClass(QAction *); - FILTER_ARITY filterArity(QAction* act) const; + int postCondition(const QAction *action) const; + FilterClass getClass(const QAction*) const; + FILTER_ARITY filterArity(const QAction* act) const; private: - void initParameterSetForFractalDisplacement (QAction *, MeshDocument &, RichParameterList &); + void initParameterSetForFractalDisplacement (const QAction*, MeshDocument &, RichParameterList &); void initParameterSetForCratersGeneration (MeshDocument &md, RichParameterList &par); enum {CR_FRACTAL_TERRAIN, FP_FRACTAL_MESH, FP_CRATERS}; diff --git a/src/meshlabplugins/filter_func/filter_func.cpp b/src/meshlabplugins/filter_func/filter_func.cpp index 31e2c39be..187743ce9 100644 --- a/src/meshlabplugins/filter_func/filter_func.cpp +++ b/src/meshlabplugins/filter_func/filter_func.cpp @@ -161,31 +161,31 @@ QString FilterFunctionPlugin::filterInfo(FilterIDType filterId) const return QString("filter not found!"); } -FilterFunctionPlugin::FilterClass FilterFunctionPlugin::getClass(QAction *a) +FilterFunctionPlugin::FilterClass FilterFunctionPlugin::getClass(const QAction *a) const { switch(ID(a)) { case FF_FACE_SELECTION: - case FF_VERT_SELECTION: return MeshFilterInterface::Selection; + case FF_VERT_SELECTION: return FilterPluginInterface::Selection; case FF_FACE_QUALITY: return FilterClass(Quality + FaceColoring); case FF_VERT_QUALITY: return FilterClass(Quality + VertexColoring); - case FF_VERT_TEXTURE_FUNC: return MeshFilterInterface::Texture; - case FF_VERT_COLOR: return MeshFilterInterface::VertexColoring; - case FF_VERT_NORMAL: return MeshFilterInterface::Normal; - case FF_FACE_COLOR: return MeshFilterInterface::FaceColoring; - case FF_WEDGE_TEXTURE_FUNC: return MeshFilterInterface::Texture; - case FF_ISOSURFACE: return MeshFilterInterface::MeshCreation; - case FF_GRID: return MeshFilterInterface::MeshCreation; - case FF_REFINE: return MeshFilterInterface::Remeshing; - case FF_GEOM_FUNC: return MeshFilterInterface::Smoothing; - case FF_DEF_VERT_ATTRIB: return MeshFilterInterface::Layer; - case FF_DEF_FACE_ATTRIB: return MeshFilterInterface::Layer; + case FF_VERT_TEXTURE_FUNC: return FilterPluginInterface::Texture; + case FF_VERT_COLOR: return FilterPluginInterface::VertexColoring; + case FF_VERT_NORMAL: return FilterPluginInterface::Normal; + case FF_FACE_COLOR: return FilterPluginInterface::FaceColoring; + case FF_WEDGE_TEXTURE_FUNC: return FilterPluginInterface::Texture; + case FF_ISOSURFACE: return FilterPluginInterface::MeshCreation; + case FF_GRID: return FilterPluginInterface::MeshCreation; + case FF_REFINE: return FilterPluginInterface::Remeshing; + case FF_GEOM_FUNC: return FilterPluginInterface::Smoothing; + case FF_DEF_VERT_ATTRIB: return FilterPluginInterface::Layer; + case FF_DEF_FACE_ATTRIB: return FilterPluginInterface::Layer; - default: return MeshFilterInterface::Generic; + default: return FilterPluginInterface::Generic; } } -int FilterFunctionPlugin::postCondition(QAction *action) const +int FilterFunctionPlugin::postCondition(const QAction *action) const { switch(ID(action)) { @@ -224,7 +224,7 @@ int FilterFunctionPlugin::postCondition(QAction *action) const return MeshModel::MM_NONE; } -int FilterFunctionPlugin::getRequirements(QAction *action) +int FilterFunctionPlugin::getRequirements(const QAction *action) { switch(ID(action)) { @@ -255,7 +255,7 @@ int FilterFunctionPlugin::getRequirements(QAction *action) // - the string shown in the dialog // - the default value // - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog) -void FilterFunctionPlugin::initParameterSet(QAction *action,MeshModel &m, RichParameterList & parlst) +void FilterFunctionPlugin::initParameterList(const QAction *action,MeshModel &m, RichParameterList & parlst) { Q_UNUSED(m); switch(ID(action)) { @@ -373,9 +373,9 @@ void FilterFunctionPlugin::initParameterSet(QAction *action,MeshModel &m, RichPa } // The Real Core Function doing the actual mesh processing. -bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) +bool FilterFunctionPlugin::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { - if(this->getClass(filter) == MeshFilterInterface::MeshCreation) + if(this->getClass(filter) == FilterPluginInterface::MeshCreation) md.addNewMesh("",this->filterName(ID(filter))); MeshModel &m=*(md.mm()); Q_UNUSED(cb); @@ -420,7 +420,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const } // if succeeded log stream contains number of vertices and time elapsed - Log( "selected %d vertices in %.2f sec.", numvert, (clock() - start) / (float) CLOCKS_PER_SEC); + log( "selected %d vertices in %.2f sec.", numvert, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -465,7 +465,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const } // if succeeded log stream contains number of vertices and time elapsed - Log( "selected %d faces in %.2f sec.", numface, (clock() - start) / (float) CLOCKS_PER_SEC); + log( "selected %d faces in %.2f sec.", numface, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -487,7 +487,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const if (onSelected && m.cm.svn == 0 && m.cm.sfn == 0) // if no selection at all, fail { - Log("Cannot apply only on selection: there is no selection"); + log("Cannot apply only on selection: there is no selection"); errorMessage = "Cannot apply only on selection: there is no selection"; return false; } @@ -555,7 +555,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const } // if succeeded log stream contains number of vertices processed and time elapsed - Log( "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); + log( "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -568,7 +568,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const if (onSelected && m.cm.svn == 0 && m.cm.sfn == 0) // if no selection at all, fail { - Log("Cannot apply only on selection: there is no selection"); + log("Cannot apply only on selection: there is no selection"); errorMessage = "Cannot apply only on selection: there is no selection"; return false; } @@ -616,7 +616,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const m.updateDataMask(MeshModel::MM_VERTCOLOR); } // if succeeded log stream contains number of vertices and time elapsed - Log( "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); + log( "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -629,7 +629,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const if (onSelected && m.cm.svn == 0 && m.cm.sfn == 0) // if no selection at all, fail { - Log("Cannot apply only on selection: there is no selection"); + log("Cannot apply only on selection: there is no selection"); errorMessage = "Cannot apply only on selection: there is no selection"; return false; } @@ -675,7 +675,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const } } - Log( "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); + log( "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } break; @@ -691,7 +691,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const if (onSelected && m.cm.sfn == 0) // if no selection, fail { - Log("Cannot apply only on selection: there is no selection"); + log("Cannot apply only on selection: there is no selection"); errorMessage = "Cannot apply only on selection: there is no selection"; return false; } @@ -730,7 +730,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const } } - Log( "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); + log( "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } break; @@ -744,7 +744,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const if (onSelected && m.cm.sfn == 0) // if no selection, fail { - Log("Cannot apply only on selection: there is no selection"); + log("Cannot apply only on selection: there is no selection"); errorMessage = "Cannot apply only on selection: there is no selection"; return false; } @@ -793,7 +793,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const } // if succeeded log stream contains number of vertices processed and time elapsed - Log( "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); + log( "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; @@ -807,7 +807,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const if (onSelected && m.cm.sfn == 0) // if no selection, fail { - Log("Cannot apply only on selection: there is no selection"); + log("Cannot apply only on selection: there is no selection"); errorMessage = "Cannot apply only on selection: there is no selection"; return false; } @@ -852,7 +852,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const } // if succeeded log stream contains number of faces processed and time elapsed - Log( "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); + log( "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -909,7 +909,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const v_handlers.push_back(h); // if succeeded log stream contains number of vertices processed and time elapsed - Log( "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); + log( "%d vertices processed in %.2f sec.", m.cm.vn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -963,7 +963,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const // fhandlers.push_back(h); // if succeeded log stream contains number of vertices processed and time elapsed - Log( "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); + log( "%d faces processed in %.2f sec.", m.cm.fn, (clock() - start) / (float) CLOCKS_PER_SEC); return true; } @@ -1033,7 +1033,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, const p.DefineVar(conversion::fromStringToWString("z"), &z); std::string expr = par.getString("expr").toStdString(); p.SetExpr(conversion::fromStringToWString(expr)); - Log("Filling a Volume of %i %i %i",siz[0],siz[1],siz[2]); + log("Filling a Volume of %i %i %i",siz[0],siz[1],siz[2]); volume.Init(siz,RangeBBox); for(double i=0;i(m.cm, volume, mc, 0); // Matrix44m tr; tr.SetIdentity(); tr.SetTranslate(rbb.min[0],rbb.min[1],rbb.min[2]); @@ -1433,7 +1433,7 @@ void FilterFunctionPlugin::setPerFaceVariables(Parser &p, CMeshO &m) } -MeshFilterInterface::FILTER_ARITY FilterFunctionPlugin::filterArity( QAction* filter ) const +FilterPluginInterface::FILTER_ARITY FilterFunctionPlugin::filterArity(const QAction* filter ) const { switch(ID(filter)) { @@ -1450,12 +1450,12 @@ MeshFilterInterface::FILTER_ARITY FilterFunctionPlugin::filterArity( QAction* fi case FF_DEF_VERT_ATTRIB: case FF_DEF_FACE_ATTRIB: case FF_REFINE: - return MeshFilterInterface::SINGLE_MESH; + return FilterPluginInterface::SINGLE_MESH; case FF_GRID: case FF_ISOSURFACE: - return MeshFilterInterface::NONE; + return FilterPluginInterface::NONE; } - return MeshFilterInterface::NONE; + return FilterPluginInterface::NONE; } diff --git a/src/meshlabplugins/filter_func/filter_func.h b/src/meshlabplugins/filter_func/filter_func.h index cf84dd702..ef8f372de 100644 --- a/src/meshlabplugins/filter_func/filter_func.h +++ b/src/meshlabplugins/filter_func/filter_func.h @@ -26,16 +26,16 @@ #include -#include +#include #include "muParser.h" #include "filter_refine.h" -class FilterFunctionPlugin : public QObject, public MeshFilterInterface +class FilterFunctionPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) protected: double x,y,z,nx,ny,nz,r,g,b,a,q,rad,vtu,vtv,vsel; @@ -77,12 +77,12 @@ public: QString pluginName() const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual FilterClass getClass(QAction *); - virtual int postCondition(QAction *action) const; - virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterList & /*parent*/); - virtual int getRequirements(QAction *); - virtual bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - FILTER_ARITY filterArity(QAction* filter) const; + virtual FilterClass getClass(const QAction*) const; + virtual int postCondition(const QAction *action) const; + virtual void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); + virtual int getRequirements(const QAction*); + virtual bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + FILTER_ARITY filterArity(const QAction* filter) const; void showParserError(const QString &s, mu::Parser::exception_type &e); diff --git a/src/meshlabplugins/filter_geodesic/filter_geodesic.cpp b/src/meshlabplugins/filter_geodesic/filter_geodesic.cpp index 82a6cae34..1c56b28fa 100644 --- a/src/meshlabplugins/filter_geodesic/filter_geodesic.cpp +++ b/src/meshlabplugins/filter_geodesic/filter_geodesic.cpp @@ -84,19 +84,19 @@ QString FilterGeodesic::filterInfo(FilterIDType filterId) const return QString("error!"); } -FilterGeodesic::FilterClass FilterGeodesic::getClass(QAction *a) +FilterGeodesic::FilterClass FilterGeodesic::getClass(const QAction *a) const { switch(ID(a)) { case FP_QUALITY_BORDER_GEODESIC : case FP_QUALITY_SELECTED_GEODESIC : - case FP_QUALITY_POINT_GEODESIC : return FilterGeodesic::FilterClass(MeshFilterInterface::VertexColoring + MeshFilterInterface::Quality); + case FP_QUALITY_POINT_GEODESIC : return FilterGeodesic::FilterClass(FilterPluginInterface::VertexColoring + FilterPluginInterface::Quality); default : assert(0); } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } -int FilterGeodesic::getRequirements(QAction *action) +int FilterGeodesic::getRequirements(const QAction *action) { switch(ID(action)) { @@ -108,7 +108,7 @@ int FilterGeodesic::getRequirements(QAction *action) return 0; } -bool FilterGeodesic::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos * /*cb*/) +bool FilterGeodesic::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos * /*cb*/) { MeshModel &m=*(md.mm()); CMeshO::FaceIterator fi; @@ -134,7 +134,7 @@ bool FilterGeodesic::applyFilter(QAction *filter, MeshDocument &md, const RichPa } - Log("Input point is %f %f %f Closest on surf is %f %f %f",startPoint[0],startPoint[1],startPoint[2],startVertex->P()[0],startVertex->P()[1],startVertex->P()[2]); + log("Input point is %f %f %f Closest on surf is %f %f %f",startPoint[0],startPoint[1],startPoint[2],startVertex->P()[0],startVertex->P()[1],startVertex->P()[2]); // Now actually compute the geodesic distance from the closest point float dist_thr = par.getAbsPerc("maxDistance"); @@ -151,7 +151,7 @@ bool FilterGeodesic::applyFilter(QAction *filter, MeshDocument &md, const RichPa (*vi).Q()=0; } if(unreachedCnt >0 ) - Log("Warning: %i vertices were unreachable from the borders, probably your mesh has unreferenced vertices",unreachedCnt); + log("Warning: %i vertices were unreachable from the borders, probably your mesh has unreferenced vertices",unreachedCnt); tri::UpdateColor::PerVertexQualityRamp(m.cm); @@ -178,9 +178,9 @@ bool FilterGeodesic::applyFilter(QAction *filter, MeshDocument &md, const RichPa (*vi).Q()=0; } if(unreachedCnt >0 ) - Log("Warning: %i vertices were unreachable from the borders, probably your mesh has unreferenced vertices",unreachedCnt); + log("Warning: %i vertices were unreachable from the borders, probably your mesh has unreferenced vertices",unreachedCnt); - if(!ret) Log("Mesh Has no borders. No geodesic distance computed"); + if(!ret) log("Mesh Has no borders. No geodesic distance computed"); else tri::UpdateColor::PerVertexQualityRamp(m.cm); } @@ -219,12 +219,12 @@ bool FilterGeodesic::applyFilter(QAction *filter, MeshDocument &md, const RichPa }); if(unreachedCnt >0 ) - Log("Warning: %i vertices were unreachable from the seeds, probably your mesh has unreferenced vertices",unreachedCnt); + log("Warning: %i vertices were unreachable from the seeds, probably your mesh has unreferenced vertices",unreachedCnt); tri::UpdateColor::PerVertexQualityRamp(m.cm); } else - Log("Warning: no vertices are selected! aborting geodesic computation."); + log("Warning: no vertices are selected! aborting geodesic computation."); } break; default: assert(0); @@ -233,7 +233,7 @@ bool FilterGeodesic::applyFilter(QAction *filter, MeshDocument &md, const RichPa return true; } -void FilterGeodesic::initParameterSet(QAction *action,MeshModel &m, RichParameterList & parlst) +void FilterGeodesic::initParameterList(const QAction *action,MeshModel &m, RichParameterList & parlst) { switch(ID(action)) { @@ -249,7 +249,7 @@ void FilterGeodesic::initParameterSet(QAction *action,MeshModel &m, RichParamete return; } -int FilterGeodesic::postCondition(QAction * filter) const +int FilterGeodesic::postCondition(const QAction * filter) const { switch (ID(filter)) { diff --git a/src/meshlabplugins/filter_geodesic/filter_geodesic.h b/src/meshlabplugins/filter_geodesic/filter_geodesic.h index 09e1c720a..99442d5a1 100644 --- a/src/meshlabplugins/filter_geodesic/filter_geodesic.h +++ b/src/meshlabplugins/filter_geodesic/filter_geodesic.h @@ -24,15 +24,15 @@ #define FILTERGEODESIC_PLUGIN_H #include -#include +#include #include -class FilterGeodesic : public QObject, public MeshFilterInterface +class FilterGeodesic : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: /* naming convention : @@ -54,12 +54,12 @@ class FilterGeodesic : public QObject, public MeshFilterInterface QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - FilterClass getClass(QAction *); - int getRequirements(QAction *); - bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterList & /*parent*/); - int postCondition(QAction * filter) const; - FILTER_ARITY filterArity(QAction*) const {return SINGLE_MESH;} + FilterClass getClass(const QAction*) const; + int getRequirements(const QAction*); + bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); + int postCondition(const QAction * filter) const; + FILTER_ARITY filterArity(const QAction*) const {return SINGLE_MESH;} }; diff --git a/src/meshlabplugins/filter_globalregistration/globalregistration.cpp b/src/meshlabplugins/filter_globalregistration/globalregistration.cpp index 9bfec27f2..48e0ebe15 100644 --- a/src/meshlabplugins/filter_globalregistration/globalregistration.cpp +++ b/src/meshlabplugins/filter_globalregistration/globalregistration.cpp @@ -61,17 +61,17 @@ QString GlobalRegistrationPlugin::filterName(FilterIDType filterId) const return QString("Unknown Filter"); } -GlobalRegistrationPlugin::FilterClass GlobalRegistrationPlugin::getClass(QAction *a) +GlobalRegistrationPlugin::FilterClass GlobalRegistrationPlugin::getClass(const QAction *a) const { switch(ID(a)) { - case FP_GLOBAL_REGISTRATION : return MeshFilterInterface::PointSet; + case FP_GLOBAL_REGISTRATION : return FilterPluginInterface::PointSet; default : assert(0); } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } -void GlobalRegistrationPlugin::initParameterSet(QAction *action,MeshDocument &md, RichParameterList & parlst) +void GlobalRegistrationPlugin::initParameterList(const QAction *action,MeshDocument &md, RichParameterList & parlst) { switch(ID(action)) { @@ -166,10 +166,11 @@ float align ( CMeshO* refMesh, CMeshO* trgMesh, // The Real Core Function doing the actual mesh processing. // Move Vertex of a random quantity -bool GlobalRegistrationPlugin::applyFilter(QAction */*filter*/, - MeshDocument &/*md*/, - const RichParameterList & par, - vcg::CallBackPos */*cb*/) +bool GlobalRegistrationPlugin::applyFilter(const QAction* /*filter*/, + MeshDocument& /*md*/, + unsigned int& /*postConditionMask*/, + const RichParameterList& par, + vcg::CallBackPos* /*cb*/) { MeshModel *mmref = par.getMesh("refMesh"); @@ -195,7 +196,7 @@ bool GlobalRegistrationPlugin::applyFilter(QAction */*filter*/, } // run - Log("Final LCP = %f", score); + log("Final LCP = %f", score); v.mesh->Tr.FromEigenMatrix(mat); return true; diff --git a/src/meshlabplugins/filter_globalregistration/globalregistration.h b/src/meshlabplugins/filter_globalregistration/globalregistration.h index eee8ceb16..b0a072d00 100644 --- a/src/meshlabplugins/filter_globalregistration/globalregistration.h +++ b/src/meshlabplugins/filter_globalregistration/globalregistration.h @@ -24,13 +24,13 @@ #ifndef SAMPLEFILTERSPLUGIN_H #define SAMPLEFILTERSPLUGIN_H -#include +#include -class GlobalRegistrationPlugin : public QObject, public MeshFilterInterface +class GlobalRegistrationPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { FP_GLOBAL_REGISTRATION } ; @@ -41,11 +41,11 @@ public: QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - void initParameterSet(QAction *, MeshDocument &/*m*/, RichParameterList & /*parent*/); - bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - int postCondition( QAction* ) const {return MeshModel::MM_VERTCOORD; } - FilterClass getClass(QAction *a); - FILTER_ARITY filterArity(QAction *) const {return SINGLE_MESH;} + void initParameterList(const QAction*, MeshDocument &/*m*/, RichParameterList & /*parent*/); + bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + int postCondition(const QAction* ) const {return MeshModel::MM_VERTCOORD; } + FilterClass getClass(const QAction* a) const; + FILTER_ARITY filterArity(const QAction *) const {return SINGLE_MESH;} }; diff --git a/src/meshlabplugins/filter_img_patch_param/filter_img_patch_param.cpp b/src/meshlabplugins/filter_img_patch_param/filter_img_patch_param.cpp index bf74be607..ae2809f54 100644 --- a/src/meshlabplugins/filter_img_patch_param/filter_img_patch_param.cpp +++ b/src/meshlabplugins/filter_img_patch_param/filter_img_patch_param.cpp @@ -84,7 +84,7 @@ QString FilterImgPatchParamPlugin::filterInfo( FilterIDType id ) const } -int FilterImgPatchParamPlugin::getRequirements( QAction *act ) +int FilterImgPatchParamPlugin::getRequirements(const QAction *act ) { switch( ID(act) ) { @@ -97,7 +97,7 @@ int FilterImgPatchParamPlugin::getRequirements( QAction *act ) } -MeshFilterInterface::FilterClass FilterImgPatchParamPlugin::getClass( QAction *act ) +FilterPluginInterface::FilterClass FilterImgPatchParamPlugin::getClass(const QAction *act ) const { switch( ID(act) ) { @@ -105,7 +105,7 @@ MeshFilterInterface::FilterClass FilterImgPatchParamPlugin::getClass( QAction *a case FP_PATCH_PARAM_AND_TEXTURING: return Texture; case FP_RASTER_VERT_COVERAGE: case FP_RASTER_FACE_COVERAGE: return FilterClass(Quality + Camera + Texture); - default: assert(0); return MeshFilterInterface::Generic; + default: assert(0); return FilterPluginInterface::Generic; } } @@ -125,7 +125,7 @@ MeshFilterInterface::FilterClass FilterImgPatchParamPlugin::getClass( QAction *a //} -void FilterImgPatchParamPlugin::initParameterSet( QAction *act, +void FilterImgPatchParamPlugin::initParameterList(const QAction *act, MeshDocument &/*md*/, RichParameterList &par ) { @@ -191,10 +191,12 @@ void FilterImgPatchParamPlugin::initParameterSet( QAction *act, } -bool FilterImgPatchParamPlugin::applyFilter( QAction *act, - MeshDocument &md, - const RichParameterList &par, - vcg::CallBackPos * /*cb*/ ) +bool FilterImgPatchParamPlugin::applyFilter( + const QAction *act, + MeshDocument &md, + unsigned int& /*postConditionMask*/, + const RichParameterList &par, + vcg::CallBackPos * /*cb*/ ) { @@ -303,7 +305,7 @@ bool FilterImgPatchParamPlugin::applyFilter( QAction *act, painter.paint( patches ); if( par.getBool("colorCorrection") ) painter.rectifyColor( patches, par.getInt("colorCorrectionFilterSize") ); - Log( "TEXTURE PAINTING: %.3f sec.", 0.001f*t.elapsed() ); + log( "TEXTURE PAINTING: %.3f sec.", 0.001f*t.elapsed() ); QImage tex = painter.getTexture(); if( tex.save(texName) ) @@ -916,14 +918,14 @@ void FilterImgPatchParamPlugin::patchBasedTextureParameterization( RasterPatchMa if( par.getBool("useAlphaWeight") ) weightMask |= VisibleSet::W_IMG_ALPHA; VisibleSet faceVis( *m_Context,glContext,meshid, mesh, rasterList, weightMask ); - Log( "VISIBILITY CHECK: %.3f sec.", 0.001f*t.elapsed() ); + log( "VISIBILITY CHECK: %.3f sec.", 0.001f*t.elapsed() ); // Boundary optimization: the goal is to produce more regular boundaries between surface regions // associated to different reference images. t.start(); boundaryOptimization( mesh, faceVis, true ); - Log( "BOUNDARY OPTIMIZATION: %.3f sec.", 0.001f*t.elapsed() ); + log( "BOUNDARY OPTIMIZATION: %.3f sec.", 0.001f*t.elapsed() ); // Incorporates patches compounds of only one triangles to one of their neighbours. @@ -931,8 +933,8 @@ void FilterImgPatchParamPlugin::patchBasedTextureParameterization( RasterPatchMa { t.start(); int triCleaned = cleanIsolatedTriangles( mesh, faceVis ); - Log( "CLEANING ISOLATED TRIANGLES: %.3f sec.", 0.001f*t.elapsed() ); - Log( " * %i triangles cleaned.", triCleaned ); + log( "CLEANING ISOLATED TRIANGLES: %.3f sec.", 0.001f*t.elapsed() ); + log( " * %i triangles cleaned.", triCleaned ); } @@ -940,8 +942,8 @@ void FilterImgPatchParamPlugin::patchBasedTextureParameterization( RasterPatchMa t.start(); float oldArea = computeTotalPatchArea( patches ); int nbPatches = extractPatches( patches, nullPatches, mesh, faceVis, rasterList ); - Log( "PATCH EXTRACTION: %.3f sec.", 0.001f*t.elapsed() ); - Log( " * %i patches extracted, %i null patches.", nbPatches, nullPatches.size() ); + log( "PATCH EXTRACTION: %.3f sec.", 0.001f*t.elapsed() ); + log( " * %i patches extracted, %i null patches.", nbPatches, nullPatches.size() ); // Extends each patch so as to include faces that belong to the other side of its boundary. @@ -950,7 +952,7 @@ void FilterImgPatchParamPlugin::patchBasedTextureParameterization( RasterPatchMa for( RasterPatchMap::iterator rp=patches.begin(); rp!=patches.end(); ++rp ) for( PatchVec::iterator p=rp->begin(); p!=rp->end(); ++p ) constructPatchBoundary( *p, faceVis ); - Log( "PATCH EXTENSION: %.3f sec.", 0.001f*t.elapsed() ); + log( "PATCH EXTENSION: %.3f sec.", 0.001f*t.elapsed() ); // Compute the UV coordinates of all patches by projecting them onto their reference images. @@ -959,7 +961,7 @@ void FilterImgPatchParamPlugin::patchBasedTextureParameterization( RasterPatchMa oldArea = computeTotalPatchArea( patches ); for( RasterPatchMap::iterator rp=patches.begin(); rp!=patches.end(); ++rp ) computePatchUV( mesh, rp.key(), rp.value() ); - Log( "PATCHES UV COMPUTATION: %.3f sec.", 0.001f*t.elapsed() ); + log( "PATCHES UV COMPUTATION: %.3f sec.", 0.001f*t.elapsed() ); // Merge patches so as to reduce the occupied texture area when their bounding boxes overlap. @@ -967,9 +969,9 @@ void FilterImgPatchParamPlugin::patchBasedTextureParameterization( RasterPatchMa oldArea = computeTotalPatchArea( patches ); for( RasterPatchMap::iterator rp=patches.begin(); rp!=patches.end(); ++rp ) mergeOverlappingPatches( *rp ); - Log( "PATCH MERGING: %.3f sec.", 0.001f*t.elapsed() ); - Log( " * Area reduction: %.1f%%.", 100.0f*computeTotalPatchArea(patches)/oldArea ); - Log( " * Patches number reduced from %i to %i.", nbPatches, computePatchCount(patches) ); + log( "PATCH MERGING: %.3f sec.", 0.001f*t.elapsed() ); + log( " * Area reduction: %.1f%%.", 100.0f*computeTotalPatchArea(patches)/oldArea ); + log( " * Patches number reduced from %i to %i.", nbPatches, computePatchCount(patches) ); // Patches' bounding boxes are packed in texture space. After this operation, boxes are still defined @@ -977,7 +979,7 @@ void FilterImgPatchParamPlugin::patchBasedTextureParameterization( RasterPatchMa // space, ranging from [0,0] to [1,1]. t.start(); patchPacking( patches, par.getInt("textureGutter"), par.getBool("stretchingAllowed") ); - Log( "PATCH TEXTURE PACKING: %.3f sec.", 0.001f*t.elapsed() ); + log( "PATCH TEXTURE PACKING: %.3f sec.", 0.001f*t.elapsed() ); // Clear the UV coordinates for patches that are not visible in any image. diff --git a/src/meshlabplugins/filter_img_patch_param/filter_img_patch_param.h b/src/meshlabplugins/filter_img_patch_param/filter_img_patch_param.h index 3042dce75..f9675fce0 100644 --- a/src/meshlabplugins/filter_img_patch_param/filter_img_patch_param.h +++ b/src/meshlabplugins/filter_img_patch_param/filter_img_patch_param.h @@ -28,18 +28,18 @@ #include -#include +#include #include #include "Patch.h" #include class VisibleSet; -class FilterImgPatchParamPlugin : public QObject, public MeshFilterInterface +class FilterImgPatchParamPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES( MeshFilterInterface ) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES( FilterPluginInterface ) enum { @@ -103,21 +103,22 @@ public: virtual QString filterName( FilterIDType id ) const; virtual QString filterInfo( FilterIDType id ) const; - virtual FilterClass getClass( QAction *act ); + virtual FilterClass getClass(const QAction* act ) const; - virtual void initParameterSet( QAction *act, + virtual void initParameterList(const QAction* act, MeshDocument &md, RichParameterList &par ); - virtual int getRequirements( QAction *act ); + virtual int getRequirements(const QAction* act ); //virtual int postCondition( QAction *act ) const; - virtual bool applyFilter( QAction *act, + virtual bool applyFilter(const QAction* act, MeshDocument &md, + unsigned int& postConditionMask, const RichParameterList &par, vcg::CallBackPos *cb ); - FILTER_ARITY filterArity(QAction *) const {return SINGLE_MESH;} + FILTER_ARITY filterArity(const QAction *) const {return SINGLE_MESH;} }; diff --git a/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.cpp b/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.cpp index 0084abaf6..b4b2b7bcc 100644 --- a/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.cpp +++ b/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.cpp @@ -95,12 +95,12 @@ QString FilterIsoParametrization::filterInfo(FilterIDType filterId) const return QString("error!"); } -int FilterIsoParametrization::getRequirements(QAction *) +int FilterIsoParametrization::getRequirements(const QAction *) { return MeshModel::MM_NONE; } -void FilterIsoParametrization::initParameterSet(QAction *a, MeshDocument& md, RichParameterList & par) +void FilterIsoParametrization::initParameterList(const QAction *a, MeshDocument& md, RichParameterList & par) { switch(ID(a)) @@ -172,14 +172,14 @@ void FilterIsoParametrization::PrintStats(CMeshO *mesh) StatEdge(*mesh,minE,maxE,avE,stdE); StatArea(*mesh,minAr,maxAr,avAr,stdAr); StatAngle(*mesh,minAn,maxAn,avAn,stdAn); - Log(" REMESHED "); - Log("Irregular Vertices:%d ",non_reg); - Log("stdDev Area: %5.2f",stdAr/avAr); - Log("stdDev Angle: %5.2f",stdAn/avAn); - Log("stdDev Edge: %5.2f",stdE/avE); + log(" REMESHED "); + log("Irregular Vertices:%d ",non_reg); + log("stdDev Area: %5.2f",stdAr/avAr); + log("stdDev Angle: %5.2f",stdAn/avAn); + log("stdDev Edge: %5.2f",stdE/avE); } -bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, const RichParameterList & par, vcg::CallBackPos *cb) +bool FilterIsoParametrization::applyFilter(const QAction *filter, MeshDocument& md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { MeshModel* m = md.mm(); //get current mesh from document CMeshO *mesh=&m->cm; @@ -234,7 +234,7 @@ bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, co float aggregate,L2; int n_faces; Parametrizator.getValues(aggregate,L2,n_faces); - Log("Num Faces of Abstract Domain: %d, One way stretch efficiency: %.4f, Area+Angle Distorsion %.4f ",n_faces,L2,aggregate*100.f); + log("Num Faces of Abstract Domain: %d, One way stretch efficiency: %.4f, Area+Angle Distorsion %.4f ",n_faces,L2,aggregate*100.f); } else { @@ -325,11 +325,11 @@ bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, co int n_diamonds,inFace,inEdge,inStar,n_merged; DiamSampl.getResData(n_diamonds,inFace,inEdge,inStar,n_merged); - Log("INTERPOLATION DOMAINS"); - Log("In Face: %d \n",inFace); - Log("In Diamond: %d \n",inEdge); - Log("In Star: %d \n",inStar); - Log("Merged %d vertices\n",n_merged); + log("INTERPOLATION DOMAINS"); + log("In Face: %d \n",inFace); + log("In Diamond: %d \n",inEdge); + log("In Star: %d \n",inStar); + log("Merged %d vertices\n",n_merged); mm->updateDataMask(MeshModel::MM_FACEFACETOPO); mm->updateDataMask(MeshModel::MM_VERTFACETOPO); PrintStats(rem); @@ -453,28 +453,28 @@ bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, co return false; } -MeshFilterInterface::FilterClass FilterIsoParametrization::getClass(QAction *) +FilterPluginInterface::FilterClass FilterIsoParametrization::getClass(const QAction *) const { - return MeshFilterInterface::Remeshing; + return FilterPluginInterface::Remeshing; } -int FilterIsoParametrization::postCondition( QAction* /*filter*/ ) const +int FilterIsoParametrization::postCondition(const QAction* /*filter*/ ) const { return MeshModel::MM_WEDGTEXCOORD | MeshModel::MM_VERTTEXCOORD; } -MeshFilterInterface::FILTER_ARITY FilterIsoParametrization::filterArity( QAction* filter) const +FilterPluginInterface::FILTER_ARITY FilterIsoParametrization::filterArity(const QAction* filter) const { switch(ID(filter)) { case ISOP_PARAM : case ISOP_REMESHING : case ISOP_DIAMPARAM : - return MeshFilterInterface::SINGLE_MESH; + return FilterPluginInterface::SINGLE_MESH; case ISOP_TRANSFER: - return MeshFilterInterface::FIXED; + return FilterPluginInterface::FIXED; } - return MeshFilterInterface::NONE; + return FilterPluginInterface::NONE; } diff --git a/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.h b/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.h index 29696fb34..c8617d394 100644 --- a/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.h +++ b/src/meshlabplugins/filter_isoparametrization/filter_isoparametrization.h @@ -29,13 +29,13 @@ #include #include #include -#include +#include -class FilterIsoParametrization : public QObject, public MeshFilterInterface +class FilterIsoParametrization : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum {ISOP_PARAM, @@ -48,17 +48,17 @@ class FilterIsoParametrization : public QObject, public MeshFilterInterface ~FilterIsoParametrization(); QString pluginName() const; - virtual FilterClass getClass(QAction *); + virtual FilterClass getClass(const QAction*) const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual int getRequirements(QAction *); + virtual int getRequirements(const QAction*); - virtual void initParameterSet(QAction *,MeshDocument&, RichParameterList & /*parent*/); - virtual bool applyFilter(QAction *filter, MeshDocument&, const RichParameterList & /*parent*/, vcg::CallBackPos * cb); - int postCondition(QAction* filter) const; + virtual void initParameterList(const QAction*, MeshDocument&, RichParameterList & /*parent*/); + virtual bool applyFilter(const QAction* filter, MeshDocument&, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb); + int postCondition(const QAction* filter) const; void PrintStats(CMeshO *mesh); - FILTER_ARITY filterArity(QAction*) const; + FILTER_ARITY filterArity(const QAction*) const; }; #endif diff --git a/src/meshlabplugins/filter_layer/filter_layer.cpp b/src/meshlabplugins/filter_layer/filter_layer.cpp index 1fa09ee9d..9bb07fb9f 100644 --- a/src/meshlabplugins/filter_layer/filter_layer.cpp +++ b/src/meshlabplugins/filter_layer/filter_layer.cpp @@ -29,6 +29,8 @@ #include #include +#include +#include @@ -113,7 +115,7 @@ QString FilterLayerPlugin::filterInfo(FilterIDType filterId) const } // This function define the needed parameters for each filter. -void FilterLayerPlugin::initParameterSet(QAction *action, MeshDocument &md, RichParameterList & parlst) +void FilterLayerPlugin::initParameterList(const QAction *action, MeshDocument &md, RichParameterList & parlst) { MeshModel *mm=md.mm(); RasterModel *rm=md.rm(); @@ -178,7 +180,7 @@ void FilterLayerPlugin::initParameterSet(QAction *action, MeshDocument &md, Rich } // Core Function doing the actual mesh processing. -bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) +bool FilterLayerPlugin::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { CMeshO::FaceIterator fi; int numFacesSel,numVertSel; @@ -274,11 +276,11 @@ bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ric tri::UpdateSelection::VertexClear(currentModel->cm); currentModel->clearDataMask(MeshModel::MM_FACEFACETOPO); - Log("Moved %i vertices to layer %i, deleted %i faces", numVertSel, delfaces, md.meshList.size()); + log("Moved %i vertices to layer %i, deleted %i faces", numVertSel, delfaces, md.meshList.size()); } else // keep original faces { - Log("Copied %i vertices to layer %i", numVertSel, md.meshList.size()); + log("Copied %i vertices to layer %i", numVertSel, md.meshList.size()); } vcg::tri::UpdateFlags::VertexClear(destModel->cm, CMeshO::VertexType::SELECTED); @@ -319,11 +321,11 @@ bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ric tri::UpdateSelection::FaceClear(currentModel->cm); currentModel->clearDataMask(MeshModel::MM_FACEFACETOPO); - Log("Moved %i faces and %i vertices to layer %i", numFacesSel, numVertSel, md.meshList.size()); + log("Moved %i faces and %i vertices to layer %i", numFacesSel, numVertSel, md.meshList.size()); } else // keep original faces { - Log("Copied %i faces and %i vertices to layer %i", numFacesSel, numVertSel, md.meshList.size()); + log("Copied %i faces and %i vertices to layer %i", numFacesSel, numVertSel, md.meshList.size()); } vcg::tri::UpdateFlags::VertexClear(destModel->cm, CMeshO::VertexType::SELECTED); vcg::tri::UpdateFlags::FaceClear(destModel->cm, CMeshO::FaceType::SELECTED); @@ -342,7 +344,7 @@ bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ric destModel->updateDataMask(currentModel); tri::Append::Mesh(destModel->cm, currentModel->cm); - Log("Duplicated current model to layer %i", md.meshList.size()); + log("Duplicated current model to layer %i", md.meshList.size()); // init new layer destModel->UpdateBoxAndNormals(); @@ -385,7 +387,7 @@ bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ric if( deleteLayer ) { - Log( "Deleted %d merged layers", toBeDeletedList.size()); + log( "Deleted %d merged layers", toBeDeletedList.size()); foreach(MeshModel *mmp,toBeDeletedList) md.delMesh(mmp); md.setCurrent(destModel); // setting again newly created model as current @@ -394,11 +396,11 @@ bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ric if( mergeVertices ) { int delvert = tri::Clean::RemoveDuplicateVertex(destModel->cm); - Log( "Removed %d duplicated vertices", delvert); + log( "Removed %d duplicated vertices", delvert); } destModel->UpdateBoxAndNormals(); - Log("Merged all the layers to single mesh of %i vertices",md.mm()->cm.vn); + log("Merged all the layers to single mesh of %i vertices",md.mm()->cm.vn); } break; case FP_SPLITCONNECTED : @@ -408,7 +410,7 @@ bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ric md.mm()->updateDataMask(MeshModel::MM_FACEFACETOPO); std::vector< std::pair > connectedCompVec; int numCC = tri::Clean::ConnectedComponents(cm, connectedCompVec); - Log("Found %i Connected Components",numCC); + log("Found %i Connected Components",numCC); for(size_t i=0; ierrorMessage = "Distortion is not supported"; - Log("Warning! Distortion parameters won't be imported! Please undistort the images in Photoscan before!"); // text + log("Warning! Distortion parameters won't be imported! Please undistort the images in Photoscan before!"); // text } @@ -836,7 +838,7 @@ bool FilterLayerPlugin::applyFilter(QAction *filter, MeshDocument &md, const Ric return true; } -FilterLayerPlugin::FilterClass FilterLayerPlugin::getClass(QAction *a) +FilterLayerPlugin::FilterClass FilterLayerPlugin::getClass(const QAction *a) const { switch(ID(a)) { @@ -849,18 +851,18 @@ FilterLayerPlugin::FilterClass FilterLayerPlugin::getClass(QAction *a) case FP_MESH_VISIBILITY : case FP_SPLITCONNECTED : case FP_DELETE_MESH : - case FP_DELETE_NON_VISIBLE_MESH : return MeshFilterInterface::Layer; + case FP_DELETE_NON_VISIBLE_MESH : return FilterPluginInterface::Layer; case FP_RENAME_RASTER : case FP_DELETE_RASTER : case FP_DELETE_NON_SELECTED_RASTER : - case FP_EXPORT_CAMERAS: return MeshFilterInterface::RasterLayer; - case FP_IMPORT_CAMERAS: return FilterClass(MeshFilterInterface::Camera + MeshFilterInterface::RasterLayer); + case FP_EXPORT_CAMERAS: return FilterPluginInterface::RasterLayer; + case FP_IMPORT_CAMERAS: return FilterClass(FilterPluginInterface::Camera + FilterPluginInterface::RasterLayer); default : assert(0); } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } -MeshFilterInterface::FILTER_ARITY FilterLayerPlugin::filterArity( QAction* filter) const +FilterPluginInterface::FILTER_ARITY FilterLayerPlugin::filterArity(const QAction* filter) const { switch(ID(filter)) { @@ -872,21 +874,21 @@ MeshFilterInterface::FILTER_ARITY FilterLayerPlugin::filterArity( QAction* filte case FP_SELECTCURRENT : case FP_SPLITCONNECTED : case FP_DELETE_MESH : - return MeshFilterInterface::SINGLE_MESH; + return FilterPluginInterface::SINGLE_MESH; case FP_RENAME_RASTER : case FP_DELETE_RASTER : case FP_DELETE_NON_SELECTED_RASTER : case FP_EXPORT_CAMERAS: case FP_IMPORT_CAMERAS: - return MeshFilterInterface::NONE; + return FilterPluginInterface::NONE; case FP_FLATTEN : case FP_DELETE_NON_VISIBLE_MESH : - return MeshFilterInterface::VARIABLE; + return FilterPluginInterface::VARIABLE; } - return MeshFilterInterface::NONE; + return FilterPluginInterface::NONE; } -int FilterLayerPlugin::postCondition(QAction* filter) const +int FilterLayerPlugin::postCondition(const QAction* filter) const { switch (ID(filter)) { @@ -909,7 +911,7 @@ int FilterLayerPlugin::postCondition(QAction* filter) const default: assert(0); } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } MESHLAB_PLUGIN_NAME_EXPORTER(FilterLayerPlugin) diff --git a/src/meshlabplugins/filter_layer/filter_layer.h b/src/meshlabplugins/filter_layer/filter_layer.h index b482ce5a8..bc94c1bb4 100644 --- a/src/meshlabplugins/filter_layer/filter_layer.h +++ b/src/meshlabplugins/filter_layer/filter_layer.h @@ -26,13 +26,13 @@ #include -#include +#include -class FilterLayerPlugin : public QObject, public MeshFilterInterface +class FilterLayerPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { @@ -58,11 +58,11 @@ public: QString pluginName() const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual FilterClass getClass(QAction *); - virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterList & /*parent*/); - virtual bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - int postCondition(QAction *filter) const; - FILTER_ARITY filterArity(QAction*) const; + virtual FilterClass getClass(const QAction*) const; + virtual void initParameterList(const QAction*, MeshDocument &/*m*/, RichParameterList & /*parent*/); + virtual bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + int postCondition(const QAction *filter) const; + FILTER_ARITY filterArity(const QAction*) const; }; #endif diff --git a/src/meshlabplugins/filter_measure/filter_measure.cpp b/src/meshlabplugins/filter_measure/filter_measure.cpp index 7e79d6e16..189aed1f5 100644 --- a/src/meshlabplugins/filter_measure/filter_measure.cpp +++ b/src/meshlabplugins/filter_measure/filter_measure.cpp @@ -125,17 +125,17 @@ QString FilterMeasurePlugin::filterName(FilterIDType filterId) const } } -FilterMeasurePlugin::FilterClass FilterMeasurePlugin::getClass(QAction *) +FilterMeasurePlugin::FilterClass FilterMeasurePlugin::getClass(const QAction *) const { - return MeshFilterInterface::Measure; + return FilterPluginInterface::Measure; } -MeshFilterInterface::FILTER_ARITY FilterMeasurePlugin::filterArity(QAction*) const +FilterPluginInterface::FILTER_ARITY FilterMeasurePlugin::filterArity(const QAction*) const { return SINGLE_MESH; } -int FilterMeasurePlugin::getPreConditions(QAction* action) const +int FilterMeasurePlugin::getPreConditions(const QAction* action) const { switch (ID(action)) { case PER_VERTEX_QUALITY_STAT: @@ -151,7 +151,7 @@ int FilterMeasurePlugin::getPreConditions(QAction* action) const } } -void FilterMeasurePlugin::initParameterSet(QAction *action, MeshModel &m, RichParameterList & parlst) +void FilterMeasurePlugin::initParameterList(const QAction *action, MeshModel &m, RichParameterList & parlst) { switch (ID(action)) { case PER_VERTEX_QUALITY_HISTOGRAM: @@ -171,7 +171,7 @@ void FilterMeasurePlugin::initParameterSet(QAction *action, MeshModel &m, RichPa } } -bool FilterMeasurePlugin::applyFilter(QAction* filter, MeshDocument& md, const RichParameterList& parlst, vcg::CallBackPos*) +bool FilterMeasurePlugin::applyFilter(const QAction* filter, MeshDocument& md, unsigned int& /*postConditionMask*/, const RichParameterList& parlst, vcg::CallBackPos*) { switch (ID(filter)) { case COMPUTE_TOPOLOGICAL_MEASURES: @@ -204,7 +204,7 @@ bool FilterMeasurePlugin::applyFilter(QAction* filter, MeshDocument& md, const R } } -int FilterMeasurePlugin::postCondition(QAction*) const +int FilterMeasurePlugin::postCondition(const QAction*) const { return MeshModel::MM_NONE; } @@ -229,32 +229,32 @@ bool FilterMeasurePlugin::computeTopologicalMeasures(MeshDocument& md) tri::Clean::CountEdgeNum(m, edgeNum, edgeBorderNum, edgeNonManifNum); assert(edgeNonManifFFNum == edgeNonManifNum); int holeNum; - Log("V: %6i E: %6i F:%6i", m.vn, edgeNum, m.fn); + log("V: %6i E: %6i F:%6i", m.vn, edgeNum, m.fn); int unrefVertNum = tri::Clean::CountUnreferencedVertex(m); - Log("Unreferenced Vertices %i", unrefVertNum); - Log("Boundary Edges %i", edgeBorderNum); + log("Unreferenced Vertices %i", unrefVertNum); + log("Boundary Edges %i", edgeBorderNum); int connectedComponentsNum = tri::Clean::CountConnectedComponents(m); - Log("Mesh is composed by %i connected component(s)\n", connectedComponentsNum); + log("Mesh is composed by %i connected component(s)\n", connectedComponentsNum); if (edgeNonManifFFNum == 0 && vertManifNum == 0){ - Log("Mesh is two-manifold "); + log("Mesh is two-manifold "); } - if (edgeNonManifFFNum != 0) Log("Mesh has %i non two manifold edges and %i faces are incident on these edges\n", edgeNonManifFFNum, faceEdgeManif); - if (vertManifNum != 0) Log("Mesh has %i non two manifold vertices and %i faces are incident on these vertices\n", vertManifNum, faceVertManif); + if (edgeNonManifFFNum != 0) log("Mesh has %i non two manifold edges and %i faces are incident on these edges\n", edgeNonManifFFNum, faceEdgeManif); + if (vertManifNum != 0) log("Mesh has %i non two manifold vertices and %i faces are incident on these vertices\n", vertManifNum, faceVertManif); // For Manifold meshes compute some other stuff if (vertManifNum == 0 && edgeNonManifFFNum == 0) { holeNum = tri::Clean::CountHoles(m); - Log("Mesh has %i holes", holeNum); + log("Mesh has %i holes", holeNum); int genus = tri::Clean::MeshGenus(m.vn - unrefVertNum, edgeNum, m.fn, holeNum, connectedComponentsNum); - Log("Genus is %i", genus); + log("Genus is %i", genus); } else { - Log("Mesh has a undefined number of holes (non 2-manifold mesh)"); - Log("Genus is undefined (non 2-manifold mesh)"); + log("Mesh has a undefined number of holes (non 2-manifold mesh)"); + log("Genus is undefined (non 2-manifold mesh)"); } return true; @@ -281,10 +281,10 @@ bool FilterMeasurePlugin::computeTopologicalMeasuresForQuadMeshes(MeshDocument& int nLargePolys = tri::Clean::CountBitLargePolygons(m); if (nLargePolys>0) nQuads = 0; - Log("Mesh has %8i triangles \n", nTris); - Log(" %8i quads \n", nQuads); - Log(" %8i polygons \n", nPolys); - Log(" %8i large polygons (with internal faux vertices)", nLargePolys); + log("Mesh has %8i triangles \n", nTris); + log(" %8i quads \n", nQuads); + log(" %8i polygons \n", nPolys); + log(" %8i large polygons (with internal faux vertices)", nLargePolys); if (!tri::Clean::IsBitTriQuadOnly(m)) { this->errorMessage = "QuadMesh problem: the mesh is not TriQuadOnly"; @@ -331,10 +331,10 @@ bool FilterMeasurePlugin::computeTopologicalMeasuresForQuadMeshes(MeshDocument& RatioD.Add(edgeLen[0] / edgeLen[3]); } - Log("Right Angle Discrepancy Avg %4.3f Min %4.3f Max %4.3f StdDev %4.3f Percentile 0.05 %4.3f percentile 95 %4.3f", + log("Right Angle Discrepancy Avg %4.3f Min %4.3f Max %4.3f StdDev %4.3f Percentile 0.05 %4.3f percentile 95 %4.3f", AngleD.Avg(), AngleD.Min(), AngleD.Max(), AngleD.StandardDeviation(), AngleD.Percentile(0.05f), AngleD.Percentile(0.95f)); - Log("Quad Ratio Avg %4.3f Min %4.3f Max %4.3f", RatioD.Avg(), RatioD.Min(), RatioD.Max()); + log("Quad Ratio Avg %4.3f Min %4.3f Max %4.3f", RatioD.Avg(), RatioD.Min(), RatioD.Max()); return true; } @@ -346,15 +346,15 @@ bool FilterMeasurePlugin::computeGeometricMeasures(MeshDocument& md) // the mesh has to be correctly transformed if (m.Tr != Matrix44m::Identity()) { - Log("BEWARE: Measures are calculated considering the current transformation matrix"); + log("BEWARE: Measures are calculated considering the current transformation matrix"); tri::UpdatePosition::Matrix(m, m.Tr, true); } // bounding box - Log("Mesh Bounding Box Size %f %f %f", m.bbox.DimX(), m.bbox.DimY(), m.bbox.DimZ()); - Log("Mesh Bounding Box Diag %f ", m.bbox.Diag()); - Log("Mesh Bounding Box min %f %f %f", m.bbox.min[0], m.bbox.min[1], m.bbox.min[2]); - Log("Mesh Bounding Box max %f %f %f", m.bbox.max[0], m.bbox.max[1], m.bbox.max[2]); + log("Mesh Bounding Box Size %f %f %f", m.bbox.DimX(), m.bbox.DimY(), m.bbox.DimZ()); + log("Mesh Bounding Box Diag %f ", m.bbox.Diag()); + log("Mesh Bounding Box min %f %f %f", m.bbox.min[0], m.bbox.min[1], m.bbox.min[2]); + log("Mesh Bounding Box max %f %f %f", m.bbox.max[0], m.bbox.max[1], m.bbox.max[2]); // is pointcloud? if ((m.fn == 0) && (m.vn != 0)) @@ -363,43 +363,43 @@ bool FilterMeasurePlugin::computeGeometricMeasures(MeshDocument& md) if (pointcloud) { // cloud barycenter Point3m bc = tri::Stat::ComputeCloudBarycenter(m, false); - Log("Pointcloud (vertex) barycenter %9.6f %9.6f %9.6f", bc[0], bc[1], bc[2]); + log("Pointcloud (vertex) barycenter %9.6f %9.6f %9.6f", bc[0], bc[1], bc[2]); // if there is vertex quality, also provide weighted barycenter if (tri::HasPerVertexQuality(m)) { bc = tri::Stat::ComputeCloudBarycenter(m, true); - Log("Pointcloud (vertex) barycenter, weighted by verytex quality:"); - Log(" %9.6f %9.6f %9.6f", bc[0], bc[1], bc[2]); + log("Pointcloud (vertex) barycenter, weighted by verytex quality:"); + log(" %9.6f %9.6f %9.6f", bc[0], bc[1], bc[2]); } // principal axis Matrix33m PCA; PCA = computePrincipalAxisCloud(m); - Log("Principal Axes are :"); - Log(" | %9.6f %9.6f %9.6f |", PCA[0][0], PCA[0][1], PCA[0][2]); - Log(" | %9.6f %9.6f %9.6f |", PCA[1][0], PCA[1][1], PCA[1][2]); - Log(" | %9.6f %9.6f %9.6f |", PCA[2][0], PCA[2][1], PCA[2][2]); + log("Principal Axes are :"); + log(" | %9.6f %9.6f %9.6f |", PCA[0][0], PCA[0][1], PCA[0][2]); + log(" | %9.6f %9.6f %9.6f |", PCA[1][0], PCA[1][1], PCA[1][2]); + log(" | %9.6f %9.6f %9.6f |", PCA[2][0], PCA[2][1], PCA[2][2]); } else { // area float Area = tri::Stat::ComputeMeshArea(m); - Log("Mesh Surface Area is %f", Area); + log("Mesh Surface Area is %f", Area); // edges Distribution eDist; tri::Stat::ComputeFaceEdgeLengthDistribution(m, eDist, false); - Log("Mesh Total Len of %i Edges is %f Avg Len %f", int(eDist.Cnt()), eDist.Sum(), eDist.Avg()); + log("Mesh Total Len of %i Edges is %f Avg Len %f", int(eDist.Cnt()), eDist.Sum(), eDist.Avg()); tri::Stat::ComputeFaceEdgeLengthDistribution(m, eDist, true); - Log("Mesh Total Len of %i Edges is %f Avg Len %f (including faux edges))", int(eDist.Cnt()), eDist.Sum(), eDist.Avg()); + log("Mesh Total Len of %i Edges is %f Avg Len %f (including faux edges))", int(eDist.Cnt()), eDist.Sum(), eDist.Avg()); // Thin shell barycenter Point3m bc = tri::Stat::ComputeShellBarycenter(m); - Log("Thin shell (faces) barycenter: %9.6f %9.6f %9.6f", bc[0], bc[1], bc[2]); + log("Thin shell (faces) barycenter: %9.6f %9.6f %9.6f", bc[0], bc[1], bc[2]); // cloud barycenter bc = tri::Stat::ComputeCloudBarycenter(m, false); - Log("Vertices barycenter %9.6f %9.6f %9.6f", bc[0], bc[1], bc[2]); + log("Vertices barycenter %9.6f %9.6f %9.6f", bc[0], bc[1], bc[2]); // is watertight? int edgeNum = 0, edgeBorderNum = 0, edgeNonManifNum = 0; @@ -410,42 +410,42 @@ bool FilterMeasurePlugin::computeGeometricMeasures(MeshDocument& md) // volume float Volume = I.Mass(); - Log("Mesh Volume is %f", Volume); + log("Mesh Volume is %f", Volume); // center of mass - Log("Center of Mass is %f %f %f", I.CenterOfMass()[0], I.CenterOfMass()[1], I.CenterOfMass()[2]); + log("Center of Mass is %f %f %f", I.CenterOfMass()[0], I.CenterOfMass()[1], I.CenterOfMass()[2]); // inertia tensor Matrix33m IT; I.InertiaTensor(IT); - Log("Inertia Tensor is :"); - Log(" | %9.6f %9.6f %9.6f |", IT[0][0], IT[0][1], IT[0][2]); - Log(" | %9.6f %9.6f %9.6f |", IT[1][0], IT[1][1], IT[1][2]); - Log(" | %9.6f %9.6f %9.6f |", IT[2][0], IT[2][1], IT[2][2]); + log("Inertia Tensor is :"); + log(" | %9.6f %9.6f %9.6f |", IT[0][0], IT[0][1], IT[0][2]); + log(" | %9.6f %9.6f %9.6f |", IT[1][0], IT[1][1], IT[1][2]); + log(" | %9.6f %9.6f %9.6f |", IT[2][0], IT[2][1], IT[2][2]); // principal axis Matrix33m PCA; Point3m pcav; I.InertiaTensorEigen(PCA, pcav); - Log("Principal axes are :"); - Log(" | %9.6f %9.6f %9.6f |", PCA[0][0], PCA[0][1], PCA[0][2]); - Log(" | %9.6f %9.6f %9.6f |", PCA[1][0], PCA[1][1], PCA[1][2]); - Log(" | %9.6f %9.6f %9.6f |", PCA[2][0], PCA[2][1], PCA[2][2]); + log("Principal axes are :"); + log(" | %9.6f %9.6f %9.6f |", PCA[0][0], PCA[0][1], PCA[0][2]); + log(" | %9.6f %9.6f %9.6f |", PCA[1][0], PCA[1][1], PCA[1][2]); + log(" | %9.6f %9.6f %9.6f |", PCA[2][0], PCA[2][1], PCA[2][2]); - Log("axis momenta are :"); - Log(" | %9.6f %9.6f %9.6f |", pcav[0], pcav[1], pcav[2]); + log("axis momenta are :"); + log(" | %9.6f %9.6f %9.6f |", pcav[0], pcav[1], pcav[2]); } else { - Log("Mesh is not 'watertight', no information on volume, barycenter and inertia tensor."); + log("Mesh is not 'watertight', no information on volume, barycenter and inertia tensor."); // principal axis Matrix33m PCA; PCA = computePrincipalAxisCloud(m); - Log("Principal axes are :"); - Log(" | %9.6f %9.6f %9.6f |", PCA[0][0], PCA[0][1], PCA[0][2]); - Log(" | %9.6f %9.6f %9.6f |", PCA[1][0], PCA[1][1], PCA[1][2]); - Log(" | %9.6f %9.6f %9.6f |", PCA[2][0], PCA[2][1], PCA[2][2]); + log("Principal axes are :"); + log(" | %9.6f %9.6f %9.6f |", PCA[0][0], PCA[0][1], PCA[0][2]); + log(" | %9.6f %9.6f %9.6f |", PCA[1][0], PCA[1][1], PCA[1][2]); + log(" | %9.6f %9.6f %9.6f |", PCA[2][0], PCA[2][1], PCA[2][2]); } } @@ -462,13 +462,13 @@ bool FilterMeasurePlugin::computeAreaPerimeterOfSelection(MeshDocument& md) CMeshO &m = md.mm()->cm; if (m.sfn == 0) {// no face selected, fail errorMessage = "Cannot apply: there is no face selection"; - Log("Cannot apply: there is no face selection"); + log("Cannot apply: there is no face selection"); return false; } - Log("Selection is %i triangles", m.sfn); + log("Selection is %i triangles", m.sfn); if (m.Tr != Matrix44m::Identity()) - Log("BEWARE: Area and Perimeter are calculated considering the current transformation matrix"); + log("BEWARE: Area and Perimeter are calculated considering the current transformation matrix"); double fArea = 0.0; double sArea=0; @@ -479,7 +479,7 @@ bool FilterMeasurePlugin::computeAreaPerimeterOfSelection(MeshDocument& md) fArea = (((m.Tr * (*fi).cP(1)) - (m.Tr * (*fi).cP(0))) ^ ((m.Tr * (*fi).cP(2)) - (m.Tr * (*fi).cP(0)))).Norm(); sArea += fArea / 2.0; } - Log("Selection Surface Area is %f", sArea); + log("Selection Surface Area is %f", sArea); int ePerimeter = 0; double sPerimeter = 0.0; @@ -497,8 +497,8 @@ bool FilterMeasurePlugin::computeAreaPerimeterOfSelection(MeshDocument& md) } } - Log("Selection border is %i edges", ePerimeter); - Log("Perimeter is %f", sPerimeter); + log("Selection border is %i edges", ePerimeter); + log("Perimeter is %f", sPerimeter); return true; } @@ -509,10 +509,10 @@ bool FilterMeasurePlugin::perVertexQualityStat(MeshDocument& md) Distribution DD; tri::Stat::ComputePerVertexQualityDistribution(m, DD, false); - Log(" Min %f Max %f", DD.Min(), DD.Max()); - Log(" Avg %f Med %f", DD.Avg(), DD.Percentile(0.5f)); - Log(" StdDev %f", DD.StandardDeviation()); - Log(" Variance %f", DD.Variance()); + log(" Min %f Max %f", DD.Min(), DD.Max()); + log(" Avg %f Med %f", DD.Avg(), DD.Percentile(0.5f)); + log(" StdDev %f", DD.StandardDeviation()); + log(" Variance %f", DD.Variance()); return true; } @@ -522,10 +522,10 @@ bool FilterMeasurePlugin::perFaceQualityStat(MeshDocument& md) Distribution DD; tri::Stat::ComputePerFaceQualityDistribution(m, DD, false); - Log(" Min %f Max %f", DD.Min(), DD.Max()); - Log(" Avg %f Med %f", DD.Avg(), DD.Percentile(0.5f)); - Log(" StdDev %f", DD.StandardDeviation()); - Log(" Variance %f", DD.Variance()); + log(" Min %f Max %f", DD.Min(), DD.Max()); + log(" Avg %f Med %f", DD.Avg(), DD.Percentile(0.5f)); + log(" StdDev %f", DD.StandardDeviation()); + log(" Variance %f", DD.Variance()); return true; } @@ -544,16 +544,16 @@ bool FilterMeasurePlugin::perVertexQualityHistogram(MeshDocument& md, float Rang H.Add(m.vert[i].Q(), aVec[i]); if (areaFlag) { - Log("( -inf..%15.7f) : %15.7f", RangeMin, H.BinCountInd(0)); + log("( -inf..%15.7f) : %15.7f", RangeMin, H.BinCountInd(0)); for (int i = 1; i <= binNum; ++i) - Log("[%15.7f..%15.7f) : %15.7f", H.BinLowerBound(i), H.BinUpperBound(i), H.BinCountInd(i)); - Log("[%15.7f.. +inf) : %15.7f", RangeMax, H.BinCountInd(binNum + 1)); + log("[%15.7f..%15.7f) : %15.7f", H.BinLowerBound(i), H.BinUpperBound(i), H.BinCountInd(i)); + log("[%15.7f.. +inf) : %15.7f", RangeMax, H.BinCountInd(binNum + 1)); } else { - Log("( -inf..%15.7f) : %4.0f", RangeMin, H.BinCountInd(0)); + log("( -inf..%15.7f) : %4.0f", RangeMin, H.BinCountInd(0)); for (int i = 1; i <= binNum; ++i) - Log("[%15.7f..%15.7f) : %4.0f", H.BinLowerBound(i), H.BinUpperBound(i), H.BinCountInd(i)); - Log("[%15.7f.. +inf) : %4.0f", RangeMax, H.BinCountInd(binNum + 1)); + log("[%15.7f..%15.7f) : %4.0f", H.BinLowerBound(i), H.BinUpperBound(i), H.BinCountInd(i)); + log("[%15.7f.. +inf) : %4.0f", RangeMax, H.BinCountInd(binNum + 1)); } aVec = vector(m.vn, 1.0); @@ -563,16 +563,16 @@ bool FilterMeasurePlugin::perVertexQualityHistogram(MeshDocument& md, float Rang for (int i = 0; i(m.fn, 1.0); @@ -611,16 +611,16 @@ bool FilterMeasurePlugin::perFaceQualityHostogram(MeshDocument& md, float RangeM for (int i = 0; i +#include -class FilterMeasurePlugin : public QObject, public MeshFilterInterface +class FilterMeasurePlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { @@ -50,12 +50,12 @@ public: QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - FilterClass getClass(QAction*); - FILTER_ARITY filterArity(QAction*) const; - int getPreConditions(QAction *action) const; - void initParameterSet(QAction* , MeshModel& m, RichParameterList& parlst); - bool applyFilter(QAction* filter, MeshDocument& md, const RichParameterList& parlst, vcg::CallBackPos*) ; - int postCondition( QAction* ) const; + FilterClass getClass(const QAction*) const; + FILTER_ARITY filterArity(const QAction*) const; + int getPreConditions(const QAction *action) const; + void initParameterList(const QAction* , MeshModel& m, RichParameterList& parlst); + bool applyFilter(const QAction* filter, MeshDocument& md, unsigned int& postConditionMask, const RichParameterList& parlst, vcg::CallBackPos*) ; + int postCondition(const QAction* ) const; private: bool computeTopologicalMeasures(MeshDocument& md); diff --git a/src/meshlabplugins/filter_meshing/meshfilter.cpp b/src/meshlabplugins/filter_meshing/meshfilter.cpp index 5121e4bc2..f910122b5 100644 --- a/src/meshlabplugins/filter_meshing/meshfilter.cpp +++ b/src/meshlabplugins/filter_meshing/meshfilter.cpp @@ -118,7 +118,7 @@ QString ExtraMeshFilterPlugin::pluginName() const return "FilterMeshing"; } -ExtraMeshFilterPlugin::FilterClass ExtraMeshFilterPlugin::getClass(QAction * a) +ExtraMeshFilterPlugin::FilterClass ExtraMeshFilterPlugin::getClass(const QAction * a) const { switch (ID(a)) { @@ -133,7 +133,7 @@ ExtraMeshFilterPlugin::FilterClass ExtraMeshFilterPlugin::getClass(QAction * a) case FP_FAUX_CREASE : case FP_FAUX_EXTRACT : case FP_VATTR_SEAM : - case FP_REFINE_LS3_LOOP : return MeshFilterInterface::Remeshing; + case FP_REFINE_LS3_LOOP : return FilterPluginInterface::Remeshing; case FP_REFINE_CATMULL : case FP_REFINE_HALF_CATMULL : case FP_QUAD_DOMINANT : @@ -150,7 +150,7 @@ ExtraMeshFilterPlugin::FilterClass ExtraMeshFilterPlugin::getClass(QAction * a) case FP_CENTER : case FP_SCALE : case FP_PRINCIPAL_AXIS : - case FP_FLIP_AND_SWAP : return MeshFilterInterface::Normal; + case FP_FLIP_AND_SWAP : return FilterPluginInterface::Normal; case FP_COMPUTE_PRINC_CURV_DIR : return FilterClass( Normal + VertexColoring ); @@ -162,15 +162,15 @@ ExtraMeshFilterPlugin::FilterClass ExtraMeshFilterPlugin::getClass(QAction * a) case FP_PERIMETER_POLYLINE : case FP_SLICE_WITH_A_PLANE : - case FP_CYLINDER_UNWRAP : return MeshFilterInterface::Measure; + case FP_CYLINDER_UNWRAP : return FilterPluginInterface::Measure; - default : assert(0); return MeshFilterInterface::Generic; + default : assert(0); return FilterPluginInterface::Generic; } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } -int ExtraMeshFilterPlugin::getPreCondition(QAction *filter) const +int ExtraMeshFilterPlugin::getPreConditions(const QAction *filter) const { switch (ID(filter)) { @@ -342,7 +342,7 @@ QString ExtraMeshFilterPlugin::filterInfo(FilterIDType filterID) const // return // true if has some parameters // false is has no params -void ExtraMeshFilterPlugin::initParameterSet(QAction * action, MeshModel & m, RichParameterList & parlst) +void ExtraMeshFilterPlugin::initParameterList(const QAction * action, MeshModel & m, RichParameterList & parlst) { float maxVal; QStringList curvCalcMethods; @@ -674,7 +674,7 @@ void ApplyTransform(MeshDocument &md, const Matrix44m &tr, bool toAllFlag, bool } -bool ExtraMeshFilterPlugin::applyFilter(QAction * filter, MeshDocument & md, const RichParameterList & par, vcg::CallBackPos * cb) +bool ExtraMeshFilterPlugin::applyFilter(const QAction * filter, MeshDocument & md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos * cb) { MeshModel & m = *md.mm(); @@ -881,11 +881,11 @@ switch(ID(filter)) if(par.getBool("AutoClean")) { int nullFaces=tri::Clean::RemoveFaceOutOfRangeArea(m.cm,0); - if(nullFaces) Log( "PostSimplification Cleaning: Removed %d null faces", nullFaces); + if(nullFaces) log( "PostSimplification Cleaning: Removed %d null faces", nullFaces); int deldupvert=tri::Clean::RemoveDuplicateVertex(m.cm); - if(deldupvert) Log( "PostSimplification Cleaning: Removed %d duplicated vertices", deldupvert); + if(deldupvert) log( "PostSimplification Cleaning: Removed %d duplicated vertices", deldupvert); int delvert=tri::Clean::RemoveUnreferencedVertex(m.cm); - if(delvert) Log( "PostSimplification Cleaning: Removed %d unreferenced vertices",delvert); + if(delvert) log( "PostSimplification Cleaning: Removed %d unreferenced vertices",delvert); m.clearDataMask(MeshModel::MM_FACEFACETOPO ); tri::Allocator::CompactVertexVector(m.cm); tri::Allocator::CompactFaceVector(m.cm); @@ -988,7 +988,7 @@ switch(ID(filter)) } catch(vcg::MissingPreconditionException& excp) { - Log(excp.what()); + log(excp.what()); errorMessage = excp.what(); return false; } @@ -1005,7 +1005,7 @@ switch(ID(filter)) if (m.cm.svn == 0 && m.cm.sfn == 0) // if no selection, fail { - Log("Cannot compute rotation: there is no selection"); + log("Cannot compute rotation: there is no selection"); errorMessage = "Cannot compute rotation: there is no selection"; return false; } @@ -1022,14 +1022,14 @@ switch(ID(filter)) selBox.Add(p); selected_pts.push_back(p); } - Log("Using %i vertices to build a fitting plane", int(selected_pts.size())); + log("Using %i vertices to build a fitting plane", int(selected_pts.size())); Plane3m plane; FitPlaneToPointSet(selected_pts, plane); float errorSum = 0; for (size_t i = 0; i < selected_pts.size(); ++i) errorSum += fabs(SignedDistancePlanePoint(plane, selected_pts[i])); - Log("Fitting Plane avg error is %f", errorSum / float(selected_pts.size())); - Log("Fitting Plane normal is [%f, %f, %f]", plane.Direction().X(), plane.Direction().Y(), plane.Direction().Z()); + log("Fitting Plane avg error is %f", errorSum / float(selected_pts.size())); + log("Fitting Plane normal is [%f, %f, %f]", plane.Direction().X(), plane.Direction().Y(), plane.Direction().Z()); Matrix44m tr1; // translation matrix the centroid of selected points tr1.SetTranslate(-selBox.Center()); @@ -1082,8 +1082,8 @@ switch(ID(filter)) Matrix44m rt; rt.SetRotateRad(-angleRad, rotAxis); - Log("Rotation axis is [%f, %f, %f]", rotAxis.X(), rotAxis.Y(), rotAxis.Z()); - Log("Rotation angle is %f", -angleRad); + log("Rotation axis is [%f, %f, %f]", rotAxis.X(), rotAxis.Y(), rotAxis.Z()); + log("Rotation angle is %f", -angleRad); Matrix44m transfM; if (par.getBool("ToOrigin")) @@ -1316,7 +1316,7 @@ switch(ID(filter)) if(par.getBool("Autoclean")){ int delvert=tri::Clean::RemoveUnreferencedVertex(m.cm); tri::Allocator::CompactVertexVector(m.cm); - Log( "Removed %d unreferenced vertices",delvert); + log( "Removed %d unreferenced vertices",delvert); } switch(par.getEnum("Method")) { @@ -1341,7 +1341,7 @@ switch(ID(filter)) tri::Stat::ComputePerVertexQualityHistogram(m.cm,H); tri::UpdateColor::PerVertexQualityRamp(m.cm,H.Percentile(0.1f),H.Percentile(0.9f)); - Log( "Curvature Range: %f %f (Used 90 percentile %f %f) ",H.MinV(),H.MaxV(),H.Percentile(0.1f),H.Percentile(0.9f)); + log( "Curvature Range: %f %f (Used 90 percentile %f %f) ",H.MinV(),H.MaxV(),H.Percentile(0.1f),H.Percentile(0.9f)); } break; case FP_CLOSE_HOLES: @@ -1362,7 +1362,7 @@ switch(ID(filter)) holeCnt = tri::Hole::EarCuttingIntersectionFill >(m.cm,MaxHoleSize,SelectedFlag,cb); else holeCnt = tri::Hole::EarCuttingFill >(m.cm,MaxHoleSize,SelectedFlag,cb); - Log("Closed %i holes and added %i new faces",holeCnt,m.cm.fn-OriginalSize); + log("Closed %i holes and added %i new faces",holeCnt,m.cm.fn-OriginalSize); assert(tri::Clean::IsFFAdjacencyConsistent(m.cm)); m.UpdateBoxAndNormals(); @@ -1388,7 +1388,7 @@ switch(ID(filter)) for(int i=0;iupdateDataMask(&m); @@ -1512,7 +1512,7 @@ switch(ID(filter)) } tri::BitQuadCreation::MakeTriEvenBySplit(m.cm); bool ret = tri::BitQuadCreation::MakePureByFlip(m.cm,100); - if(!ret) Log("Warning BitQuadCreation::MakePureByFlip failed."); + if(!ret) log("Warning BitQuadCreation::MakePureByFlip failed."); tri::UpdateNormal::PerBitQuadFaceNormalized(m.cm); m.updateDataMask(MeshModel::MM_POLYGONAL); } break; @@ -1604,11 +1604,11 @@ switch(ID(filter)) { if (m.cm.sfn == 0) // no face selected, fail { - Log("ERROR: There is no face selection!"); + log("ERROR: There is no face selection!"); return false; } - Log("Selection is %i triangles", m.cm.sfn); + log("Selection is %i triangles", m.cm.sfn); md.mm()->updateDataMask(MeshModel::MM_FACEFACETOPO); @@ -1671,7 +1671,7 @@ switch(ID(filter)) //actual cut of the mesh if (tri::Clean::CountNonManifoldEdgeFF(base->cm)>0 || (tri::Clean::CountNonManifoldVertexFF(base->cm,false) != 0)) { - Log("Mesh is not two manifold, cannot apply filter"); + log("Mesh is not two manifold, cannot apply filter"); return false; } @@ -1729,7 +1729,7 @@ switch(ID(filter)) tri::UpdateTopology::FaceFace(underM->cm); if ( tri::Clean::CountNonManifoldEdgeFF(underM->cm) > 0) { - Log("Mesh has some not 2 manifoldfaces, splitting surfaces requires manifoldness"); + log("Mesh has some not 2 manifoldfaces, splitting surfaces requires manifoldness"); md.delMesh(underM); } else @@ -1762,7 +1762,7 @@ switch(ID(filter)) return true; } -int ExtraMeshFilterPlugin::postCondition(QAction * filter) const +int ExtraMeshFilterPlugin::postCondition(const QAction * filter) const { switch (ID(filter)) { diff --git a/src/meshlabplugins/filter_meshing/meshfilter.h b/src/meshlabplugins/filter_meshing/meshfilter.h index f625f182a..013965c59 100644 --- a/src/meshlabplugins/filter_meshing/meshfilter.h +++ b/src/meshlabplugins/filter_meshing/meshfilter.h @@ -24,13 +24,13 @@ #ifndef EXTRAFILTERSPLUGIN_H #define EXTRAFILTERSPLUGIN_H -#include +#include -class ExtraMeshFilterPlugin : public QObject, public MeshFilterInterface +class ExtraMeshFilterPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) enum RefPlane { REF_CENTER,REF_MIN,REF_ORIG}; @@ -87,12 +87,12 @@ public: QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - FilterClass getClass(QAction *); - void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterList & /*parent*/); - bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - int postCondition(QAction *filter) const; - int getPreCondition(QAction *filter) const; - FILTER_ARITY filterArity(QAction *) const {return SINGLE_MESH;} + FilterClass getClass(const QAction*) const; + void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); + bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + int postCondition(const QAction *filter) const; + int getPreConditions(const QAction *filter) const; + FILTER_ARITY filterArity(const QAction *) const {return SINGLE_MESH;} protected: diff --git a/src/meshlabplugins/filter_mls/mlsmarchingcube.h b/src/meshlabplugins/filter_mls/mlsmarchingcube.h index dcbe76d88..db1c77c4e 100644 --- a/src/meshlabplugins/filter_mls/mlsmarchingcube.h +++ b/src/meshlabplugins/filter_mls/mlsmarchingcube.h @@ -26,6 +26,7 @@ #include #include +#include #include #include "mlssurface.h" diff --git a/src/meshlabplugins/filter_mls/mlsplugin.cpp b/src/meshlabplugins/filter_mls/mlsplugin.cpp index 5c941e81e..26d08f775 100644 --- a/src/meshlabplugins/filter_mls/mlsplugin.cpp +++ b/src/meshlabplugins/filter_mls/mlsplugin.cpp @@ -26,8 +26,6 @@ #include #include -#include - #include #include #include @@ -99,24 +97,24 @@ QString MlsPlugin::pluginName() const return QString("Filter Unknown"); } - MeshFilterInterface::FilterClass MlsPlugin::getClass(QAction *a) + FilterPluginInterface::FilterClass MlsPlugin::getClass(const QAction *a) const { int filterId = ID(a); switch(filterId) { case FP_APSS_PROJECTION : - case FP_RIMLS_PROJECTION : return FilterClass(MeshFilterInterface::PointSet + MeshFilterInterface::Smoothing); + case FP_RIMLS_PROJECTION : return FilterClass(FilterPluginInterface::PointSet + FilterPluginInterface::Smoothing); case FP_APSS_AFRONT : case FP_RIMLS_AFRONT : case FP_APSS_MCUBE : - case FP_RIMLS_MCUBE : return FilterClass(MeshFilterInterface::PointSet | MeshFilterInterface::Remeshing); + case FP_RIMLS_MCUBE : return FilterClass(FilterPluginInterface::PointSet | FilterPluginInterface::Remeshing); case FP_APSS_COLORIZE : - case FP_RIMLS_COLORIZE : return FilterClass(MeshFilterInterface::PointSet | MeshFilterInterface::VertexColoring); - case FP_RADIUS_FROM_DENSITY : return MeshFilterInterface::PointSet; - case FP_SELECT_SMALL_COMPONENTS : return MeshFilterInterface::Selection; + case FP_RIMLS_COLORIZE : return FilterClass(FilterPluginInterface::PointSet | FilterPluginInterface::VertexColoring); + case FP_RADIUS_FROM_DENSITY : return FilterPluginInterface::PointSet; + case FP_SELECT_SMALL_COMPONENTS : return FilterPluginInterface::Selection; } assert(0); - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } // Info() must return the longer string describing each filtering action @@ -175,7 +173,7 @@ return QString("Filter Unknown"); // - the string shown in the dialog // - the default value // - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog) -void MlsPlugin::initParameterSet(QAction* action, MeshDocument& md, RichParameterList& parlst) +void MlsPlugin::initParameterList(const QAction* action, MeshDocument& md, RichParameterList& parlst) { int id = ID(action); MeshModel *target = md.mm(); @@ -311,7 +309,7 @@ void MlsPlugin::initParameterSet(QAction* action, MeshDocument& md, RichParamete } } - int MlsPlugin::getRequirements(QAction *) + int MlsPlugin::getRequirements(const QAction *) { return 0; } @@ -357,7 +355,7 @@ void UpdateFaceNormalFromVertex(MeshType& m) } } -bool MlsPlugin::applyFilter(QAction* filter, MeshDocument& md, const RichParameterList& par, vcg::CallBackPos* cb) +bool MlsPlugin::applyFilter(const QAction* filter, MeshDocument& md, unsigned int& /*postConditionMask*/, const RichParameterList& par, vcg::CallBackPos* cb) { int id = ID(filter); @@ -384,7 +382,7 @@ bool MlsPlugin::applyFilter(QAction* filter, MeshDocument& md, const RichParamet { // if we start from a mesh, and it has unreferenced vertices // normals are undefined on that vertices. int delvert=tri::Clean::RemoveUnreferencedVertex(md.mm()->cm); - if(delvert) Log( "Pre-MLS Cleaning: Removed %d unreferenced vertices",delvert); + if(delvert) log( "Pre-MLS Cleaning: Removed %d unreferenced vertices",delvert); } tri::Allocator::CompactVertexVector(md.mm()->cm); @@ -394,7 +392,7 @@ bool MlsPlugin::applyFilter(QAction* filter, MeshDocument& md, const RichParamet md.mm()->updateDataMask(MeshModel::MM_VERTRADIUS); APSS mls(md.mm()->cm); mls.computeVertexRaddi(); - Log( "Mesh has no per vertex radius. Computed and added using default neighbourhood"); + log( "Mesh has no per vertex radius. Computed and added using default neighbourhood"); } MeshModel* pPoints = 0; @@ -486,7 +484,7 @@ bool MlsPlugin::applyFilter(QAction* filter, MeshDocument& md, const RichParamet } } - Log( "Successfully projected %i vertices", mesh->cm.vn); + log( "Successfully projected %i vertices", mesh->cm.vn); } else if (id & _COLORIZE_) { @@ -600,7 +598,7 @@ bool MlsPlugin::applyFilter(QAction* filter, MeshDocument& md, const RichParamet mesh->clearDataMask(MeshModel::MM_FACEFACETOPO); } - Log( "Marching cubes MLS meshing done."); + log( "Marching cubes MLS meshing done."); } delete mls; diff --git a/src/meshlabplugins/filter_mls/mlsplugin.h b/src/meshlabplugins/filter_mls/mlsplugin.h index 819e7830a..a382dedc0 100644 --- a/src/meshlabplugins/filter_mls/mlsplugin.h +++ b/src/meshlabplugins/filter_mls/mlsplugin.h @@ -26,13 +26,13 @@ #include -#include +#include -class MlsPlugin : public QObject, public MeshFilterInterface +class MlsPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: @@ -65,11 +65,11 @@ public: QString pluginName() const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - FilterClass getClass(QAction *a); - virtual void initParameterSet(QAction *,MeshDocument &md, RichParameterList &parent); - virtual int getRequirements(QAction *action); - virtual bool applyFilter(QAction *filter, MeshDocument &m, const RichParameterList &parent, vcg::CallBackPos *cb) ; - FILTER_ARITY filterArity(QAction *) const {return SINGLE_MESH;} + FilterClass getClass(const QAction *a) const; + virtual void initParameterList(const QAction*, MeshDocument &md, RichParameterList &parent); + virtual int getRequirements(const QAction* action); + virtual bool applyFilter(const QAction* filter, MeshDocument &m, unsigned int& postConditionMask, const RichParameterList &parent, vcg::CallBackPos *cb) ; + FILTER_ARITY filterArity(const QAction *) const {return SINGLE_MESH;} }; #endif diff --git a/src/meshlabplugins/filter_mutualglobal/CMakeLists.txt b/src/meshlabplugins/filter_mutualglobal/CMakeLists.txt index 18c1818af..fa096a29e 100644 --- a/src/meshlabplugins/filter_mutualglobal/CMakeLists.txt +++ b/src/meshlabplugins/filter_mutualglobal/CMakeLists.txt @@ -9,7 +9,6 @@ if(TARGET external-newuoa AND TARGET external-levmar) set(SOURCES - alignGlobal.cpp alignset.cpp filter_mutualglobal.cpp levmarmethods.cpp @@ -19,7 +18,6 @@ if(TARGET external-newuoa AND TARGET external-levmar) solver.cpp) set(HEADERS - alignGlobal.h alignset.h filter_mutualglobal.h levmarmethods.h diff --git a/src/meshlabplugins/filter_mutualglobal/alignGlobal.h b/src/meshlabplugins/filter_mutualglobal/alignGlobal.h index 64afe174b..9d8664f54 100644 --- a/src/meshlabplugins/filter_mutualglobal/alignGlobal.h +++ b/src/meshlabplugins/filter_mutualglobal/alignGlobal.h @@ -33,8 +33,7 @@ add sampleplugins #ifndef ALIGNGLOBAL_H #define ALIGNGLOBAL_H -#include - +#include class AlignPair { diff --git a/src/meshlabplugins/filter_mutualglobal/filter_mutualglobal.cpp b/src/meshlabplugins/filter_mutualglobal/filter_mutualglobal.cpp index 63f7ec000..e0deeaefe 100644 --- a/src/meshlabplugins/filter_mutualglobal/filter_mutualglobal.cpp +++ b/src/meshlabplugins/filter_mutualglobal/filter_mutualglobal.cpp @@ -38,6 +38,8 @@ #include +#include + // Constructor usually performs only two simple tasks of filling the two lists // - typeList: with all the possible id of the filtering actions // - actionList with the corresponding actions. If you want to add icons to your filtering actions you can do here by construction the QActions accordingly @@ -84,14 +86,14 @@ QString FilterMutualGlobal::filterName(FilterIDType filterId) const // The FilterClass describes in which generic class of filters it fits. // This choice affect the submenu in which each filter will be placed // More than a single class can be chosen. -FilterMutualGlobal::FilterClass FilterMutualGlobal::getClass(QAction *a) +FilterMutualGlobal::FilterClass FilterMutualGlobal::getClass(const QAction *a) const { switch(ID(a)) { - case FP_IMAGE_GLOBALIGN : return MeshFilterInterface::Camera; + case FP_IMAGE_GLOBALIGN : return FilterPluginInterface::Camera; default : assert(0); } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } // This function define the needed parameters for each filter. Return true if the filter has some parameters @@ -101,7 +103,7 @@ FilterMutualGlobal::FilterClass FilterMutualGlobal::getClass(QAction *a) // - the string shown in the dialog // - the default value // - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog) -void FilterMutualGlobal::initParameterSet(QAction *action,MeshDocument & md, RichParameterList & parlst) +void FilterMutualGlobal::initParameterList(const QAction *action,MeshDocument & md, RichParameterList & parlst) { QStringList rendList; switch(ID(action)) { @@ -158,7 +160,7 @@ void FilterMutualGlobal::initParameterSet(QAction *action,MeshDocument & md, Ric // The Real Core Function doing the actual mesh processing. // Move Vertex of a random quantity -bool FilterMutualGlobal::applyFilter(QAction *action, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) +bool FilterMutualGlobal::applyFilter(const QAction *action, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { QElapsedTimer filterTime; filterTime.start(); @@ -178,7 +180,7 @@ bool FilterMutualGlobal::applyFilter(QAction *action, MeshDocument &md, const Ri oldShots.push_back(md.rasterList[r]->shot); } - Log(0,"Sampled has %i vertices",myVec.size()); + log(0,"Sampled has %i vertices",myVec.size()); std::vector Graphs; /// Preliminary singular alignment using classic MI @@ -187,7 +189,7 @@ bool FilterMutualGlobal::applyFilter(QAction *action, MeshDocument &md, const Ri /// Building of the graph of images if (md.rasterList.size()==0) { - Log(0, "You need a Raster Model to apply this filter!"); + log(0, "You need a Raster Model to apply this filter!"); return false; } @@ -205,12 +207,12 @@ bool FilterMutualGlobal::applyFilter(QAction *action, MeshDocument &md, const Ri { Graphs=buildGraph(md); - Log(0, "BuildGraph completed"); + log(0, "BuildGraph completed"); for (int i=0; iglContext->doneCurrent(); - Log(0, "Done!"); + log(0, "Done!"); break; default : assert(0); } - Log(0,"Filter completed in %i sec",(int)((float)filterTime.elapsed()/1000.0f)); + log(0,"Filter completed in %i sec",(int)((float)filterTime.elapsed()/1000.0f)); return true; @@ -264,14 +266,14 @@ float FilterMutualGlobal::calcShotsDifference(MeshDocument &md, std::vectorshot=alignset.shot; @@ -445,11 +447,11 @@ bool FilterMutualGlobal::preAlignment(MeshDocument &md, const RichParameterList md.rasterList[r]->shot.Intrinsics.CenterPx[0]=(int)((float)md.rasterList[r]->shot.Intrinsics.ViewportPx[0]/2.0); md.rasterList[r]->shot.Intrinsics.CenterPx[1]=(int)((float)md.rasterList[r]->shot.Intrinsics.ViewportPx[1]/2.0); - Log(0, "Image %d completed",r); + log(0, "Image %d completed",r); } else - Log(0, "Image %d skipped",r); + log(0, "Image %d skipped",r); } } @@ -462,7 +464,7 @@ std::vector FilterMutualGlobal::buildGraph(MeshDocument &md, bool glob std::vector allArcs; allArcs=CalcPairs(md, globalign); - Log(0, "Calcpairs completed"); + log(0, "Calcpairs completed"); return CreateGraphs(md, allArcs); } @@ -585,12 +587,12 @@ std::vector FilterMutualGlobal::CalcPairs(MeshDocument &md, bool glob } } - Log(0, "Image %d completed",r); + log(0, "Image %d completed",r); if (!globalign) { for (int i=0; i FilterMutualGlobal::CalcPairs(MeshDocument &md, bool glob pair.projId=p; pair.weight=weightList[i].weight; list.push_back(pair); - Log(0, "Area %3.2f, Mutual %3.2f",pair.area,pair.mutual); + log(0, "Area %3.2f, Mutual %3.2f",pair.area,pair.mutual); } } @@ -659,7 +661,7 @@ std::vector FilterMutualGlobal::CalcPairs(MeshDocument &md, bool glob - Log(0, "Tot arcs %d, Valid arcs %d",(md.rasterList.size())*(md.rasterList.size()-1),list.size()); + log(0, "Tot arcs %d, Valid arcs %d",(md.rasterList.size())*(md.rasterList.size()-1),list.size()); //emit md.rasterSetChanged(); @@ -673,7 +675,7 @@ std::vector FilterMutualGlobal::CreateGraphs(MeshDocument &md, std::ve std::vector Gr; SubGraph allNodes; int numNodes=md.rasterList.size(); - Log(0, "Tuttok1"); + log(0, "Tuttok1"); for (int s=0; s FilterMutualGlobal::CreateGraphs(MeshDocument &md, std::ve } int involvedNodes=nod.size(); int totNodes=0; - Log(0, "Tuttok2"); + log(0, "Tuttok2"); while (!done) { for (int i=0; i FilterMutualGlobal::CreateGraphs(MeshDocument &md, std::ve done=true; else totGr++; } - Log(0, "Tuttok3"); + log(0, "Tuttok3"); for (int i=1; i FilterMutualGlobal::CreateGraphs(MeshDocument &md, std::ve graph.id=i; for (int j=0; j FilterMutualGlobal::CreateGraphs(MeshDocument &md, std::ve } std::sort(n.arcs.begin(), n.arcs.end(), ordering()); graph.nodes.push_back(n); - Log(0, "Node %d of %d: avMut %3.2f, arch %d",j,numNodes, n.avMut, n.arcs.size()); + log(0, "Node %d of %d: avMut %3.2f, arch %d",j,numNodes, n.avMut, n.arcs.size()); } else { @@ -784,13 +786,13 @@ std::vector FilterMutualGlobal::CreateGraphs(MeshDocument &md, std::ve n.id=j; n.avMut=0.0; graph.nodes.push_back(n); - Log(0, "Node %d of %d: not used",j,numNodes); + log(0, "Node %d of %d: not used",j,numNodes); } } Gr.push_back(graph); } - Log(0, "Tuttok5"); - Log(0, "Tot nodes %d, SubGraphs %d",numNodes,totGr); + log(0, "Tuttok5"); + log(0, "Tot nodes %d, SubGraphs %d",numNodes,totGr); return Gr; } diff --git a/src/meshlabplugins/filter_mutualglobal/filter_mutualglobal.h b/src/meshlabplugins/filter_mutualglobal/filter_mutualglobal.h index 1e1dd863e..4291ee97c 100644 --- a/src/meshlabplugins/filter_mutualglobal/filter_mutualglobal.h +++ b/src/meshlabplugins/filter_mutualglobal/filter_mutualglobal.h @@ -36,14 +36,14 @@ add sampleplugins #include -#include +#include #include "alignset.h" -class FilterMutualGlobal : public QObject, public MeshFilterInterface +class FilterMutualGlobal : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { FP_IMAGE_GLOBALIGN} ; @@ -54,10 +54,10 @@ public: QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - void initParameterSet(QAction *,MeshDocument & md, RichParameterList & /*parent*/); - bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - int postCondition(QAction*) const { return MeshModel::MM_NONE; }; - FilterClass getClass(QAction *a); + void initParameterList(const QAction*, MeshDocument & md, RichParameterList & /*parent*/); + bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + int postCondition(const QAction*) const { return MeshModel::MM_NONE; }; + FilterClass getClass(const QAction* a) const; QString filterScriptFunctionName(FilterIDType filterID); bool preAlignment(MeshDocument &md, const RichParameterList& par, vcg::CallBackPos *cb); std::vector buildGraph(MeshDocument &md, bool globalign=true); @@ -69,7 +69,7 @@ public: bool allActive(SubGraph graph); bool UpdateGraph(MeshDocument &md, SubGraph graph, int n); float calcShotsDifference(MeshDocument &md, std::vector oldShots, std::vector points); - FILTER_ARITY filterArity(QAction *) const { return SINGLE_MESH; } + FILTER_ARITY filterArity(const QAction *) const { return SINGLE_MESH; } diff --git a/src/meshlabplugins/filter_mutualinfo/filter_mutualinfo.cpp b/src/meshlabplugins/filter_mutualinfo/filter_mutualinfo.cpp index b91cf543b..b59412f0c 100644 --- a/src/meshlabplugins/filter_mutualinfo/filter_mutualinfo.cpp +++ b/src/meshlabplugins/filter_mutualinfo/filter_mutualinfo.cpp @@ -69,23 +69,23 @@ QString FilterMutualInfoPlugin::filterInfo(FilterIDType filterId) const } } -FilterMutualInfoPlugin::FilterClass FilterMutualInfoPlugin::getClass(QAction *a) +FilterMutualInfoPlugin::FilterClass FilterMutualInfoPlugin::getClass(const QAction *a) const { switch(ID(a)) { case FP_IMAGE_MUTUALINFO: - return MeshFilterInterface::Camera; + return FilterPluginInterface::Camera; default : assert(0); - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } } -MeshFilterInterface::FILTER_ARITY FilterMutualInfoPlugin::filterArity(QAction*) const +FilterPluginInterface::FILTER_ARITY FilterMutualInfoPlugin::filterArity(const QAction*) const { return SINGLE_MESH; } -void FilterMutualInfoPlugin::initParameterSet(QAction *action,MeshDocument & /*md*/, RichParameterList & parlst) +void FilterMutualInfoPlugin::initParameterList(const QAction *action,MeshDocument & /*md*/, RichParameterList & parlst) { QStringList rendList; rendList.push_back("Combined"); @@ -110,7 +110,7 @@ void FilterMutualInfoPlugin::initParameterSet(QAction *action,MeshDocument & /*m } } -bool FilterMutualInfoPlugin::applyFilter(QAction *action, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos* ) +bool FilterMutualInfoPlugin::applyFilter(const QAction *action, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos* ) { switch(ID(action)) { case FP_IMAGE_MUTUALINFO : @@ -127,7 +127,7 @@ bool FilterMutualInfoPlugin::applyFilter(QAction *action, MeshDocument &md, cons } } -int FilterMutualInfoPlugin::postCondition(QAction*) const +int FilterMutualInfoPlugin::postCondition(const QAction*) const { return MeshModel::MM_NONE; } @@ -146,12 +146,12 @@ bool FilterMutualInfoPlugin::imageMutualInfoAlign( Solver solver; MutualInfo mutual; if (!shot.IsValid()){ - Log(GLLogStream::FILTER, "Error: shot not valid. Press 'Get Shot' button before applying!"); + log(GLLogStream::FILTER, "Error: shot not valid. Press 'Get Shot' button before applying!"); return false; } if (md.rasterList.size()==0) { - Log(GLLogStream::FILTER, "You need a Raster Model to apply this filter!"); + log(GLLogStream::FILTER, "You need a Raster Model to apply this filter!"); return false; } else { @@ -200,19 +200,19 @@ bool FilterMutualInfoPlugin::imageMutualInfoAlign( ///// Initialize GLContext - Log( "Initialize GL"); + log( "Initialize GL"); align.setGLContext(glContext); glContext->makeCurrent(); if (initGLMutualInfo() == false) return false; - Log( "Done"); + log( "Done"); ///// Mutual info calculation: every 30 iterations, the mail glarea is updated int rounds=(int)(solver.maxiter/30); for (int i=0; i -#include +#include #include "alignset.h" -class FilterMutualInfoPlugin : public QObject, public MeshFilterInterface +class FilterMutualInfoPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: @@ -45,11 +45,11 @@ public: QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - FilterClass getClass(QAction *a); - FILTER_ARITY filterArity(QAction *) const; - void initParameterSet(QAction *, MeshDocument &, RichParameterList & /*parent*/); - bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - int postCondition(QAction*) const; + FilterClass getClass(const QAction* a) const; + FILTER_ARITY filterArity(const QAction*) const; + void initParameterList(const QAction*, MeshDocument &, RichParameterList & /*parent*/); + bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + int postCondition(const QAction*) const; private: AlignSet align; diff --git a/src/meshlabplugins/filter_plymc/filter_plymc.cpp b/src/meshlabplugins/filter_plymc/filter_plymc.cpp index 38a4215b5..f8880a01f 100644 --- a/src/meshlabplugins/filter_plymc/filter_plymc.cpp +++ b/src/meshlabplugins/filter_plymc/filter_plymc.cpp @@ -26,6 +26,7 @@ #include #include #include +#include using namespace vcg; @@ -82,15 +83,15 @@ QString PlyMCPlugin::pluginName() const // The FilterClass describes in which generic class of filters it fits. // This choice affect the submenu in which each filter will be placed // More than a single class can be chosen. - PlyMCPlugin::FilterClass PlyMCPlugin::getClass(QAction *a) + PlyMCPlugin::FilterClass PlyMCPlugin::getClass(const QAction *a) const { switch(ID(a)) { - case FP_PLYMC : return MeshFilterInterface::Remeshing; - case FP_MC_SIMPLIFY : return MeshFilterInterface::Remeshing; + case FP_PLYMC : return FilterPluginInterface::Remeshing; + case FP_MC_SIMPLIFY : return FilterPluginInterface::Remeshing; default : assert(0); } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } // This function define the needed parameters for each filter. Return true if the filter has some parameters @@ -100,7 +101,7 @@ QString PlyMCPlugin::pluginName() const // - the string shown in the dialog // - the default value // - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog) -void PlyMCPlugin::initParameterSet(QAction *action,MeshModel &m, RichParameterList & parlst) +void PlyMCPlugin::initParameterList(const QAction *action,MeshModel &m, RichParameterList & parlst) { switch(ID(action)) { @@ -122,7 +123,7 @@ void PlyMCPlugin::initParameterSet(QAction *action,MeshModel &m, RichParameterLi } // The Real Core Function doing the actual mesh processing. -bool PlyMCPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos * cb) +bool PlyMCPlugin::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos * cb) { switch(ID(filter)) { @@ -134,7 +135,7 @@ bool PlyMCPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParam QTemporaryFile file("./_tmp_XXXXXX.tmp"); if (!file.open()) { - Log("ERROR - current folder is not writable. VCG Merging needs to save intermediate files in the current working folder. Project and meshes must be in a write-enabled folder. Please save your data in a suitable folder before applying."); + log("ERROR - current folder is not writable. VCG Merging needs to save intermediate files in the current working folder. Project and meshes must be in a write-enabled folder. Please save your data in a suitable folder before applying."); errorMessage = "current folder is not writable.
VCG Merging needs to save intermediate files in the current working folder.
Project and meshes must be in a write-enabled folder.
Please save your data in a suitable folder before applying."; return false; } @@ -181,11 +182,11 @@ bool PlyMCPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParam { qDebug("Failed to write vmi temp file %s",qUtf8Printable(mshTmpPath)); errorMessage = "Failed to write vmi temp file " + mshTmpPath; - Log("ERROR - Failed to write vmi temp file %s", qUtf8Printable(mshTmpPath)); + log("ERROR - Failed to write vmi temp file %s", qUtf8Printable(mshTmpPath)); return false; } pmc.MP.AddSingleMesh(qUtf8Printable(mshTmpPath)); - Log("Preprocessing mesh %s",qUtf8Printable(mm->shortName())); + log("Preprocessing mesh %s",qUtf8Printable(mm->shortName())); } } @@ -220,7 +221,7 @@ bool PlyMCPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParam MeshModel &mm=*md.mm(); if (mm.cm.fn == 0) { - Log("Cannot simplify: no faces."); + log("Cannot simplify: no faces."); errorMessage = "Cannot simplify: no faces."; return false; } @@ -228,7 +229,7 @@ bool PlyMCPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParam int res = tri::MCSimplify(mm.cm,0.0f,false); if (res !=1) { - Log("Cannot simplify: this is not a Marching Cube -generated mesh. Mesh should have some of its edges 'straight' along axes."); + log("Cannot simplify: this is not a Marching Cube -generated mesh. Mesh should have some of its edges 'straight' along axes."); errorMessage = "Cannot simplify: this is not a Marching Cube -generated mesh."; mm.clearDataMask(MeshModel::MM_VERTFACETOPO); mm.clearDataMask(MeshModel::MM_FACEFACETOPO); @@ -246,17 +247,17 @@ bool PlyMCPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParam return true; } -MeshFilterInterface::FILTER_ARITY PlyMCPlugin::filterArity( QAction * filter ) const +FilterPluginInterface::FILTER_ARITY PlyMCPlugin::filterArity(const QAction * filter ) const { switch(ID(filter)) { - case FP_PLYMC : return MeshFilterInterface::VARIABLE; - case FP_MC_SIMPLIFY : return MeshFilterInterface::SINGLE_MESH; - default: return MeshFilterInterface::NONE; + case FP_PLYMC : return FilterPluginInterface::VARIABLE; + case FP_MC_SIMPLIFY : return FilterPluginInterface::SINGLE_MESH; + default: return FilterPluginInterface::NONE; } } -int PlyMCPlugin::postCondition(QAction * filter) const +int PlyMCPlugin::postCondition(const QAction * filter) const { switch (ID(filter)) { diff --git a/src/meshlabplugins/filter_plymc/filter_plymc.h b/src/meshlabplugins/filter_plymc/filter_plymc.h index c64f94f94..bf096a19b 100644 --- a/src/meshlabplugins/filter_plymc/filter_plymc.h +++ b/src/meshlabplugins/filter_plymc/filter_plymc.h @@ -24,13 +24,13 @@ #ifndef _FILTER_PLYMC_H_ #define _FILTER_PLYMC_H_ -#include +#include -class PlyMCPlugin : public QObject, public MeshFilterInterface +class PlyMCPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { @@ -43,11 +43,11 @@ public: QString pluginName() const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterList & /*parent*/); - virtual bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - FilterClass getClass(QAction *a); - MeshFilterInterface::FILTER_ARITY filterArity(QAction * filter) const; - int postCondition(QAction *filter) const; + virtual void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); + virtual bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + FilterClass getClass(const QAction* a) const; + FilterPluginInterface::FILTER_ARITY filterArity(const QAction* filter) const; + int postCondition(const QAction *filter) const; }; #endif diff --git a/src/meshlabplugins/filter_qhull/filter_qhull.cpp b/src/meshlabplugins/filter_qhull/filter_qhull.cpp index b5e51fb74..570bcaa57 100644 --- a/src/meshlabplugins/filter_qhull/filter_qhull.cpp +++ b/src/meshlabplugins/filter_qhull/filter_qhull.cpp @@ -112,7 +112,7 @@ QString QhullPlugin::pluginName() const // The FilterClass describes in which generic class of filters it fits. // This choice affect the submenu in which each filter will be placed // More than a single class can be chosen. - QhullPlugin::FilterClass QhullPlugin::getClass(QAction *a) + QhullPlugin::FilterClass QhullPlugin::getClass(const QAction *a) const { switch(ID(a)) { @@ -120,9 +120,9 @@ QString QhullPlugin::pluginName() const case FP_QHULL_DELAUNAY_TRIANGULATION : case FP_QHULL_VORONOI_FILTERING : case FP_QHULL_ALPHA_COMPLEX_AND_SHAPE: - return FilterClass (MeshFilterInterface::Remeshing) ; + return FilterClass (FilterPluginInterface::Remeshing) ; case FP_QHULL_VISIBLE_POINTS: - return FilterClass (MeshFilterInterface::Selection + MeshFilterInterface::PointSet); + return FilterClass (FilterPluginInterface::Selection + FilterPluginInterface::PointSet); default : assert(0); } return FilterClass(0); @@ -135,7 +135,7 @@ QString QhullPlugin::pluginName() const // - the string shown in the dialog // - the default value // - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog) -void QhullPlugin::initParameterSet(QAction *action,MeshModel &m, RichParameterList & parlst) +void QhullPlugin::initParameterList(const QAction *action,MeshModel &m, RichParameterList & parlst) { switch(ID(action)) { case FP_QHULL_CONVEX_HULL : @@ -198,7 +198,7 @@ void QhullPlugin::initParameterSet(QAction *action,MeshModel &m, RichParameterLi } // The Real Core Function doing the actual mesh processing. -bool QhullPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos */* cb*/) +bool QhullPlugin::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos */* cb*/) { switch(ID(filter)) { @@ -272,7 +272,7 @@ bool QhullPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParam } assert(pm.cm.fn == ridgeCount); - Log("Successfully created a mesh of %i vert and %i faces",pm.cm.vn,pm.cm.fn); + log("Successfully created a mesh of %i vert and %i faces",pm.cm.vn,pm.cm.fn); //m.cm.Clear(); //vcg::tri::UpdateBounding::Box(pm.cm); @@ -309,7 +309,7 @@ bool QhullPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParam //vcg::tri::UpdateBounding::Box(pm.cm); //vcg::tri::UpdateNormal::PerVertexNormalizedPerFace(pm.cm); pm.UpdateBoxAndNormals(); - Log("Successfully created a mesh of %i vert and %i faces",pm.cm.vn,pm.cm.fn); + log("Successfully created a mesh of %i vert and %i faces",pm.cm.vn,pm.cm.fn); return true; } @@ -359,8 +359,8 @@ bool QhullPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParam //vcg::tri::UpdateBounding::Box(pm.cm); //vcg::tri::UpdateNormal::PerVertexNormalizedPerFace(pm.cm); pm.UpdateBoxAndNormals(); - Log("Successfully created a mesh of %i vert and %i faces",pm.cm.vn,pm.cm.fn); - Log("Alpha = %f ",alpha); + log("Successfully created a mesh of %i vert and %i faces",pm.cm.vn,pm.cm.fn); + log("Alpha = %f ",alpha); //m.cm.Clear(); return true; @@ -411,7 +411,7 @@ bool QhullPlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParam if(!triangVP) md.delMesh(&pm2); if(result>=0){ - Log("Selected %i visible points", result); + log("Selected %i visible points", result); return true; } else return false; diff --git a/src/meshlabplugins/filter_qhull/filter_qhull.h b/src/meshlabplugins/filter_qhull/filter_qhull.h index 4735cefb2..54c108418 100644 --- a/src/meshlabplugins/filter_qhull/filter_qhull.h +++ b/src/meshlabplugins/filter_qhull/filter_qhull.h @@ -29,13 +29,13 @@ History #define QHULLFILTERSPLUGIN_H #include -#include +#include -class QhullPlugin : public QObject, public MeshFilterInterface +class QhullPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: @@ -58,10 +58,10 @@ public: QString pluginName() const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterList & /*parent*/); - virtual bool applyFilter(QAction *filter, MeshDocument &m, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - virtual FilterClass getClass(QAction *); - FILTER_ARITY filterArity(QAction *) const {return SINGLE_MESH;} + virtual void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); + virtual bool applyFilter(const QAction* filter, MeshDocument &m, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + virtual FilterClass getClass(const QAction*) const; + FILTER_ARITY filterArity(const QAction *) const {return SINGLE_MESH;} }; #endif diff --git a/src/meshlabplugins/filter_quality/filterqualitymapper.cpp b/src/meshlabplugins/filter_quality/filterqualitymapper.cpp index 1dddc456d..4ff1bf471 100644 --- a/src/meshlabplugins/filter_quality/filterqualitymapper.cpp +++ b/src/meshlabplugins/filter_quality/filterqualitymapper.cpp @@ -69,12 +69,12 @@ QString QualityMapperFilter::pluginName() const return QString(""); } - MeshFilterInterface::FilterClass QualityMapperFilter::getClass(QAction *a) + FilterPluginInterface::FilterClass QualityMapperFilter::getClass(const QAction *a) const { switch(ID(a)) { - case FP_QUALITY_MAPPER : return MeshFilterInterface::Quality; - default : assert(0); return MeshFilterInterface::Generic; + case FP_QUALITY_MAPPER : return FilterPluginInterface::Quality; + default : assert(0); return FilterPluginInterface::Generic; } } @@ -86,7 +86,7 @@ QString QualityMapperFilter::pluginName() const // - the string shown in the dialog // - the default value // - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog) -void QualityMapperFilter::initParameterSet(QAction *action,MeshModel &m, RichParameterList & parlst) +void QualityMapperFilter::initParameterList(const QAction *action,MeshModel &m, RichParameterList & parlst) { switch(ID(action)) { case FP_QUALITY_MAPPER : @@ -125,7 +125,7 @@ void QualityMapperFilter::initParameterSet(QAction *action,MeshModel &m, RichPar // The Real Core Function doing the actual mesh processing. // Apply color to mesh vertices -bool QualityMapperFilter::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) +bool QualityMapperFilter::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { MeshModel &m=*(md.mm()); m.updateDataMask(MeshModel::MM_VERTCOLOR); @@ -179,7 +179,7 @@ bool QualityMapperFilter::applyFilter(QAction *filter, MeshDocument &md, const R return true; } -int QualityMapperFilter::getPreConditions( QAction * a) const +int QualityMapperFilter::getPreConditions(const QAction* a) const { switch(ID(a)) { @@ -191,11 +191,11 @@ int QualityMapperFilter::getPreConditions( QAction * a) const } } -int QualityMapperFilter::postCondition( QAction* a) const +int QualityMapperFilter::postCondition(const QAction* a) const { switch(ID(a)) { - case FP_QUALITY_MAPPER : + case FP_QUALITY_MAPPER : return MeshModel::MM_VERTCOLOR; default : assert(0); diff --git a/src/meshlabplugins/filter_quality/filterqualitymapper.h b/src/meshlabplugins/filter_quality/filterqualitymapper.h index 3a05c4a1d..a1b4c6d69 100644 --- a/src/meshlabplugins/filter_quality/filterqualitymapper.h +++ b/src/meshlabplugins/filter_quality/filterqualitymapper.h @@ -32,7 +32,7 @@ FIRST RELEASE #include -#include +#include #include "../edit_quality/common/transferfunction.h" #include // for ComputePerVertexQualityMinMax @@ -55,11 +55,11 @@ public: }; -class QualityMapperFilter : public QObject, public MeshFilterInterface +class QualityMapperFilter : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) private: Frange _meshMinMaxQuality; @@ -72,12 +72,12 @@ public: QString pluginName() const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - int getPreConditions(QAction *) const; - int postCondition( QAction* ) const; - virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterList & /*parent*/); - virtual bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - virtual FilterClass getClass(QAction *); - FILTER_ARITY filterArity(QAction *) const {return SINGLE_MESH;} + int getPreConditions(const QAction *) const; + int postCondition(const QAction* ) const; + virtual void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); + virtual bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + virtual FilterClass getClass(const QAction*) const; + FILTER_ARITY filterArity(const QAction *) const {return SINGLE_MESH;} }; #endif diff --git a/src/meshlabplugins/filter_sample/filter_sample.cpp b/src/meshlabplugins/filter_sample/filter_sample.cpp index a15f31d5f..b2a3fc9f1 100644 --- a/src/meshlabplugins/filter_sample/filter_sample.cpp +++ b/src/meshlabplugins/filter_sample/filter_sample.cpp @@ -83,14 +83,14 @@ QString FilterSamplePlugin::filterName(FilterIDType filterId) const * @param a: the action of the filter * @return the class od the filter */ -FilterSamplePlugin::FilterClass FilterSamplePlugin::getClass(QAction *a) +FilterSamplePlugin::FilterClass FilterSamplePlugin::getClass(const QAction *a) const { switch(ID(a)) { case FP_MOVE_VERTEX : - return MeshFilterInterface::Smoothing; + return FilterPluginInterface::Smoothing; default : assert(0); - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } } @@ -98,7 +98,7 @@ FilterSamplePlugin::FilterClass FilterSamplePlugin::getClass(QAction *a) * @brief FilterSamplePlugin::filterArity * @return */ -MeshFilterInterface::FILTER_ARITY FilterSamplePlugin::filterArity(QAction*) const +FilterPluginInterface::FILTER_ARITY FilterSamplePlugin::filterArity(const QAction*) const { return SINGLE_MESH; } @@ -107,7 +107,7 @@ MeshFilterInterface::FILTER_ARITY FilterSamplePlugin::filterArity(QAction*) cons * @brief FilterSamplePlugin::getPreConditions * @return */ -int FilterSamplePlugin::getPreConditions(QAction*) const +int FilterSamplePlugin::getPreConditions(const QAction*) const { return MeshModel::MM_NONE; } @@ -116,7 +116,7 @@ int FilterSamplePlugin::getPreConditions(QAction*) const * @brief FilterSamplePlugin::postCondition * @return */ -int FilterSamplePlugin::postCondition(QAction*) const +int FilterSamplePlugin::postCondition(const QAction*) const { return MeshModel::MM_VERTCOORD | MeshModel::MM_FACENORMAL | MeshModel::MM_VERTNORMAL; } @@ -133,7 +133,7 @@ int FilterSamplePlugin::postCondition(QAction*) const * @param m * @param parlst */ -void FilterSamplePlugin::initParameterSet(QAction *action,MeshModel &m, RichParameterList & parlst) +void FilterSamplePlugin::initParameterList(const QAction *action,MeshModel &m, RichParameterList & parlst) { switch(ID(action)) { case FP_MOVE_VERTEX : @@ -153,7 +153,7 @@ void FilterSamplePlugin::initParameterSet(QAction *action,MeshModel &m, RichPara * @param cb: callback object to tell MeshLab the percentage of execution of the filter * @return true if the filter has been applied correctly, false otherwise */ -bool FilterSamplePlugin::applyFilter(QAction * action, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) +bool FilterSamplePlugin::applyFilter(const QAction * action, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { switch(ID(action)) { case FP_MOVE_VERTEX : @@ -185,7 +185,7 @@ bool FilterSamplePlugin::vertexDisplacement( } // Log function dump textual info in the lower part of the MeshLab screen. - Log("Successfully displaced %i vertices",m.vn); + log("Successfully displaced %i vertices",m.vn); // to access to the parameters of the filter dialog simply use the getXXXX function of the FilterParameter Class if(updateNormals){ diff --git a/src/meshlabplugins/filter_sample/filter_sample.h b/src/meshlabplugins/filter_sample/filter_sample.h index 930c4390b..a05fce3e6 100644 --- a/src/meshlabplugins/filter_sample/filter_sample.h +++ b/src/meshlabplugins/filter_sample/filter_sample.h @@ -39,13 +39,13 @@ add sampleplugins #ifndef FILTERSAMPLE_PLUGIN_H #define FILTERSAMPLE_PLUGIN_H -#include +#include -class FilterSamplePlugin : public QObject, public MeshFilterInterface +class FilterSamplePlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { FP_MOVE_VERTEX } ; @@ -56,12 +56,12 @@ public: QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - FilterClass getClass(QAction *a); - FILTER_ARITY filterArity(QAction *) const; - int getPreConditions(QAction *) const; - int postCondition( QAction* ) const; - void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterList & /*parent*/); - bool applyFilter(QAction *action, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb); + FilterClass getClass(const QAction* a) const; + FILTER_ARITY filterArity(const QAction*) const; + int getPreConditions(const QAction *) const; + int postCondition(const QAction* ) const; + void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); + bool applyFilter(const QAction* action, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb); private: bool vertexDisplacement( diff --git a/src/meshlabplugins/filter_sample_dyn/filter_sample_dyn.cpp b/src/meshlabplugins/filter_sample_dyn/filter_sample_dyn.cpp index 0ee8157f0..58bfb73cc 100644 --- a/src/meshlabplugins/filter_sample_dyn/filter_sample_dyn.cpp +++ b/src/meshlabplugins/filter_sample_dyn/filter_sample_dyn.cpp @@ -21,7 +21,6 @@ * * ****************************************************************************/ -#include #include #include @@ -72,7 +71,7 @@ QString ExtraSampleDynPlugin::filterName(FilterIDType filterId) const // The FilterClass describes in which generic class of filters it fits. // This choice affect the submenu in which each filter will be placed // In this case this sample belong to the class of filters that change the vertex colors - MeshFilterInterface::FilterClass ExtraSampleDynPlugin::getClass(QAction *) { return MeshFilterInterface::VertexColoring; } + FilterPluginInterface::FilterClass ExtraSampleDynPlugin::getClass(const QAction *) const { return FilterPluginInterface::VertexColoring; } // This function define the needed parameters for each filter. Return true if the filter has some parameters // it is called every time, so you can set the default value of parameters according to the mesh @@ -93,7 +92,7 @@ QString ExtraSampleDynPlugin::filterName(FilterIDType filterId) const // when the user press apply the current stored state is updated. // when the user press close the mesh state is restored to the one before the startup of the filter. -void ExtraSampleDynPlugin::initParameterSet(QAction *action,MeshModel &/*m*/, RichParameterList & parlst) +void ExtraSampleDynPlugin::initParameterList(const QAction *action,MeshModel &/*m*/, RichParameterList & parlst) { switch(ID(action)) { case FP_VERTEX_COLOR_NOISE : @@ -119,7 +118,7 @@ void ExtraSampleDynPlugin::initParameterSet(QAction *action,MeshModel &/*m*/, Ri // The Real Core Function doing the actual mesh processing. // It changes the color of the mesh according to a perlin noise function -bool ExtraSampleDynPlugin::applyFilter(QAction *, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *) +bool ExtraSampleDynPlugin::applyFilter(const QAction *, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *) { MeshModel &m=*(md.mm()); const Color4b baseColor = par.getColor4b("baseColor"); diff --git a/src/meshlabplugins/filter_sample_dyn/filter_sample_dyn.h b/src/meshlabplugins/filter_sample_dyn/filter_sample_dyn.h index 10d68d98e..50cbf3349 100644 --- a/src/meshlabplugins/filter_sample_dyn/filter_sample_dyn.h +++ b/src/meshlabplugins/filter_sample_dyn/filter_sample_dyn.h @@ -26,13 +26,13 @@ #include -#include +#include -class ExtraSampleDynPlugin : public QObject, public MeshFilterInterface +class ExtraSampleDynPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { FP_VERTEX_COLOR_NOISE } ; @@ -42,11 +42,11 @@ public: QString pluginName() const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterList & /*parent*/); - virtual int postCondition( QAction* ) const {return MeshModel::MM_VERTCOLOR;}; - virtual bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - virtual FilterClass getClass(QAction *); - FILTER_ARITY filterArity(QAction *) const {return SINGLE_MESH;} + virtual void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); + virtual int postCondition(const QAction* ) const {return MeshModel::MM_VERTCOLOR;}; + virtual bool applyFilter(const QAction *filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + virtual FilterClass getClass(const QAction*) const; + FILTER_ARITY filterArity(const QAction *) const {return SINGLE_MESH;} }; #endif diff --git a/src/meshlabplugins/filter_sample_gpu/filter_sample_gpu.cpp b/src/meshlabplugins/filter_sample_gpu/filter_sample_gpu.cpp index e65ae1ec1..53b373852 100644 --- a/src/meshlabplugins/filter_sample_gpu/filter_sample_gpu.cpp +++ b/src/meshlabplugins/filter_sample_gpu/filter_sample_gpu.cpp @@ -70,14 +70,14 @@ QString ExtraSampleGPUPlugin::filterName(FilterIDType filterId) const // The FilterClass describes in which generic class of filters it fits. // This choice affect the submenu in which each filter will be placed // More than a single class can be chosen. -ExtraSampleGPUPlugin::FilterClass ExtraSampleGPUPlugin::getClass(QAction *a) +ExtraSampleGPUPlugin::FilterClass ExtraSampleGPUPlugin::getClass(const QAction *a) const { switch(ID(a)) { - case FP_GPU_EXAMPLE: return MeshFilterInterface::RasterLayer; //should be generic, but better avoid it + case FP_GPU_EXAMPLE: return FilterPluginInterface::RasterLayer; //should be generic, but better avoid it default : assert(0); } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } // This function define the needed parameters for each filter. Return true if the filter has some parameters @@ -87,7 +87,7 @@ ExtraSampleGPUPlugin::FilterClass ExtraSampleGPUPlugin::getClass(QAction *a) // - the string shown in the dialog // - the default value // - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog) -void ExtraSampleGPUPlugin::initParameterSet(QAction * action, MeshModel & m, RichParameterList & parlst) +void ExtraSampleGPUPlugin::initParameterList(const QAction * action, MeshModel & m, RichParameterList & parlst) { (void)m; @@ -108,7 +108,7 @@ void ExtraSampleGPUPlugin::initParameterSet(QAction * action, MeshModel & m, Ric // The Real Core Function doing the actual mesh processing. // Move Vertex of a random quantity -bool ExtraSampleGPUPlugin::applyFilter(QAction * a, MeshDocument & md , const RichParameterList & par, vcg::CallBackPos * /*cb*/) +bool ExtraSampleGPUPlugin::applyFilter(const QAction * a, MeshDocument & md , unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos * /*cb*/) { switch(ID(a)) { diff --git a/src/meshlabplugins/filter_sample_gpu/filter_sample_gpu.h b/src/meshlabplugins/filter_sample_gpu/filter_sample_gpu.h index d162d4cde..5921358d9 100644 --- a/src/meshlabplugins/filter_sample_gpu/filter_sample_gpu.h +++ b/src/meshlabplugins/filter_sample_gpu/filter_sample_gpu.h @@ -36,13 +36,13 @@ add sampleplugins #include -#include +#include -class ExtraSampleGPUPlugin : public QObject, public MeshFilterInterface +class ExtraSampleGPUPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { FP_GPU_EXAMPLE } ; @@ -50,13 +50,13 @@ public: ExtraSampleGPUPlugin(); QString pluginName() const; - FILTER_ARITY filterArity(QAction *) const {return SINGLE_MESH;} - void initParameterSet(QAction *action,MeshModel &m, RichParameterList & parlst); + FILTER_ARITY filterArity(const QAction *) const {return SINGLE_MESH;} + void initParameterList(const QAction* action, MeshModel &m, RichParameterList & parlst); QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - FilterClass getClass(QAction *a); + bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + FilterClass getClass(const QAction* a) const; }; diff --git a/src/meshlabplugins/filter_sampling/filter_sampling.cpp b/src/meshlabplugins/filter_sampling/filter_sampling.cpp index ed120f436..b0cc8a438 100644 --- a/src/meshlabplugins/filter_sampling/filter_sampling.cpp +++ b/src/meshlabplugins/filter_sampling/filter_sampling.cpp @@ -40,6 +40,8 @@ $Log: samplefilter.cpp,v $ #include #include +#include + using namespace vcg; using namespace std; @@ -427,7 +429,7 @@ QString FilterDocSampling::filterInfo(FilterIDType filterId) const default : assert(0); return QString("unknown filter!!!!"); } } -int FilterDocSampling::getRequirements(QAction *action) +int FilterDocSampling::getRequirements(const QAction *action) { switch(ID(action)) { @@ -460,7 +462,7 @@ int FilterDocSampling::getRequirements(QAction *action) // - the string shown in the dialog // - the default value // - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog) -void FilterDocSampling::initParameterSet(QAction *action, MeshDocument & md, RichParameterList & parlst) +void FilterDocSampling::initParameterList(const QAction *action, MeshDocument & md, RichParameterList & parlst) { switch(ID(action)) { case FP_MONTECARLO_SAMPLING : @@ -696,7 +698,7 @@ void FilterDocSampling::initParameterSet(QAction *action, MeshDocument & md, Ric } } -bool FilterDocSampling::applyFilter(QAction *action, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) +bool FilterDocSampling::applyFilter(const QAction *action, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { switch(ID(action)) { @@ -704,12 +706,12 @@ switch(ID(action)) { MeshModel *curMM = md.mm(); if (par.getInt("SampleNum") == 0) { - Log("Mesh Element Sampling: Number of Samples is 0, cannot do anything"); + log("Mesh Element Sampling: Number of Samples is 0, cannot do anything"); errorMessage = "Number of Samples is 0, cannot do anything"; return false; // can't continue, mesh can't be processed } if ((par.getEnum("Sampling")>0) && (curMM->cm.fn == 0)) { - Log("Mesh Element Sampling: cannot sample on faces/edges, mesh has no faces"); + log("Mesh Element Sampling: cannot sample on faces/edges, mesh has no faces"); errorMessage = "Mesh Element Sampling: cannot sample on faces/edges, mesh has no faces"; return false; // can't continue, mesh can't be processed } @@ -726,14 +728,14 @@ switch(ID(action)) case 2 : tri::SurfaceSampling::AllFace(curMM->cm,mps); break; } vcg::tri::UpdateBounding::Box(mm->cm); - Log("Mesh Element Sampling created a new mesh of %i points",mm->cm.vn); + log("Mesh Element Sampling created a new mesh of %i points",mm->cm.vn); } break; case FP_TEXEL_SAMPLING : { MeshModel *curMM= md.mm(); if (!tri::HasPerWedgeTexCoord(curMM->cm)) { - Log("Texel Sampling requires a mesh with Per Wedge UV parametrization"); + log("Texel Sampling requires a mesh with Per Wedge UV parametrization"); errorMessage = "Texel Sampling requires a mesh with Per Wedge UV parametrization"; return false; // can't continue, mesh can't be processed } @@ -755,24 +757,24 @@ switch(ID(action)) tri::SurfaceSampling::Texture(curMM->cm,mps,mps.texSamplingWidth,mps.texSamplingHeight); vcg::tri::UpdateBounding::Box(mm->cm); mm->updateDataMask(MeshModel::MM_VERTNORMAL | MeshModel::MM_VERTCOLOR); - Log("Texel Sampling created a new mesh of %i points", mm->cm.vn); + log("Texel Sampling created a new mesh of %i points", mm->cm.vn); } break; case FP_MONTECARLO_SAMPLING : { MeshModel *curMM = md.mm(); if (curMM->cm.fn == 0) { - Log("Montecarlo Sampling requires a mesh with faces, it does not work on Point Clouds"); + log("Montecarlo Sampling requires a mesh with faces, it does not work on Point Clouds"); errorMessage = "Montecarlo Sampling requires a mesh with faces,
it does not work on Point Clouds"; return false; // can't continue, mesh can't be processed } if (par.getInt("SampleNum") == 0) { - Log("Montecarlo Sampling: Number of Samples is 0, cannot do anything"); + log("Montecarlo Sampling: Number of Samples is 0, cannot do anything"); errorMessage = "Number of Samples is 0, cannot do anything"; return false; // can't continue, mesh can't be processed } if (par.getBool("Weighted") && !curMM->hasDataMask(MeshModel::MM_VERTQUALITY)) { - Log("Montecarlo Sampling: cannot do weighted samplimg, layer has no Vertex Quality value"); + log("Montecarlo Sampling: cannot do weighted samplimg, layer has no Vertex Quality value"); errorMessage = "Cannot do weighted samplimg, layer has no Vertex Quality value"; return false; // can't continue, mesh can't be processed } @@ -798,19 +800,19 @@ switch(ID(action)) } vcg::tri::UpdateBounding::Box(mm->cm); - Log("Sampling created a new mesh of %i points", mm->cm.vn); + log("Sampling created a new mesh of %i points", mm->cm.vn); } break; case FP_STRATIFIED_SAMPLING : { MeshModel *curMM = md.mm(); if (curMM->cm.fn == 0) { - Log("Stratified Sampling requires a mesh with faces, it does not work on Point Clouds"); + log("Stratified Sampling requires a mesh with faces, it does not work on Point Clouds"); errorMessage = "Stratified Sampling requires a mesh with faces,
it does not work on Point Clouds"; return false; // can't continue, mesh can't be processed } if (par.getInt("SampleNum") == 0) { - Log("Stratified Sampling: Number of Samples is 0, cannot do anything"); + log("Stratified Sampling: Number of Samples is 0, cannot do anything"); errorMessage = "Number of Samples is 0, cannot do anything"; return false; // can't continue, mesh can't be processed } @@ -823,23 +825,23 @@ switch(ID(action)) { case 0: tri::SurfaceSampling::FaceSimilar(curMM->cm,mps,par.getInt("SampleNum"), false ,par.getBool("Random")); - Log("Similar Sampling created a new mesh of %i points", mm->cm.vn); + log("Similar Sampling created a new mesh of %i points", mm->cm.vn); break; case 1: tri::SurfaceSampling::FaceSimilar(curMM->cm,mps,par.getInt("SampleNum"), true ,par.getBool("Random")); - Log("Dual Similar Sampling created a new mesh of %i points", mm->cm.vn); + log("Dual Similar Sampling created a new mesh of %i points", mm->cm.vn); break; case 2: tri::SurfaceSampling::FaceSubdivision(curMM->cm,mps,par.getInt("SampleNum"), par.getBool("Random")); - Log("Subdivision Sampling created a new mesh of %i points", mm->cm.vn); + log("Subdivision Sampling created a new mesh of %i points", mm->cm.vn); break; case 3: tri::SurfaceSampling::EdgeUniform(curMM->cm,mps,par.getInt("SampleNum"), true); - Log("Edge Sampling created a new mesh of %i points", mm->cm.vn); + log("Edge Sampling created a new mesh of %i points", mm->cm.vn); break; case 4: tri::SurfaceSampling::EdgeUniform(curMM->cm,mps,par.getInt("SampleNum"), false); - Log("Non Faux Edge Sampling created a new mesh of %i points", mm->cm.vn); + log("Non Faux Edge Sampling created a new mesh of %i points", mm->cm.vn); break; } vcg::tri::UpdateBounding::Box(mm->cm); @@ -854,7 +856,7 @@ switch(ID(action)) if (selected && curMM->cm.svn == 0 && curMM->cm.sfn == 0) // if no selection at all, fail { - Log("Clustered Sampling: Cannot apply only on selection: there is no selection"); + log("Clustered Sampling: Cannot apply only on selection: there is no selection"); errorMessage = "Cannot apply only on selection: there is no selection"; return false; } @@ -863,7 +865,7 @@ switch(ID(action)) tri::UpdateSelection::VertexClear(curMM->cm); tri::UpdateSelection::VertexFromFaceStrict(curMM->cm); } - Log("Using only %i selected vertices", curMM->cm.svn); + log("Using only %i selected vertices", curMM->cm.svn); MeshModel *mm= md.addNewMesh("", "Cluster samples", true); // The new mesh is the current one @@ -877,7 +879,7 @@ switch(ID(action)) ClusteringGrid.ExtractPointSet(mm->cm); ClusteringGrid.SelectPointSet(curMM->cm); tri::UpdateSelection::FaceFromVertexLoose(curMM->cm); - Log("Similar Sampling created a new mesh of %i points", mm->cm.vn); + log("Similar Sampling created a new mesh of %i points", mm->cm.vn); } break; case 1 : @@ -888,7 +890,7 @@ switch(ID(action)) ClusteringGrid.SelectPointSet(curMM->cm); tri::UpdateSelection::FaceFromVertexLoose(curMM->cm); ClusteringGrid.ExtractPointSet(mm->cm); - Log("Similar Sampling created a new mesh of %i points", mm->cm.vn); + log("Similar Sampling created a new mesh of %i points", mm->cm.vn); } break; } vcg::tri::UpdateBounding::Box(mm->cm); @@ -901,7 +903,7 @@ switch(ID(action)) int sampleNum = par.getInt("SampleNum"); if ((radius == 0.0) && (sampleNum == 0)){ - Log("Point Cloud Simplification: Number of Samples AND Radius are both 0, cannot do anything"); + log("Point Cloud Simplification: Number of Samples AND Radius are both 0, cannot do anything"); errorMessage = "Number of Samples AND Radius are both 0, cannot do anything"; return false; // can't continue, mesh can't be processed } @@ -921,7 +923,7 @@ switch(ID(action)) else tri::SurfaceSampling::PoissonDiskPruning(mps, curMM->cm, radius,pp); - Log("Point Cloud Simplification created a new mesh of %i points", mm->cm.vn); + log("Point Cloud Simplification created a new mesh of %i points", mm->cm.vn); UpdateBounding::Box(mm->cm); } break; @@ -935,7 +937,7 @@ switch(ID(action)) bool subsampleFlag = par.getBool("Subsample"); if ((radius == 0.0) && (sampleNum == 0)){ - Log("Poisson disk Sampling: Number of Samples AND Radius are both 0, cannot do anything"); + log("Poisson disk Sampling: Number of Samples AND Radius are both 0, cannot do anything"); errorMessage = "Number of Samples AND Radius are both 0, cannot do anything"; return false; // can't continue, mesh can't be processed } @@ -948,17 +950,17 @@ switch(ID(action)) if (pp.radiusVariance != 1.0) { if (!curMM->hasDataMask(MeshModel::MM_VERTQUALITY)) { - Log("Poisson disk Sampling: Variable radius requires per-Vertex quality for biasing the distribution"); + log("Poisson disk Sampling: Variable radius requires per-Vertex quality for biasing the distribution"); errorMessage = "Variable radius requires per-Vertex Quality for biasing the distribution"; return false; // cannot continue } pp.adaptiveRadiusFlag = true; - Log("Variable Density variance is %f, radius can vary from %f to %f", pp.radiusVariance, radius / pp.radiusVariance, radius*pp.radiusVariance); + log("Variable Density variance is %f, radius can vary from %f to %f", pp.radiusVariance, radius / pp.radiusVariance, radius*pp.radiusVariance); } if (curMM->cm.fn == 0 && subsampleFlag == false) { - Log("Poisson disk Sampling: Current mesh has no triangles. We cannot create a montecarlo sampling of the surface. Please select the Subsample flag"); + log("Poisson disk Sampling: Current mesh has no triangles. We cannot create a montecarlo sampling of the surface. Please select the Subsample flag"); errorMessage = "Current mesh has no triangles. We cannot create a montecarlo sampling of the surface.
Please select the Subsample flag"; return false; // cannot continue } @@ -966,7 +968,7 @@ switch(ID(action)) MeshModel *mm= md.addNewMesh("","Poisson-disk Samples", true); // The new mesh is the current one mm->updateDataMask(curMM); - Log("Computing %i Poisson Samples for an expected radius of %f",sampleNum,radius); + log("Computing %i Poisson Samples for an expected radius of %f",sampleNum,radius); // first of all generate montecarlo samples for fast lookup CMeshO *presampledMesh=0; @@ -993,7 +995,7 @@ switch(ID(action)) else tri::SurfaceSampling::Montecarlo(curMM->cm, sampler, sampleNum*par.getInt("MontecarloRate")); presampledMesh->bbox = curMM->cm.bbox; // we want the same bounding box - Log("Generated %i Montecarlo Samples (%i msec)",presampledMesh->vn,tt.elapsed()); + log("Generated %i Montecarlo Samples (%i msec)",presampledMesh->vn,tt.elapsed()); } BaseSampler mps(&(mm->cm)); @@ -1013,8 +1015,8 @@ switch(ID(action)) //tri::SurfaceSampling::PoissonDisk(curMM->cm, mps, *presampledMesh, radius,pp); vcg::tri::UpdateBounding::Box(mm->cm); Point3i &g=pp.pds.gridSize; - Log("Grid size was %i %i %i (%i allocated on %i)",g[0],g[1],g[2], pp.pds.gridCellNum, g[0]*g[1]*g[2]); - Log("Poisson Disk Sampling created a new mesh of %i points", mm->cm.vn); + log("Grid size was %i %i %i (%i allocated on %i)",g[0],g[1],g[2], pp.pds.gridCellNum, g[0]*g[1]*g[2]); + log("Poisson Disk Sampling created a new mesh of %i points", mm->cm.vn); } break; case FP_HAUSDORFF_DISTANCE : @@ -1029,17 +1031,17 @@ switch(ID(action)) float distUpperBound = par.getAbsPerc("MaxDist"); if (mm0 == mm1){ - Log("Hausdorff Distance: cannot compute, it is the same mesh"); + log("Hausdorff Distance: cannot compute, it is the same mesh"); errorMessage = "Cannot compute, it is the same mesh"; return false; // can't continue, mesh can't be processed } if(sampleEdge && mm0->cm.fn==0) { - Log("Disabled edge sampling. Meaningless when sampling point clouds"); + log("Disabled edge sampling. Meaningless when sampling point clouds"); sampleEdge=false; } if(sampleFace && mm0->cm.fn==0) { - Log("Disabled face sampling. Meaningless when sampling point clouds"); + log("Disabled face sampling. Meaningless when sampling point clouds"); sampleFace=false; } @@ -1085,12 +1087,12 @@ switch(ID(action)) if (mm1->cm.Tr != Matrix44m::Identity()) tri::UpdatePosition::Matrix(mm1->cm, Inverse(mm1->cm.Tr), true); - Log("Hausdorff Distance computed"); - Log(" Sampled %i pts (rng: 0) on %s searched closest on %s",hs.n_total_samples,qUtf8Printable(mm0->label()),qUtf8Printable(mm1->label())); - Log(" min : %f max %f mean : %f RMS : %f",hs.getMinDist(),hs.getMaxDist(),hs.getMeanDist(),hs.getRMSDist()); + log("Hausdorff Distance computed"); + log(" Sampled %i pts (rng: 0) on %s searched closest on %s",hs.n_total_samples,qUtf8Printable(mm0->label()),qUtf8Printable(mm1->label())); + log(" min : %f max %f mean : %f RMS : %f",hs.getMinDist(),hs.getMaxDist(),hs.getMeanDist(),hs.getRMSDist()); float d = mm0->cm.bbox.Diag(); - Log("Values w.r.t. BBox Diag (%f)",d); - Log(" min : %f max %f mean : %f RMS : %f\n",hs.getMinDist()/d,hs.getMaxDist()/d,hs.getMeanDist()/d,hs.getRMSDist()/d); + log("Values w.r.t. BBox Diag (%f)",d); + log(" min : %f max %f mean : %f RMS : %f\n",hs.getMinDist()/d,hs.getMaxDist()/d,hs.getMeanDist()/d,hs.getRMSDist()/d); if(saveSampleFlag) @@ -1111,7 +1113,7 @@ switch(ID(action)) float maxDistABS = par.getAbsPerc("MaxDist"); if (mm0 == mm1){ - Log("Distance from Reference: cannot compute, it is the same mesh"); + log("Distance from Reference: cannot compute, it is the same mesh"); errorMessage = "Cannot compute, it is the same mesh"; return false; // can't continue, mesh can't be processed } @@ -1142,9 +1144,9 @@ switch(ID(action)) if (mm1->cm.Tr != Matrix44m::Identity()) tri::UpdatePosition::Matrix(mm1->cm, Inverse(mm1->cm.Tr), true); - Log("Distance from Reference Mesh computed"); - Log(" Sampled %i vertices on %s searched closest on %s", mm0->cm.vn, qUtf8Printable(mm0->label()), qUtf8Printable(mm1->label())); - Log(" min : %f max %f mean : %f RMS : %f", ds.getMaxDist(), ds.getMaxDist(), ds.getMeanDist(), ds.getRMSDist()); + log("Distance from Reference Mesh computed"); + log(" Sampled %i vertices on %s searched closest on %s", mm0->cm.vn, qUtf8Printable(mm0->label()), qUtf8Printable(mm1->label())); + log(" min : %f max %f mean : %f RMS : %f", ds.getMaxDist(), ds.getMaxDist(), ds.getMeanDist(), ds.getRMSDist()); } break; @@ -1162,20 +1164,20 @@ switch(ID(action)) bool distquality = par.getBool("QualityDistance"); if (srcMesh == trgMesh){ - Log("Vertex Attribute Transfer: cannot compute, it is the same mesh"); + log("Vertex Attribute Transfer: cannot compute, it is the same mesh"); errorMessage = "Cannot compute, it is the same mesh"; return false; // can't continue, mesh can't be processed } if (!colorT && !geomT && !qualityT && !normalT && !selectionT) { - Log("Vertex Attribute Transfer: you have to choose at least one attribute to be sampled"); + log("Vertex Attribute Transfer: you have to choose at least one attribute to be sampled"); errorMessage = QString("You have to choose at least one attribute to be sampled"); return false; } if (onlySelected && trgMesh->cm.svn == 0 && trgMesh->cm.sfn == 0) // if no selection at all, fail { - Log("Vertex Attribute Transfer: Cannot apply only on selection: there is no selection"); + log("Vertex Attribute Transfer: Cannot apply only on selection: there is no selection"); errorMessage = "Cannot apply only on selection: there is no selection"; return false; } @@ -1226,7 +1228,7 @@ switch(ID(action)) case FP_UNIFORM_MESH_RESAMPLING : { if (md.mm()->cm.fn==0) { - Log("Uniform Mesh Resampling: requires a mesh with faces, it does not work on Point Clouds"); + log("Uniform Mesh Resampling: requires a mesh with faces, it does not work on Point Clouds"); errorMessage = "Uniform Mesh Resampling requires a mesh with faces,
it does not work on Point Clouds"; return false; // can't continue, mesh can't be processed } @@ -1247,9 +1249,9 @@ switch(ID(action)) volumeBox.Offset(volumeBox.Diag()/10.0f+abs(offsetThr)); BestDim(volumeBox , voxelSize, volumeDim ); - Log("Resampling mesh using a volume of %i x %i x %i",volumeDim[0],volumeDim[1],volumeDim[2]); - Log(" VoxelSize is %f, offset is %f ", voxelSize,offsetThr); - Log(" Mesh Box is %f %f %f",baseMesh->cm.bbox.DimX(),baseMesh->cm.bbox.DimY(),baseMesh->cm.bbox.DimZ() ); + log("Resampling mesh using a volume of %i x %i x %i",volumeDim[0],volumeDim[1],volumeDim[2]); + log(" VoxelSize is %f, offset is %f ", voxelSize,offsetThr); + log(" Mesh Box is %f %f %f",baseMesh->cm.bbox.DimX(),baseMesh->cm.bbox.DimY(),baseMesh->cm.bbox.DimZ() ); tri::Resampler::Resample(baseMesh->cm, offsetMesh->cm, volumeBox, volumeDim, voxelSize*3.5, offsetThr,discretizeFlag,multiSampleFlag,absDistFlag, cb); tri::UpdateBounding::Box(offsetMesh->cm); @@ -1257,7 +1259,7 @@ switch(ID(action)) { float mergeThr =offsetMesh->cm.bbox.Diag()/10000.0f; int total = tri::Clean::MergeCloseVertex(offsetMesh->cm,mergeThr); - Log("Successfully merged %d vertices with a distance lower than %f", total,mergeThr); + log("Successfully merged %d vertices with a distance lower than %f", total,mergeThr); } tri::UpdateNormal::PerVertexPerFace(offsetMesh->cm); } break; @@ -1279,7 +1281,7 @@ switch(ID(action)) vector vecV; // points to vertices of ColoredMesh; tri::VoronoiProcessing::SeedToVertexConversion (mmM->cm, vecP, vecV); - Log("Converted %ui points into %ui vertex ",vecP.size(),vecV.size()); + log("Converted %ui points into %ui vertex ",vecP.size(),vecV.size()); tri::EuclideanDistance edFunc; tri::VoronoiProcessing::ComputePerVertexSources(mmM->cm,vecV,edFunc); @@ -1330,7 +1332,7 @@ switch(ID(action)) case FP_REGULAR_RECURSIVE_SAMPLING : { if (md.mm()->cm.fn==0) { - Log("Regular Recursive Sampling: requires a mesh with faces, it does not work on Point Clouds"); + log("Regular Recursive Sampling: requires a mesh with faces, it does not work on Point Clouds"); errorMessage = "Regular Recursive Sampling requires a mesh with faces,
it does not work on Point Clouds"; return false; // can't continue, mesh can't be processed } @@ -1356,7 +1358,7 @@ switch(ID(action)) return true; } -MeshFilterInterface::FilterClass FilterDocSampling::getClass(QAction *action) +FilterPluginInterface::FilterClass FilterDocSampling::getClass(const QAction *action) const { switch(ID(action)) { @@ -1372,13 +1374,13 @@ MeshFilterInterface::FilterClass FilterDocSampling::getClass(QAction *action) case FP_TEXEL_SAMPLING : return FilterDocSampling::Sampling; case FP_UNIFORM_MESH_RESAMPLING: return FilterDocSampling::Remeshing; case FP_DISK_COLORING: - case FP_VORONOI_COLORING: return MeshFilterInterface::FilterClass(FilterDocSampling::Sampling | FilterDocSampling::VertexColoring); - case FP_POINTCLOUD_SIMPLIFICATION : return MeshFilterInterface::FilterClass(FilterDocSampling::Sampling | FilterDocSampling::PointSet); + case FP_VORONOI_COLORING: return FilterPluginInterface::FilterClass(FilterDocSampling::Sampling | FilterDocSampling::VertexColoring); + case FP_POINTCLOUD_SIMPLIFICATION : return FilterPluginInterface::FilterClass(FilterDocSampling::Sampling | FilterDocSampling::PointSet); default: assert(0); } return FilterClass(0); } -int FilterDocSampling::postCondition( QAction* a ) const +int FilterDocSampling::postCondition(const QAction* a ) const { switch(ID(a)){ case FP_VORONOI_COLORING : @@ -1396,7 +1398,7 @@ int FilterDocSampling::postCondition( QAction* a ) const return MeshModel::MM_ALL; } -MeshFilterInterface::FILTER_ARITY FilterDocSampling::filterArity( QAction * filter ) const +FilterPluginInterface::FILTER_ARITY FilterDocSampling::filterArity(const QAction * filter ) const { switch(ID(filter)) { @@ -1408,15 +1410,15 @@ MeshFilterInterface::FILTER_ARITY FilterDocSampling::filterArity( QAction * filt case FP_REGULAR_RECURSIVE_SAMPLING : case FP_UNIFORM_MESH_RESAMPLING: case FP_POINTCLOUD_SIMPLIFICATION : - return MeshFilterInterface::SINGLE_MESH; + return FilterPluginInterface::SINGLE_MESH; case FP_DISTANCE_REFERENCE : case FP_HAUSDORFF_DISTANCE : case FP_POISSONDISK_SAMPLING : case FP_DISK_COLORING : case FP_VORONOI_COLORING : - return MeshFilterInterface::FIXED; + return FilterPluginInterface::FIXED; } - return MeshFilterInterface::NONE; + return FilterPluginInterface::NONE; } MESHLAB_PLUGIN_NAME_EXPORTER(FilterDocSampling) diff --git a/src/meshlabplugins/filter_sampling/filter_sampling.h b/src/meshlabplugins/filter_sampling/filter_sampling.h index 399194808..524eddee7 100644 --- a/src/meshlabplugins/filter_sampling/filter_sampling.h +++ b/src/meshlabplugins/filter_sampling/filter_sampling.h @@ -23,13 +23,13 @@ #ifndef FILTERDOCSAMPLINGPLUGIN_H #define FILTERDOCSAMPLINGPLUGIN_H -#include +#include -class FilterDocSampling : public QObject, public MeshFilterInterface +class FilterDocSampling : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { @@ -54,12 +54,12 @@ class FilterDocSampling : public QObject, public MeshFilterInterface QString pluginName() const; QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterList & /*parent*/); - bool applyFilter(QAction *filter, MeshDocument &m, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - int getRequirements(QAction *action); - int postCondition( QAction* ) const; - FilterClass getClass(QAction *); - FILTER_ARITY filterArity(QAction * filter) const; + void initParameterList(const QAction*, MeshDocument &/*m*/, RichParameterList & /*parent*/); + bool applyFilter(const QAction* filter, MeshDocument &m, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + int getRequirements(const QAction* action); + int postCondition(const QAction* ) const; + FilterClass getClass(const QAction*) const; + FILTER_ARITY filterArity(const QAction* filter) const; }; #endif diff --git a/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp b/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp index 0063ea1cc..f2b68a06e 100644 --- a/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp +++ b/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp @@ -26,6 +26,10 @@ #include #endif +#include +#include +#include + #include "filter_screened_poisson.h" #include "poisson_utils.h" @@ -77,18 +81,18 @@ QString FilterScreenedPoissonPlugin::filterInfo(FilterIDType filter) const } } -MeshFilterInterface::FilterClass FilterScreenedPoissonPlugin::getClass(QAction* a) +FilterPluginInterface::FilterClass FilterScreenedPoissonPlugin::getClass(const QAction* a) const { if (ID(a) == FP_SCREENED_POISSON){ - return FilterScreenedPoissonPlugin::FilterClass(MeshFilterInterface::Remeshing); + return FilterScreenedPoissonPlugin::FilterClass(FilterPluginInterface::Remeshing); } else { assert(0); - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } } -int FilterScreenedPoissonPlugin::getRequirements(QAction* a) +int FilterScreenedPoissonPlugin::getRequirements(const QAction* a) { if (ID(a) == FP_SCREENED_POISSON) { return MeshModel::MM_NONE; @@ -99,7 +103,12 @@ int FilterScreenedPoissonPlugin::getRequirements(QAction* a) } } -bool FilterScreenedPoissonPlugin::applyFilter(QAction* filter, MeshDocument& md, const RichParameterList& params, vcg::CallBackPos* cb) +bool FilterScreenedPoissonPlugin::applyFilter( + const QAction* filter, + MeshDocument& md, + unsigned int& /*postConditionMask*/, + const RichParameterList& params, + vcg::CallBackPos* cb) { bool currDirChanged=false; QDir currDir = QDir::current(); @@ -109,11 +118,11 @@ bool FilterScreenedPoissonPlugin::applyFilter(QAction* filter, MeshDocument& md, QTemporaryDir tmpdir; QTemporaryFile file(tmpdir.path()); if (!file.open()) { //if a file cannot be created in the tmp folder - Log("Warning - tmp folder is not writable."); + log("Warning - tmp folder is not writable."); QTemporaryFile file2("./_tmp_XXXXXX.tmp"); //try to create a file in the meshlab folder if (!file2.open()){ //if a file cannot be created in the tmp and in the meshlab folder, we cannot run the filter - Log("Warning - current folder is not writable. Screened Poisson Merging needs to save intermediate files in the tmp working folder. Project and meshes must be in a write-enabled folder. Please save your data in a suitable folder before applying."); + log("Warning - current folder is not writable. Screened Poisson Merging needs to save intermediate files in the tmp working folder. Project and meshes must be in a write-enabled folder. Please save your data in a suitable folder before applying."); errorMessage = "current and tmp folder are not writable.
Screened Poisson Merging needs to save intermediate files in the current working folder.
Project and meshes must be in a write-enabled folder.
Please save your data in a suitable folder before applying."; return false; } @@ -193,8 +202,8 @@ bool FilterScreenedPoissonPlugin::applyFilter(QAction* filter, MeshDocument& md, return false; } -void FilterScreenedPoissonPlugin::initParameterSet( - QAction* filter, +void FilterScreenedPoissonPlugin::initParameterList( + const QAction* filter, MeshModel&, RichParameterList& parlist) { @@ -212,7 +221,7 @@ void FilterScreenedPoissonPlugin::initParameterSet( } } -int FilterScreenedPoissonPlugin::postCondition(QAction* filter) const +int FilterScreenedPoissonPlugin::postCondition(const QAction* filter) const { if (ID(filter) == FP_SCREENED_POISSON){ return MeshModel::MM_VERTNUMBER + MeshModel::MM_FACENUMBER; @@ -223,7 +232,7 @@ int FilterScreenedPoissonPlugin::postCondition(QAction* filter) const } -MeshFilterInterface::FILTER_ARITY FilterScreenedPoissonPlugin::filterArity(QAction*) const +FilterPluginInterface::FILTER_ARITY FilterScreenedPoissonPlugin::filterArity(const QAction*) const { return VARIABLE; } diff --git a/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.h b/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.h index 374a23aaf..ba5abd401 100644 --- a/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.h +++ b/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.h @@ -24,13 +24,13 @@ #ifndef SAMPLEFILTERSPLUGIN_H #define SAMPLEFILTERSPLUGIN_H -#include +#include -class FilterScreenedPoissonPlugin : public QObject, public MeshFilterInterface +class FilterScreenedPoissonPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { @@ -44,18 +44,19 @@ public: QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - FilterClass getClass(QAction* a); - int getRequirements(QAction* a); + FilterClass getClass(const QAction* a) const; + int getRequirements(const QAction* a); bool applyFilter( - QAction* filter, + const QAction* filter, MeshDocument& md, + unsigned int& postConditionMask, const RichParameterList& params, vcg::CallBackPos* cb) ; - void initParameterSet(QAction* a, MeshModel&, RichParameterList& parlist); - int postCondition(QAction* filter) const; - FILTER_ARITY filterArity(QAction*) const; + void initParameterList(const QAction* a, MeshModel&, RichParameterList& parlist); + int postCondition(const QAction* filter) const; + FILTER_ARITY filterArity(const QAction*) const; }; diff --git a/src/meshlabplugins/filter_sdfgpu/filter_sdfgpu.cpp b/src/meshlabplugins/filter_sdfgpu/filter_sdfgpu.cpp index faaa1480f..85c3eaa42 100644 --- a/src/meshlabplugins/filter_sdfgpu/filter_sdfgpu.cpp +++ b/src/meshlabplugins/filter_sdfgpu/filter_sdfgpu.cpp @@ -39,7 +39,7 @@ QString SdfGpuPlugin::pluginName() const return "FilterSDFGPU"; } -void SdfGpuPlugin::initParameterSet(QAction *action, MeshModel &/*m*/, RichParameterList &par) +void SdfGpuPlugin::initParameterList(const QAction *action, MeshModel &/*m*/, RichParameterList &par) { mAction = ID(action); QStringList onPrimitive; onPrimitive.push_back("On vertices"); onPrimitive.push_back("On Faces"); @@ -143,7 +143,7 @@ QString SdfGpuPlugin::filterInfo(FilterIDType filterId) const return QString(""); } -bool SdfGpuPlugin::applyFilter(QAction */*filter*/, MeshDocument &md, const RichParameterList & pars, vcg::CallBackPos *cb) +bool SdfGpuPlugin::applyFilter(const QAction */*filter*/, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & pars, vcg::CallBackPos *cb) { MeshModel* mm = md.mm(); @@ -184,8 +184,8 @@ bool SdfGpuPlugin::applyFilter(QAction */*filter*/, MeshDocument &md, const Rich std::vector unifDirVec; GenNormal::Fibonacci(numViews,unifDirVec); - Log(GLLogStream::SYSTEM, "Number of rays: %i ", unifDirVec.size() ); - Log(GLLogStream::SYSTEM, "Number of rays for GPU outliers removal: %i ", coneDirVec.size() ); + log(GLLogStream::SYSTEM, "Number of rays: %i ", unifDirVec.size() ); + log(GLLogStream::SYSTEM, "Number of rays for GPU outliers removal: %i ", coneDirVec.size() ); coneDirVec.clear(); @@ -226,14 +226,14 @@ bool SdfGpuPlugin::applyFilter(QAction */*filter*/, MeshDocument &md, const Rich - Log(GLLogStream::SYSTEM, "Mesh depth complexity %i (The accuracy of the result depends on the value you provided for the max number of peeling iterations, \n if you get warnings try increasing" + log(GLLogStream::SYSTEM, "Mesh depth complexity %i (The accuracy of the result depends on the value you provided for the max number of peeling iterations, \n if you get warnings try increasing" " the peeling iteration parameter)\n", mDepthComplexity ); //Depth complexity distribution log. Useful to know which is the probability to find a number of layers looking at the mesh or scene. - Log(GLLogStream::SYSTEM, "Depth complexity NumberOfViews\n", mDepthComplexity ); + log(GLLogStream::SYSTEM, "Depth complexity NumberOfViews\n", mDepthComplexity ); for(int j = 0; j < peel; j++) { - Log(GLLogStream::SYSTEM, " %i %i\n", j, mDepthDistrib[j] ); + log(GLLogStream::SYSTEM, " %i %i\n", j, mDepthDistrib[j] ); } //Clean & Exit @@ -270,7 +270,7 @@ bool SdfGpuPlugin::initGL(MeshModel& mm) if (!GLExtensionsManager::initializeGLextensions_notThrowing()) { - Log(GLLogStream::SYSTEM, "Error initializing OpenGL extensions."); + log(GLLogStream::SYSTEM, "Error initializing OpenGL extensions."); return false; } @@ -279,13 +279,13 @@ bool SdfGpuPlugin::initGL(MeshModel& mm) { if (!glewIsSupported("GL_EXT_vertex_shader GL_EXT_fragment_shader")) { - Log(GLLogStream::SYSTEM, "Your hardware doesn't support Shaders, which are required for hw occlusion"); + log(GLLogStream::SYSTEM, "Your hardware doesn't support Shaders, which are required for hw occlusion"); return false; } } if ( !glewIsSupported("GL_EXT_framebuffer_object") ) { - Log(GLLogStream::SYSTEM, "Your hardware doesn't support FBOs, which are required for hw occlusion"); + log(GLLogStream::SYSTEM, "Your hardware doesn't support FBOs, which are required for hw occlusion"); return false; } @@ -293,13 +293,13 @@ bool SdfGpuPlugin::initGL(MeshModel& mm) { if ( !glewIsSupported("GL_EXT_gpu_shader4") ) //Only DX10-grade cards support FP32 blending { - Log(GLLogStream::SYSTEM,"Your hardware can't do FP32 blending, and currently the FP16 version is not yet implemented."); + log(GLLogStream::SYSTEM,"Your hardware can't do FP32 blending, and currently the FP16 version is not yet implemented."); return false; } } else { - Log(GLLogStream::SYSTEM,"Your hardware doesn't support floating point textures, which are required for hw occlusion"); + log(GLLogStream::SYSTEM,"Your hardware doesn't support floating point textures, which are required for hw occlusion"); return false; } @@ -318,12 +318,12 @@ bool SdfGpuPlugin::initGL(MeshModel& mm) unsigned int maxTexSize; glGetIntegerv(GL_MAX_TEXTURE_SIZE, reinterpret_cast(&maxTexSize) ); - Log(GLLogStream::SYSTEM, "QUERY HARDWARE FOR: MAX TEX SIZE: %i ", maxTexSize ); + log(GLLogStream::SYSTEM, "QUERY HARDWARE FOR: MAX TEX SIZE: %i ", maxTexSize ); //CHECK MODEL SIZE if ((maxTexSize*maxTexSize) < numElems) { - Log(GLLogStream::SYSTEM, "That's a really huge model, I can't handle it in hardware, sorry.."); + log(GLLogStream::SYSTEM, "That's a really huge model, I can't handle it in hardware, sorry.."); return false; } @@ -331,10 +331,10 @@ bool SdfGpuPlugin::initGL(MeshModel& mm) mNumberOfTexRows = ceil( ((float)numElems) / ((float)mResTextureDim)); - Log(GLLogStream::SYSTEM, "Mesh has %i vertices\n", numVertices ); - Log(GLLogStream::SYSTEM, "Mesh has %i faces\n", numFaces); - Log(GLLogStream::SYSTEM, "Number of tex rows used %i",mNumberOfTexRows); - Log(GLLogStream::SYSTEM, "Result texture is %i X %i = %i", mResTextureDim, mResTextureDim, mResTextureDim*mResTextureDim); + log(GLLogStream::SYSTEM, "Mesh has %i vertices\n", numVertices ); + log(GLLogStream::SYSTEM, "Mesh has %i faces\n", numFaces); + log(GLLogStream::SYSTEM, "Number of tex rows used %i",mNumberOfTexRows); + log(GLLogStream::SYSTEM, "Result texture is %i X %i = %i", mResTextureDim, mResTextureDim, mResTextureDim*mResTextureDim); mVertexCoordsTexture = new FloatTexture2D( TextureFormat( GL_TEXTURE_2D, mResTextureDim, mResTextureDim, GL_RGBA32F_ARB, GL_RGBA, GL_FLOAT ), TextureParams( GL_NEAREST, GL_NEAREST ) ); mVertexNormalsTexture = new FloatTexture2D( TextureFormat( GL_TEXTURE_2D, mResTextureDim, mResTextureDim, GL_RGBA32F_ARB, GL_RGBA, GL_FLOAT ), TextureParams( GL_NEAREST, GL_NEAREST ) ); @@ -564,7 +564,7 @@ void SdfGpuPlugin::setupMesh(MeshDocument& md, ONPRIMITIVE onPrimitive ) { int dup = tri::Clean::RemoveDuplicateVertex(m); int unref = tri::Clean::RemoveUnreferencedVertex(m); - if (dup > 0 || unref > 0) Log("Removed %i duplicate and %i unreferenced vertices\n",dup,unref); + if (dup > 0 || unref > 0) log("Removed %i duplicate and %i unreferenced vertices\n",dup,unref); } //Updating mesh metadata @@ -1041,7 +1041,7 @@ void SdfGpuPlugin::TraceRay(int peelingIteration,const Point3f& dir, MeshModel* return; else if(i==(peelingIteration-1)) - Log(GLLogStream::SYSTEM,"WARNING: You may have underestimated the depth complexity of the mesh. Run the filter with a higher number of peeling iteration."); + log(GLLogStream::SYSTEM,"WARNING: You may have underestimated the depth complexity of the mesh. Run the filter with a higher number of peeling iteration."); mFboArray[j]->unbind(); //we use 3 FBOs to avoid z-fighting (Inspired from Woo's shadow mapping method) @@ -1095,9 +1095,9 @@ void SdfGpuPlugin::TraceRay(int peelingIteration,const Point3f& dir, MeshModel* checkGLError::debugInfo("Error during depth peeling"); } -MeshFilterInterface::FILTER_ARITY SdfGpuPlugin::filterArity( QAction *) const +FilterPluginInterface::FILTER_ARITY SdfGpuPlugin::filterArity(const QAction *) const { - return MeshFilterInterface::SINGLE_MESH; + return FilterPluginInterface::SINGLE_MESH; } MESHLAB_PLUGIN_NAME_EXPORTER(SdfGpuPlugin) diff --git a/src/meshlabplugins/filter_sdfgpu/filter_sdfgpu.h b/src/meshlabplugins/filter_sdfgpu/filter_sdfgpu.h index 17be5e04c..bf67c8afe 100644 --- a/src/meshlabplugins/filter_sdfgpu/filter_sdfgpu.h +++ b/src/meshlabplugins/filter_sdfgpu/filter_sdfgpu.h @@ -3,7 +3,7 @@ #include -#include +#include #include #include @@ -11,11 +11,11 @@ enum ONPRIMITIVE{ON_VERTICES=0, ON_FACES=1}; -class SdfGpuPlugin : public QObject, public MeshFilterInterface +class SdfGpuPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: @@ -29,18 +29,18 @@ public: QString filterInfo(FilterIDType filterId) const; - FilterClass getClass(QAction *) + FilterClass getClass(const QAction *) const { - return MeshFilterInterface::VertexColoring; + return FilterPluginInterface::VertexColoring; } - FILTER_ARITY filterArity(QAction *act) const; + FILTER_ARITY filterArity(const QAction* act) const; //Main plugin function - bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb); + bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & par, vcg::CallBackPos *cb); //Parameters init for user interface - virtual void initParameterSet(QAction *action, MeshModel &m, RichParameterList &parlst); + virtual void initParameterList(const QAction* action, MeshModel &m, RichParameterList &parlst); //Draw the mesh void fillFrameBuffer(bool front, MeshModel* mm); diff --git a/src/meshlabplugins/filter_sdfgpu/filterinterface.h b/src/meshlabplugins/filter_sdfgpu/filterinterface.h index 4b1e2eeb0..8b449e671 100644 --- a/src/meshlabplugins/filter_sdfgpu/filterinterface.h +++ b/src/meshlabplugins/filter_sdfgpu/filterinterface.h @@ -1,6 +1,8 @@ #ifndef SINGLEMESHFILTERINTERFACE_H #define SINGLEMESHFILTERINTERFACE_H -#include "common/interfaces.h" +#include "common/interfaces/filter_plugin_interface.h" + +#include /** * @brief The interface for a filter plugin which defines a *single* action @@ -36,7 +38,7 @@ * Q_EXPORT_PLUGIN(SdfPlugin) * \endcode */ -class SingleMeshFilterInterface : public QObject, public MeshFilterInterface{ +class SingleMeshFilterInterface : public QObject, public FilterPluginInterface{ public: /** @@ -79,8 +81,8 @@ public: * by meshlab to determine in which filter sub-menu-entry insert this filter. The default value adds the * plugin to the bottom of the list. */ - virtual FilterClass getClass(){ - return MeshFilterInterface::Generic; + virtual FilterClass getClass() const{ + return FilterPluginInterface::Generic; } /** @@ -91,7 +93,7 @@ public: * parameter set according to your mesh document (data dependent parameters). A GUI will be * automatically designed according to this parameters. */ - virtual void initParameterSet(MeshDocument &, RichParameterList &){ qDebug() << "HERE2!"; } + virtual void initParameterList(MeshDocument &, RichParameterList &){ qDebug() << "HERE2!"; } /** * @brief The implementation of the filter algorithm @@ -139,25 +141,25 @@ private: QString filterInfo(FilterIDType ) const{ return filterInfo(); } - FilterClass getClass(QAction *){ + FilterClass getClass(const QAction *) const{ return getClass(); } // NOTE: Paolo informed that this will be killed sooner or later. // any behavior defined therein should be moved to getPostConditions() - int getRequirements(QAction* ){ + int getRequirements(const QAction* ){ return postConditions(); } - int getPreConditions(QAction* ) const{ + int getPreConditions(const QAction* ) const{ return getPreConditions(); } - int postCondition() const{ + int postCondition(const QAction*) const{ return MeshModel::MM_NONE; } - bool applyFilter(QAction *, MeshDocument &md, const RichParameterList& par, vcg::CallBackPos * cb){ + bool applyFilter(const QAction *, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList& par, vcg::CallBackPos * cb){ return applyFilter(md, par, cb); } - virtual void initParameterSet(QAction *, MeshDocument &md, RichParameterList &par){ - initParameterSet(md,par); + virtual void initParameterList(const QAction *, MeshDocument &md, RichParameterList &par){ + initParameterList(md,par); } }; diff --git a/src/meshlabplugins/filter_select/meshselect.cpp b/src/meshlabplugins/filter_select/meshselect.cpp index 03419da69..fd754291d 100644 --- a/src/meshlabplugins/filter_select/meshselect.cpp +++ b/src/meshlabplugins/filter_select/meshselect.cpp @@ -29,6 +29,8 @@ #include #include +#include + using namespace vcg; // ERROR CHECKING UTILITY @@ -189,7 +191,7 @@ QString SelectionFilterPlugin::filterInfo(FilterIDType filterId) const return QString("Unknown filter"); } -void SelectionFilterPlugin::initParameterSet(QAction *action, MeshModel &m, RichParameterList &parlst) +void SelectionFilterPlugin::initParameterList(const QAction *action, MeshModel &m, RichParameterList &parlst) { switch(ID(action)) { @@ -301,7 +303,7 @@ void SelectionFilterPlugin::initParameterSet(QAction *action, MeshModel &m, Rich } } -bool SelectionFilterPlugin::applyFilter(QAction *action, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos * /*cb*/) +bool SelectionFilterPlugin::applyFilter(const QAction *action, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos * /*cb*/) { if (md.mm() == NULL) return false; @@ -314,7 +316,7 @@ bool SelectionFilterPlugin::applyFilter(QAction *action, MeshDocument &md, const { case FP_SELECT_DELETE_VERT: { - if (m.cm.svn == 0) { Log("Nothing done: no vertex selected"); break; } + if (m.cm.svn == 0) { log("Nothing done: no vertex selected"); break; } tri::UpdateSelection::FaceClear(m.cm); tri::UpdateSelection::FaceFromVertexLoose(m.cm); int vvn = m.cm.vn; @@ -328,7 +330,7 @@ bool SelectionFilterPlugin::applyFilter(QAction *action, MeshDocument &md, const m.clearDataMask(MeshModel::MM_FACEFACETOPO); m.clearDataMask(MeshModel::MM_VERTFACETOPO); m.UpdateBoxAndNormals(); - Log("Deleted %i vertices, %i faces.", vvn - m.cm.vn, ffn - m.cm.fn); + log("Deleted %i vertices, %i faces.", vvn - m.cm.vn, ffn - m.cm.fn); } break; case FP_SELECT_DELETE_ALL_FACE: @@ -345,7 +347,7 @@ bool SelectionFilterPlugin::applyFilter(QAction *action, MeshDocument &md, const ml->clearDataMask(MeshModel::MM_FACEFACETOPO); ml->clearDataMask(MeshModel::MM_VERTFACETOPO); ml->UpdateBoxAndNormals(); - Log("Layer %i: deleted all %i faces.", ml->id(), ffn - ml->cm.fn); + log("Layer %i: deleted all %i faces.", ml->id(), ffn - ml->cm.fn); } } else @@ -357,13 +359,13 @@ bool SelectionFilterPlugin::applyFilter(QAction *action, MeshDocument &md, const m.clearDataMask(MeshModel::MM_FACEFACETOPO); m.clearDataMask(MeshModel::MM_VERTFACETOPO); m.UpdateBoxAndNormals(); - Log("Deleted all %i faces.", ffn - m.cm.fn); + log("Deleted all %i faces.", ffn - m.cm.fn); } } break; case FP_SELECT_DELETE_FACE: { - if (m.cm.sfn == 0) { Log("Nothing done: no faces selected"); break; } + if (m.cm.sfn == 0) { log("Nothing done: no faces selected"); break; } int ffn = m.cm.fn; for (fi = m.cm.face.begin(); fi != m.cm.face.end(); ++fi) if (!(*fi).IsD() && (*fi).IsS()) @@ -371,12 +373,12 @@ bool SelectionFilterPlugin::applyFilter(QAction *action, MeshDocument &md, const m.clearDataMask(MeshModel::MM_FACEFACETOPO); m.clearDataMask(MeshModel::MM_VERTFACETOPO); m.UpdateBoxAndNormals(); - Log("Deleted %i faces.", ffn - m.cm.fn); + log("Deleted %i faces.", ffn - m.cm.fn); } break; case FP_SELECT_DELETE_FACEVERT: { - if (m.cm.sfn == 0) { Log("Nothing done: no faces selected"); break; } + if (m.cm.sfn == 0) { log("Nothing done: no faces selected"); break; } tri::UpdateSelection::VertexClear(m.cm); tri::UpdateSelection::VertexFromFaceStrict(m.cm); int vvn = m.cm.vn; @@ -390,7 +392,7 @@ bool SelectionFilterPlugin::applyFilter(QAction *action, MeshDocument &md, const m.clearDataMask(MeshModel::MM_FACEFACETOPO); m.clearDataMask(MeshModel::MM_VERTFACETOPO); m.UpdateBoxAndNormals(); - Log("Deleted %i faces, %i vertices.", ffn - m.cm.fn, vvn - m.cm.vn); + log("Deleted %i faces, %i vertices.", ffn - m.cm.fn, vvn - m.cm.vn); } break; case FP_SELECT_CONNECTED: @@ -623,7 +625,7 @@ bool SelectionFilterPlugin::applyFilter(QAction *action, MeshDocument &md, const { float threshold = par.getDynamicFloat("Threshold"); int selFaceNum = tri::UpdateSelection::FaceOutOfRangeEdge(m.cm,0,threshold ); - Log( "Selected %d faces with and edge longer than %f",selFaceNum,threshold); + log( "Selected %d faces with and edge longer than %f",selFaceNum,threshold); } break; case FP_SELECT_FOLD_FACE: @@ -641,7 +643,7 @@ bool SelectionFilterPlugin::applyFilter(QAction *action, MeshDocument &md, const VertexConstDataWrapper wrapper(m.cm); KdTree kdTree(wrapper); int selVertexNum = tri::OutlierRemoval::SelectLoOPOutliers(m.cm, kdTree, kNearest, threshold); - Log("Selected %d outlier vertices", selVertexNum); + log("Selected %d outlier vertices", selVertexNum); } break; default: assert(0); @@ -649,18 +651,18 @@ bool SelectionFilterPlugin::applyFilter(QAction *action, MeshDocument &md, const return true; } -MeshFilterInterface::FilterClass SelectionFilterPlugin::getClass(QAction *action) +FilterPluginInterface::FilterClass SelectionFilterPlugin::getClass(const QAction *action) const { switch(ID(action)) { - case CP_SELFINTERSECT_SELECT: return FilterClass(MeshFilterInterface::Selection + MeshFilterInterface::Cleaning); + case CP_SELFINTERSECT_SELECT: return FilterClass(FilterPluginInterface::Selection + FilterPluginInterface::Cleaning); - case CP_SELECT_TEXBORDER : return FilterClass(MeshFilterInterface::Selection + MeshFilterInterface::Texture); + case CP_SELECT_TEXBORDER : return FilterClass(FilterPluginInterface::Selection + FilterPluginInterface::Texture); case FP_SELECT_BY_FACE_QUALITY : - case FP_SELECT_BY_VERT_QUALITY : return FilterClass(MeshFilterInterface::Selection + MeshFilterInterface::Quality); + case FP_SELECT_BY_VERT_QUALITY : return FilterClass(FilterPluginInterface::Selection + FilterPluginInterface::Quality); - case FP_SELECTBYANGLE : return MeshFilterInterface::FilterClass(MeshFilterInterface::RangeMap + MeshFilterInterface::Selection); + case FP_SELECTBYANGLE : return FilterPluginInterface::FilterClass(FilterPluginInterface::RangeMap + FilterPluginInterface::Selection); case FP_SELECT_ALL : case FP_SELECT_NONE : @@ -681,12 +683,12 @@ MeshFilterInterface::FilterClass SelectionFilterPlugin::getClass(QAction *action case FP_SELECT_OUTLIER: case FP_SELECT_BY_COLOR: case CP_SELECT_NON_MANIFOLD_VERTEX: - case CP_SELECT_NON_MANIFOLD_FACE: return FilterClass(MeshFilterInterface::Selection); + case CP_SELECT_NON_MANIFOLD_FACE: return FilterClass(FilterPluginInterface::Selection); } - return MeshFilterInterface::Selection; + return FilterPluginInterface::Selection; } - int SelectionFilterPlugin::getRequirements(QAction *action) + int SelectionFilterPlugin::getRequirements(const QAction *action) { switch(ID(action)) { @@ -703,7 +705,7 @@ MeshFilterInterface::FilterClass SelectionFilterPlugin::getClass(QAction *action } } -int SelectionFilterPlugin::postCondition(QAction *action) const +int SelectionFilterPlugin::postCondition(const QAction *action) const { switch(ID(action)) { @@ -735,7 +737,7 @@ int SelectionFilterPlugin::postCondition(QAction *action) const return MeshModel::MM_ALL; } -int SelectionFilterPlugin::getPreConditions( QAction * action) const +int SelectionFilterPlugin::getPreConditions(const QAction * action) const { switch(ID(action)) { diff --git a/src/meshlabplugins/filter_select/meshselect.h b/src/meshlabplugins/filter_select/meshselect.h index db6c78157..b8b157961 100644 --- a/src/meshlabplugins/filter_select/meshselect.h +++ b/src/meshlabplugins/filter_select/meshselect.h @@ -25,14 +25,14 @@ #define FILTER_SELECT_H #include -#include +#include -class SelectionFilterPlugin : public QObject, public MeshFilterInterface +class SelectionFilterPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: /* naming convention : @@ -73,13 +73,13 @@ class SelectionFilterPlugin : public QObject, public MeshFilterInterface virtual QString filterInfo(FilterIDType filter) const; virtual QString filterName(FilterIDType filter) const; - virtual FilterClass getClass(QAction *); - void initParameterSet(QAction *action, MeshModel &m, RichParameterList &parlst); - int getPreConditions(QAction *) const; - int postCondition( QAction* ) const; - int getRequirements(QAction *); - bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - FILTER_ARITY filterArity(QAction *) const {return SINGLE_MESH;} + virtual FilterClass getClass(const QAction*) const; + void initParameterList(const QAction* action, MeshModel &m, RichParameterList &parlst); + int getPreConditions(const QAction*) const; + int postCondition(const QAction* ) const; + int getRequirements(const QAction*); + bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + FILTER_ARITY filterArity(const QAction *) const {return SINGLE_MESH;} }; #endif diff --git a/src/meshlabplugins/filter_sketchfab/filter_sketchfab.cpp b/src/meshlabplugins/filter_sketchfab/filter_sketchfab.cpp index c74a2a639..9aad1e867 100644 --- a/src/meshlabplugins/filter_sketchfab/filter_sketchfab.cpp +++ b/src/meshlabplugins/filter_sketchfab/filter_sketchfab.cpp @@ -26,6 +26,9 @@ #include #include #include +#include +#include +#include #include #include "miniz.h" @@ -64,18 +67,18 @@ QString FilterSketchFabPlugin::filterInfo(FilterIDType filterId) const } } -FilterSketchFabPlugin::FilterClass FilterSketchFabPlugin::getClass(QAction *a) +FilterSketchFabPlugin::FilterClass FilterSketchFabPlugin::getClass(const QAction *a) const { switch(ID(a)) { case FP_SKETCHFAB : - return MeshFilterInterface::Smoothing; + return FilterPluginInterface::Smoothing; default : assert(0); - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } } -MeshFilterInterface::FILTER_ARITY FilterSketchFabPlugin::filterArity(QAction* a) const +FilterPluginInterface::FILTER_ARITY FilterSketchFabPlugin::filterArity(const QAction* a) const { switch(ID(a)) { case FP_SKETCHFAB : @@ -85,17 +88,17 @@ MeshFilterInterface::FILTER_ARITY FilterSketchFabPlugin::filterArity(QAction* a) } } -int FilterSketchFabPlugin::getPreConditions(QAction*) const +int FilterSketchFabPlugin::getPreConditions(const QAction*) const { return MeshModel::MM_NONE; } -int FilterSketchFabPlugin::postCondition(QAction*) const +int FilterSketchFabPlugin::postCondition(const QAction*) const { return MeshModel::MM_NONE; } -void FilterSketchFabPlugin::initParameterSet(QAction* action, MeshModel&, RichParameterList& parlst) +void FilterSketchFabPlugin::initParameterList(const QAction* action, MeshModel&, RichParameterList& parlst) { QSettings settings; QVariant v = settings.value("SketchFab Code"); @@ -122,7 +125,7 @@ void FilterSketchFabPlugin::initParameterSet(QAction* action, MeshModel&, RichPa } } -bool FilterSketchFabPlugin::applyFilter(QAction * action, MeshDocument& md, const RichParameterList& par, vcg::CallBackPos* cb) +bool FilterSketchFabPlugin::applyFilter(const QAction * action, MeshDocument& md, unsigned int& /*postConditionMask*/, const RichParameterList& par, vcg::CallBackPos* cb) { switch (ID(action)) { case FP_SKETCHFAB: @@ -191,8 +194,8 @@ bool FilterSketchFabPlugin::sketchfab( return false; } - this->Log("Upload Completed; you can access the uploaded model at the following URL:\n"); - this->Log("%s\n",qUtf8Printable(QString::fromStdString(urlModel)),qUtf8Printable(QString::fromStdString(urlModel))); + this->log("Upload Completed; you can access the uploaded model at the following URL:\n"); + this->log("%s\n",qUtf8Printable(QString::fromStdString(urlModel)),qUtf8Printable(QString::fromStdString(urlModel))); return true; } diff --git a/src/meshlabplugins/filter_sketchfab/filter_sketchfab.h b/src/meshlabplugins/filter_sketchfab/filter_sketchfab.h index 93e01e1e5..559224d45 100644 --- a/src/meshlabplugins/filter_sketchfab/filter_sketchfab.h +++ b/src/meshlabplugins/filter_sketchfab/filter_sketchfab.h @@ -24,14 +24,14 @@ #ifndef FILTERSKETCHFAB_H #define FILTERSKETCHFAB_H -#include +#include #include -class FilterSketchFabPlugin : public QObject, public MeshFilterInterface +class FilterSketchFabPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { FP_SKETCHFAB } ; @@ -41,12 +41,12 @@ public: QString pluginName() const; QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - FilterClass getClass(QAction *a); - FILTER_ARITY filterArity(QAction *a) const; - int getPreConditions(QAction *) const; - int postCondition( QAction* ) const; - void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterList & /*parent*/); - bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + FilterClass getClass(const QAction* a) const; + FILTER_ARITY filterArity(const QAction* a) const; + int getPreConditions(const QAction*) const; + int postCondition(const QAction* ) const; + void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); + bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; public slots: void finished(); diff --git a/src/meshlabplugins/filter_ssynth/filter_ssynth.cpp b/src/meshlabplugins/filter_ssynth/filter_ssynth.cpp index 81f212a88..fa50a5862 100644 --- a/src/meshlabplugins/filter_ssynth/filter_ssynth.cpp +++ b/src/meshlabplugins/filter_ssynth/filter_ssynth.cpp @@ -2,7 +2,6 @@ #include "filter_ssynth.h" #include #include -#include #include #include #undef __GLEW_H__ //terrible workaround to avoid problem with #warning in visual studio @@ -57,7 +56,7 @@ QString FilterSSynth::filterInfo(FilterIDType filterId) const } } -void FilterSSynth::initParameterSet(QAction* /*filter*/,MeshDocument &/*md*/, RichParameterList &par) +void FilterSSynth::initParameterList(const QAction* /*filter*/,MeshDocument &/*md*/, RichParameterList &par) { par.addParam(RichString("grammar","set maxdepth 40 R1 R2 rule R1 { { x 1 rz 6 ry 6 s 0.99 } R1 { s 2 } sphere } rule R2 {{ x -1 rz 6 ry 6 s 0.99 } R2 { s 2 } sphere} ","Eisen Script grammar","Write a grammar according to Eisen Script specification and using the primitives box, sphere, mesh, dot and triangle ")); par.addParam(RichInt("seed",1,"seed for random construction","Seed needed to build the mesh")); @@ -78,7 +77,7 @@ void FilterSSynth::openX3D(const QString &fileName, MeshModel &m, int& mask, vcg delete(info); } -bool FilterSSynth::applyFilter(QAction* filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) +bool FilterSSynth::applyFilter(const QAction* filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { md.addNewMesh("",this->filterName(ID(filter))); QWidget * parent=(QWidget*)this->parent(); @@ -107,7 +106,7 @@ bool FilterSSynth::applyFilter(QAction* filter, MeshDocument &md, const RichPar } } -int FilterSSynth::getRequirements(QAction *) +int FilterSSynth::getRequirements(const QAction *) { return MeshModel::MM_NONE; } @@ -148,26 +147,26 @@ QString FilterSSynth::ssynth(QString grammar,int maxdepth,int seed,CallBackPos * return path; } -int FilterSSynth::postCondition(QAction* /*filter*/) const +int FilterSSynth::postCondition(const QAction* /*filter*/) const { return MeshModel::MM_NONE; } -MeshFilterInterface::FilterClass FilterSSynth::getClass(QAction */*filter*/) +FilterPluginInterface::FilterClass FilterSSynth::getClass(const QAction */*filter*/) const { - return MeshFilterInterface::MeshCreation; + return FilterPluginInterface::MeshCreation; } -QList FilterSSynth::importFormats() const +QList FilterSSynth::importFormats() const { - QList formats; - formats<< MeshIOInterface::Format("Eisen Script File", tr("ES")); + QList formats; + formats<< IOPluginInterface::Format("Eisen Script File", tr("ES")); return formats; } -QList FilterSSynth::exportFormats() const +QList FilterSSynth::exportFormats() const { - QList formats; + QList formats; return formats ; } diff --git a/src/meshlabplugins/filter_ssynth/filter_ssynth.h b/src/meshlabplugins/filter_ssynth/filter_ssynth.h index 821680f58..d18bb5ea3 100644 --- a/src/meshlabplugins/filter_ssynth/filter_ssynth.h +++ b/src/meshlabplugins/filter_ssynth/filter_ssynth.h @@ -27,14 +27,13 @@ #include -#include -#include +#include #include -class FilterSSynth : public QObject,public MeshIOInterface, public MeshFilterInterface{ +class FilterSSynth : public QObject,public IOPluginInterface, public FilterPluginInterface{ Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface IOPluginInterface) public: enum {CR_SSYNTH} ; @@ -43,14 +42,14 @@ public: QString pluginName() const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual int getRequirements(QAction *); - virtual void initParameterSet(QAction* /*filter*/,MeshModel &,RichParameterList &){}; - virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterList & /*parent*/); - virtual bool applyFilter(QAction* filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb); - virtual FilterClass getClass(QAction* filter); + virtual int getRequirements(const QAction*); + virtual void initParameterList(const QAction* /*filter*/,MeshModel &,RichParameterList &){}; + virtual void initParameterList(const QAction*, MeshDocument &/*m*/, RichParameterList & /*parent*/); + virtual bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & par, vcg::CallBackPos *cb); + virtual FilterClass getClass(const QAction* filter) const; void setAttributes(CMeshO::VertexIterator &vi, CMeshO &m); static void openX3D(const QString &fileName, MeshModel &m, int& mask, vcg::CallBackPos *cb, QWidget *parent=0); - virtual int postCondition(QAction* filter) const; + virtual int postCondition(const QAction* filter) const; QList importFormats() const; QList exportFormats() const; @@ -58,7 +57,7 @@ public: void initPreOpenParameter(const QString &formatName, const QString &filename, RichParameterList &parlst); bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList & par, vcg::CallBackPos *cb=0, QWidget *parent=0); bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterList &, vcg::CallBackPos *cb, QWidget *parent); - MeshFilterInterface::FILTER_ARITY filterArity(QAction *) const {return NONE;} + FilterPluginInterface::FILTER_ARITY filterArity(const QAction *) const {return NONE;} private: QString ssynth(QString grammar,int maxdepth,int seed,vcg::CallBackPos *cb); QString GetTemplate(int sphereres); diff --git a/src/meshlabplugins/filter_texture/filter_texture.cpp b/src/meshlabplugins/filter_texture/filter_texture.cpp index f0a6de780..b79445044 100644 --- a/src/meshlabplugins/filter_texture/filter_texture.cpp +++ b/src/meshlabplugins/filter_texture/filter_texture.cpp @@ -97,7 +97,7 @@ QString FilterTexturePlugin::filterInfo(FilterIDType filterId) const return QString("Unknown Filter"); } -int FilterTexturePlugin::getPreConditions(QAction *a) const +int FilterTexturePlugin::getPreConditions(const QAction *a) const { switch (ID(a)) { @@ -115,7 +115,7 @@ int FilterTexturePlugin::getPreConditions(QAction *a) const return MeshModel::MM_NONE; } -int FilterTexturePlugin::getRequirements(QAction *a) +int FilterTexturePlugin::getRequirements(const QAction *a) { switch (ID(a)) { @@ -133,7 +133,7 @@ int FilterTexturePlugin::getRequirements(QAction *a) return MeshModel::MM_NONE; } -int FilterTexturePlugin::postCondition( QAction *a) const +int FilterTexturePlugin::postCondition(const QAction *a) const { switch (ID(a)) { @@ -154,7 +154,7 @@ int FilterTexturePlugin::postCondition( QAction *a) const // The FilterClass describes in which generic class of filters it fits. // This choice affect the submenu in which each filter will be placed // More than a single class can be chosen. -FilterTexturePlugin::FilterClass FilterTexturePlugin::getClass(QAction *a) +FilterTexturePlugin::FilterClass FilterTexturePlugin::getClass(const QAction *a) const { switch(ID(a)) { @@ -165,11 +165,11 @@ FilterTexturePlugin::FilterClass FilterTexturePlugin::getClass(QAction *a) case FP_PLANAR_MAPPING : case FP_SET_TEXTURE : case FP_COLOR_TO_TEXTURE : - case FP_TRANSFER_TO_TEXTURE : return MeshFilterInterface::Texture; - case FP_TEX_TO_VCOLOR_TRANSFER : return FilterClass(MeshFilterInterface::VertexColoring + MeshFilterInterface::Texture); + case FP_TRANSFER_TO_TEXTURE : return FilterPluginInterface::Texture; + case FP_TEX_TO_VCOLOR_TRANSFER : return FilterClass(FilterPluginInterface::VertexColoring + FilterPluginInterface::Texture); default : assert(0); } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } static QString extractFilenameWOExt(MeshModel* mm) @@ -185,7 +185,7 @@ static QString extractFilenameWOExt(MeshModel* mm) // - the string shown in the dialog // - the default value // - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog) -void FilterTexturePlugin::initParameterSet(QAction *action, MeshDocument &md, RichParameterList & parlst) +void FilterTexturePlugin::initParameterList(const QAction *action, MeshDocument &md, RichParameterList & parlst) { switch(ID(action)) { case FP_VORONOI_ATLAS : @@ -342,7 +342,7 @@ T log_2(const T num) } // The Real Core Function doing the actual mesh processing. -bool FilterTexturePlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList &par, CallBackPos *cb) +bool FilterTexturePlugin::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList &par, CallBackPos *cb) { MeshModel &m=*(md.mm()); switch(ID(filter)) { @@ -355,7 +355,7 @@ bool FilterTexturePlugin::applyFilter(QAction *filter, MeshDocument &md, const R if(nonManifVertNum>0 || nonManifEdgeNum>0) { - Log("Mesh is not manifold\n:%i non manifold Vertices\n%i nonmanifold Edges\n",nonManifVertNum,nonManifEdgeNum); + log("Mesh is not manifold\n:%i non manifold Vertices\n%i nonmanifold Edges\n",nonManifVertNum,nonManifEdgeNum); this->errorMessage = "Mesh is not manifold. See Log for details"; return false; } @@ -378,11 +378,11 @@ bool FilterTexturePlugin::applyFilter(QAction *filter, MeshDocument &md, const R paraModel->UpdateBoxAndNormals(); baseModel->clearDataMask(bitToBeCleared); - Log("Voronoi Atlas: Completed Processing in %i iterations",pp.vas.iterNum); - Log("Asked %i generated %i regions",pp.sampleNum,pp.vas.regionNum); - Log("Unwrap Time %6.3f s", float(pp.vas.unwrapTime) / CLOCKS_PER_SEC); - Log("Voronoi Time %6.3f s", float(pp.vas.voronoiTime) / CLOCKS_PER_SEC); - Log("Sampling Time %6.3f s", float(pp.vas.samplingTime) / CLOCKS_PER_SEC); + log("Voronoi Atlas: Completed Processing in %i iterations",pp.vas.iterNum); + log("Asked %i generated %i regions",pp.sampleNum,pp.vas.regionNum); + log("Unwrap Time %6.3f s", float(pp.vas.unwrapTime) / CLOCKS_PER_SEC); + log("Voronoi Time %6.3f s", float(pp.vas.voronoiTime) / CLOCKS_PER_SEC); + log("Sampling Time %6.3f s", float(pp.vas.samplingTime) / CLOCKS_PER_SEC); } break; @@ -571,8 +571,8 @@ bool FilterTexturePlugin::applyFilter(QAction *filter, MeshDocument &md, const R } assert(face == faceNo); assert(it == buckets[buckSize-1].end()); - Log( "Biggest triangle's catheti are %.2f px long", (cache[0].P(0)-cache[0].P(2)).Norm() * textDim); - Log( "Smallest triangle's catheti are %.2f px long", (cache[cache.size()-1].P(0)-cache[cache.size()-1].P(2)).Norm() * textDim); + log( "Biggest triangle's catheti are %.2f px long", (cache[0].P(0)-cache[0].P(2)).Norm() * textDim); + log( "Smallest triangle's catheti are %.2f px long", (cache[cache.size()-1].P(0)-cache[cache.size()-1].P(2)).Norm() * textDim); } else //BASIC @@ -637,7 +637,7 @@ bool FilterTexturePlugin::applyFilter(QAction *filter, MeshDocument &md, const R } } } - Log( "Triangles' catheti are %.2f px long", (1.0/sideDim-border-bordersq2)*textDim); + log( "Triangles' catheti are %.2f px long", (1.0/sideDim-border-bordersq2)*textDim); } } break; @@ -685,7 +685,7 @@ bool FilterTexturePlugin::applyFilter(QAction *filter, MeshDocument &md, const R // Save texture CheckError(!img.save(fileName, NULL), "Specified file cannot be saved"); - Log( "Dummy Texture \"%s\" Created ", fileName.toStdString().c_str()); + log( "Dummy Texture \"%s\" Created ", fileName.toStdString().c_str()); assert(textFile.exists()); } @@ -732,7 +732,7 @@ bool FilterTexturePlugin::applyFilter(QAction *filter, MeshDocument &md, const R // Save texture CheckError(!img.save(fileName, "PNG"), "Specified file cannot be saved"); - Log("Dummy Texture \"%s\" Created ", fileName.toStdString().c_str()); + log("Dummy Texture \"%s\" Created ", fileName.toStdString().c_str()); assert(textFile.exists()); } @@ -813,7 +813,7 @@ bool FilterTexturePlugin::applyFilter(QAction *filter, MeshDocument &md, const R // Save texture cb(90, "Saving texture ..."); CheckError(!trgImgs[texInd].save(texFileNames[texInd]), "Texture file cannot be saved"); - Log("Texture \"%s\" Created", texFileNames[texInd].toStdString().c_str()); + log("Texture \"%s\" Created", texFileNames[texInd].toStdString().c_str()); assert(QFile(texFileNames[texInd]).exists()); } @@ -896,7 +896,7 @@ bool FilterTexturePlugin::applyFilter(QAction *filter, MeshDocument &md, const R // Save texture CheckError(!img.save(fileName, "PNG"), "Specified file cannot be saved"); - Log("Dummy Texture \"%s\" Created ", fileName.toStdString().c_str()); + log("Dummy Texture \"%s\" Created ", fileName.toStdString().c_str()); assert(textFile.exists()); } @@ -1028,7 +1028,7 @@ bool FilterTexturePlugin::applyFilter(QAction *filter, MeshDocument &md, const R // Save texture cb(90, "Saving texture ..."); CheckError(!trgImgs[trgTexInd].save(trgTextureFileNames[trgTexInd]), "Texture file cannot be saved"); - Log("Texture \"%s\" Created", trgTextureFileNames[trgTexInd].toStdString().c_str()); + log("Texture \"%s\" Created", trgTextureFileNames[trgTexInd].toStdString().c_str()); assert(QFile(trgTextureFileNames[trgTexInd]).exists()); } @@ -1109,7 +1109,7 @@ bool FilterTexturePlugin::applyFilter(QAction *filter, MeshDocument &md, const R return true; } -MeshFilterInterface::FILTER_ARITY FilterTexturePlugin::filterArity( QAction * filter ) const +FilterPluginInterface::FILTER_ARITY FilterTexturePlugin::filterArity(const QAction * filter ) const { switch(ID(filter)) { @@ -1120,12 +1120,12 @@ MeshFilterInterface::FILTER_ARITY FilterTexturePlugin::filterArity( QAction * fi case FP_PLANAR_MAPPING : case FP_SET_TEXTURE : case FP_COLOR_TO_TEXTURE : - return MeshFilterInterface::SINGLE_MESH; + return FilterPluginInterface::SINGLE_MESH; case FP_TRANSFER_TO_TEXTURE : case FP_TEX_TO_VCOLOR_TRANSFER : - return MeshFilterInterface::FIXED; + return FilterPluginInterface::FIXED; } - return MeshFilterInterface::NONE; + return FilterPluginInterface::NONE; } diff --git a/src/meshlabplugins/filter_texture/filter_texture.h b/src/meshlabplugins/filter_texture/filter_texture.h index 87a236878..a91e3a114 100644 --- a/src/meshlabplugins/filter_texture/filter_texture.h +++ b/src/meshlabplugins/filter_texture/filter_texture.h @@ -28,17 +28,17 @@ #include #include -#include +#include #include #include #include #include -class FilterTexturePlugin : public QObject, public MeshFilterInterface +class FilterTexturePlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { @@ -58,13 +58,13 @@ public: QString pluginName() const; virtual QString filterName(FilterIDType filter) const; virtual QString filterInfo(FilterIDType filter) const; - virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterList & /*parent*/); - virtual bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb); - virtual int getRequirements(QAction *); - virtual int getPreConditions(QAction *) const; - virtual int postCondition( QAction* ) const; - FilterClass getClass(QAction *a); - FILTER_ARITY filterArity(QAction * filter) const; + virtual void initParameterList(const QAction*, MeshDocument &/*m*/, RichParameterList & /*parent*/); + virtual bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb); + virtual int getRequirements(const QAction*); + virtual int getPreConditions(const QAction*) const; + virtual int postCondition(const QAction* ) const; + FilterClass getClass(const QAction *a) const; + FILTER_ARITY filterArity(const QAction* filter) const; }; #endif diff --git a/src/meshlabplugins/filter_texture/rastering.h b/src/meshlabplugins/filter_texture/rastering.h index 30f4b1102..e736d9a28 100644 --- a/src/meshlabplugins/filter_texture/rastering.h +++ b/src/meshlabplugins/filter_texture/rastering.h @@ -24,7 +24,7 @@ #ifndef _RASTERING_H #define _RASTERING_H -#include +#include #include #include @@ -33,7 +33,6 @@ class VertexSampler typedef vcg::GridStaticPtr MetroMeshGrid; typedef vcg::tri::FaceTmark MarkerFace; - CMeshO &srcMesh; vector &srcImgs; float dist_upper_bound; @@ -47,7 +46,7 @@ class VertexSampler public: VertexSampler(CMeshO &_srcMesh, vector &_srcImg, float upperBound) : - srcMesh(_srcMesh), srcImgs(_srcImg), dist_upper_bound(upperBound) + srcImgs(_srcImg), dist_upper_bound(upperBound) { unifGridFace.Set(_srcMesh.face.begin(),_srcMesh.face.end()); markerFunctor.SetMesh(&_srcMesh); diff --git a/src/meshlabplugins/filter_trioptimize/filter_trioptimize.cpp b/src/meshlabplugins/filter_trioptimize/filter_trioptimize.cpp index 13d723cae..e92d2289e 100644 --- a/src/meshlabplugins/filter_trioptimize/filter_trioptimize.cpp +++ b/src/meshlabplugins/filter_trioptimize/filter_trioptimize.cpp @@ -138,7 +138,7 @@ QString TriOptimizePlugin::pluginName() const return {}; } - int TriOptimizePlugin::getRequirements(QAction *action) + int TriOptimizePlugin::getRequirements(const QAction *action) { switch (ID(action)) { case FP_PLANAR_EDGE_FLIP: @@ -171,17 +171,17 @@ QString TriOptimizePlugin::pluginName() const return {}; } - TriOptimizePlugin::FilterClass TriOptimizePlugin::getClass(QAction *action) + TriOptimizePlugin::FilterClass TriOptimizePlugin::getClass(const QAction *action) const { switch(ID(action)) { - case FP_PLANAR_EDGE_FLIP: return MeshFilterInterface::Remeshing; - case FP_CURVATURE_EDGE_FLIP: return MeshFilterInterface::Remeshing; - case FP_NEAR_LAPLACIAN_SMOOTH: return MeshFilterInterface::Smoothing; + case FP_PLANAR_EDGE_FLIP: return FilterPluginInterface::Remeshing; + case FP_CURVATURE_EDGE_FLIP: return FilterPluginInterface::Remeshing; + case FP_NEAR_LAPLACIAN_SMOOTH: return FilterPluginInterface::Smoothing; } - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } -int TriOptimizePlugin::postCondition(QAction *a) const +int TriOptimizePlugin::postCondition(const QAction *a) const { switch(ID(a)) { @@ -201,7 +201,7 @@ int TriOptimizePlugin::postCondition(QAction *a) const // - the string shown in the dialog // - the default value // - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog) -void TriOptimizePlugin::initParameterSet(QAction *action, MeshModel &m, RichParameterList & parlst) +void TriOptimizePlugin::initParameterList(const QAction *action, MeshModel &m, RichParameterList & parlst) { if (ID(action) == FP_CURVATURE_EDGE_FLIP) { parlst.addParam(RichBool("selection", m.cm.sfn > 0, tr("Update selection"), tr("Apply edge flip optimization on selected faces only"))); @@ -262,7 +262,7 @@ void TriOptimizePlugin::initParameterSet(QAction *action, MeshModel &m, RichPara // The Real Core Function doing the actual mesh processing. // Run mesh optimization -bool TriOptimizePlugin::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) +bool TriOptimizePlugin::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { MeshModel &m=*(md.mm()); float limit = -std::numeric_limits::epsilon(); @@ -270,7 +270,7 @@ bool TriOptimizePlugin::applyFilter(QAction *filter, MeshDocument &md, const Ric if (ID(filter) == FP_CURVATURE_EDGE_FLIP) { int delvert = tri::Clean::RemoveUnreferencedVertex(m.cm); if (delvert) - Log( + log( "Pre-Curvature Cleaning: Removed %d unreferenced vertices", delvert); @@ -324,7 +324,7 @@ bool TriOptimizePlugin::applyFilter(QAction *filter, MeshDocument &md, const Ric optimiz.DoOptimization(); optimiz.h.clear(); - Log( "%d curvature edge flips performed in %.2f sec.", optimiz.nPerformedOps, (clock() - start) / (float) CLOCKS_PER_SEC); + log( "%d curvature edge flips performed in %.2f sec.", optimiz.nPerformedOps, (clock() - start) / (float) CLOCKS_PER_SEC); } if (ID(filter) == FP_PLANAR_EDGE_FLIP) { if ( tri::Clean::CountNonManifoldEdgeFF(m.cm) >0) { @@ -359,7 +359,7 @@ bool TriOptimizePlugin::applyFilter(QAction *filter, MeshDocument &md, const Ric optimiz.DoOptimization(); optimiz.h.clear(); - Log( "%d planar edge flips performed in %.2f sec.", optimiz.nPerformedOps, (clock() - start) / (float) CLOCKS_PER_SEC); + log( "%d planar edge flips performed in %.2f sec.", optimiz.nPerformedOps, (clock() - start) / (float) CLOCKS_PER_SEC); int iternum = par.getInt("iterations"); tri::Smooth::VertexCoordPlanarLaplacian(m.cm, iternum, math::ToRad(planarThrDeg), selection,cb); diff --git a/src/meshlabplugins/filter_trioptimize/filter_trioptimize.h b/src/meshlabplugins/filter_trioptimize/filter_trioptimize.h index 64c4abbed..36bbf97b6 100644 --- a/src/meshlabplugins/filter_trioptimize/filter_trioptimize.h +++ b/src/meshlabplugins/filter_trioptimize/filter_trioptimize.h @@ -25,13 +25,13 @@ #define TRIOPTIMIZEFILTERSPLUGIN_H #include -#include +#include -class TriOptimizePlugin : public QObject, public MeshFilterInterface +class TriOptimizePlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { @@ -47,12 +47,12 @@ public: QString pluginName() const; QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterList & /*parent*/); - bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList &/*parent*/, vcg::CallBackPos * cb) ; - int getRequirements(QAction *); - FilterClass getClass(QAction *); - int postCondition( QAction* ) const; - FILTER_ARITY filterArity(QAction *) const {return SINGLE_MESH;} + void initParameterList(const QAction*, MeshModel &/*m*/, RichParameterList & /*parent*/); + bool applyFilter(const QAction *filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList &/*parent*/, vcg::CallBackPos * cb) ; + int getRequirements(const QAction*); + FilterClass getClass(const QAction *) const; + int postCondition(const QAction* ) const; + FILTER_ARITY filterArity(const QAction *) const {return SINGLE_MESH;} }; diff --git a/src/meshlabplugins/filter_unsharp/filter_unsharp.cpp b/src/meshlabplugins/filter_unsharp/filter_unsharp.cpp index 2812e2493..6764cdb26 100644 --- a/src/meshlabplugins/filter_unsharp/filter_unsharp.cpp +++ b/src/meshlabplugins/filter_unsharp/filter_unsharp.cpp @@ -181,12 +181,12 @@ QString FilterUnsharp::filterInfo(FilterIDType filterId) const return QString("Error on FilterUnsharp::filterInfo()!"); } - FilterUnsharp::FilterClass FilterUnsharp::getClass(QAction *a) + FilterUnsharp::FilterClass FilterUnsharp::getClass(const QAction *a) const { switch(ID(a)) { case FP_CREASE_CUT : - return MeshFilterInterface::FilterClass( MeshFilterInterface::Normal | MeshFilterInterface::Remeshing); + return FilterPluginInterface::FilterClass( FilterPluginInterface::Normal | FilterPluginInterface::Remeshing); case FP_SD_LAPLACIAN_SMOOTH: case FP_HC_LAPLACIAN_SMOOTH: case FP_LAPLACIAN_SMOOTH: @@ -200,23 +200,23 @@ QString FilterUnsharp::filterInfo(FilterIDType filterId) const case FP_UNSHARP_GEOMETRY: case FP_UNSHARP_QUALITY: case FP_LINEAR_MORPH : - return MeshFilterInterface::Smoothing; + return FilterPluginInterface::Smoothing; case FP_UNSHARP_VERTEX_COLOR: - return MeshFilterInterface::FilterClass( MeshFilterInterface::Smoothing | MeshFilterInterface::VertexColoring); + return FilterPluginInterface::FilterClass( FilterPluginInterface::Smoothing | FilterPluginInterface::VertexColoring); case FP_RECOMPUTE_FACE_NORMAL : case FP_RECOMPUTE_QUADFACE_NORMAL : case FP_RECOMPUTE_VERTEX_NORMAL : case FP_FACE_NORMAL_NORMALIZE: case FP_VERTEX_NORMAL_NORMALIZE: - return MeshFilterInterface::Normal; - case FP_SCALAR_HARMONIC_FIELD: return MeshFilterInterface::Remeshing; + return FilterPluginInterface::Normal; + case FP_SCALAR_HARMONIC_FIELD: return FilterPluginInterface::Remeshing; - default : return MeshFilterInterface::Generic; + default : return FilterPluginInterface::Generic; } } -int FilterUnsharp::getPreConditions(QAction *a) const +int FilterUnsharp::getPreConditions(const QAction *a) const { switch(ID(a)) { @@ -251,7 +251,7 @@ int FilterUnsharp::getPreConditions(QAction *a) const } -int FilterUnsharp::postCondition(QAction *a) const +int FilterUnsharp::postCondition(const QAction *a) const { switch(ID(a)) { @@ -280,7 +280,7 @@ int FilterUnsharp::postCondition(QAction *a) const } } - int FilterUnsharp::getRequirements(QAction *action) + int FilterUnsharp::getRequirements(const QAction *action) { switch(ID(action)) { @@ -312,7 +312,7 @@ int FilterUnsharp::postCondition(QAction *a) const return MeshModel::MM_NONE; } -void FilterUnsharp::initParameterSet(QAction *action, MeshDocument &md, RichParameterList & parlst) +void FilterUnsharp::initParameterList(const QAction *action, MeshDocument &md, RichParameterList & parlst) { switch(ID(action)) { @@ -405,7 +405,7 @@ void FilterUnsharp::initParameterSet(QAction *action, MeshDocument &md, RichPara } } -bool FilterUnsharp::applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos * cb) +bool FilterUnsharp::applyFilter(const QAction *filter, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos * cb) { MeshModel &m=*(md.mm()); switch(ID(filter)) @@ -445,7 +445,7 @@ bool FilterUnsharp::applyFilter(QAction *filter, MeshDocument &md, const RichPar if(!boundarySmooth) tri::UpdateFlags::FaceClearB(m.cm); tri::Smooth::VertexCoordLaplacian(m.cm,stepSmoothNum,Selected,cotangentWeight,cb); - Log( "Smoothed %d vertices", Selected ? m.cm.svn : m.cm.vn); + log( "Smoothed %d vertices", Selected ? m.cm.svn : m.cm.vn); m.UpdateBoxAndNormals(); } break; @@ -458,7 +458,7 @@ bool FilterUnsharp::applyFilter(QAction *filter, MeshDocument &md, const RichPar float delta = par.getAbsPerc("delta"); Point3m viewpoint = par.getPoint3m("viewPoint"); tri::Smooth::VertexCoordViewDepth(m.cm, viewpoint, delta, stepSmoothNum, Selected,true); - Log("depth Smoothed %d vertices", Selected ? m.cm.svn : m.cm.vn); + log("depth Smoothed %d vertices", Selected ? m.cm.svn : m.cm.vn); m.UpdateBoxAndNormals(); } break; @@ -481,7 +481,7 @@ bool FilterUnsharp::applyFilter(QAction *filter, MeshDocument &md, const RichPar for(vi =m.cm.vert.begin();vi!= m.cm.vert.end();++vi) h[vi] = vi->cP(); - Log( "Stored Position %d vertices", m.cm.vn); + log( "Stored Position %d vertices", m.cm.vn); break; } case 1: // ***** Recovering and Projection Vertex Data ***** @@ -500,7 +500,7 @@ bool FilterUnsharp::applyFilter(QAction *filter, MeshDocument &md, const RichPar (*vi).P() = h[vi] + d * (s*alpha); } m.UpdateBoxAndNormals(); - Log( "Projected smoothed Position %d vertices", m.cm.vn); + log( "Projected smoothed Position %d vertices", m.cm.vn); } break; } @@ -515,7 +515,7 @@ bool FilterUnsharp::applyFilter(QAction *filter, MeshDocument &md, const RichPar tri::UpdateFlags::FaceClearB(m.cm); float delta = par.getAbsPerc("delta"); tri::Smooth::VertexCoordScaleDependentLaplacian_Fujiwara(m.cm,stepSmoothNum,delta); - Log( "Smoothed %d vertices", cnt>0 ? cnt : m.cm.vn); + log( "Smoothed %d vertices", cnt>0 ? cnt : m.cm.vn); m.UpdateBoxAndNormals(); } break; @@ -557,7 +557,7 @@ bool FilterUnsharp::applyFilter(QAction *filter, MeshDocument &md, const RichPar size_t cnt=tri::UpdateSelection::VertexFromFaceStrict(m.cm); tri::Smooth::VertexCoordTaubin(m.cm,stepSmoothNum,lambda,mu,cnt>0,cb); - Log( "Smoothed %d vertices", cnt>0 ? cnt : m.cm.vn); + log( "Smoothed %d vertices", cnt>0 ? cnt : m.cm.vn); m.UpdateBoxAndNormals(); } break; @@ -785,7 +785,7 @@ bool FilterUnsharp::applyFilter(QAction *filter, MeshDocument &md, const RichPar return true; } -MeshFilterInterface::FILTER_ARITY FilterUnsharp::filterArity( QAction * filter ) const +FilterPluginInterface::FILTER_ARITY FilterUnsharp::filterArity(const QAction * filter ) const { switch(ID(filter)) { @@ -809,11 +809,11 @@ MeshFilterInterface::FILTER_ARITY FilterUnsharp::filterArity( QAction * filter ) case FP_RECOMPUTE_FACE_NORMAL: case FP_RECOMPUTE_QUADFACE_NORMAL: case FP_SCALAR_HARMONIC_FIELD: - return MeshFilterInterface::SINGLE_MESH; + return FilterPluginInterface::SINGLE_MESH; case FP_LINEAR_MORPH : - return MeshFilterInterface::FIXED; + return FilterPluginInterface::FIXED; } - return MeshFilterInterface::NONE; + return FilterPluginInterface::NONE; } diff --git a/src/meshlabplugins/filter_unsharp/filter_unsharp.h b/src/meshlabplugins/filter_unsharp/filter_unsharp.h index bcd11c853..63558873e 100644 --- a/src/meshlabplugins/filter_unsharp/filter_unsharp.h +++ b/src/meshlabplugins/filter_unsharp/filter_unsharp.h @@ -24,14 +24,14 @@ #define FilterUnsharp_PLUGIN_H #include -#include +#include -class FilterUnsharp : public QObject, public MeshFilterInterface +class FilterUnsharp : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: /* naming convention : @@ -70,13 +70,13 @@ class FilterUnsharp : public QObject, public MeshFilterInterface QString pluginName() const; QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - FilterClass getClass(QAction *); - int getRequirements(QAction *); - bool applyFilter(QAction *filter, MeshDocument &md, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; - void initParameterSet(QAction *action, MeshDocument &/*m*/, RichParameterList & parlst); - int postCondition( QAction* ) const; - int getPreConditions(QAction *) const; - FILTER_ARITY filterArity(QAction * filter) const; + FilterClass getClass(const QAction*) const; + int getRequirements(const QAction*); + bool applyFilter(const QAction* filter, MeshDocument &md, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb) ; + void initParameterList(const QAction* action, MeshDocument &/*m*/, RichParameterList & parlst); + int postCondition(const QAction* ) const; + int getPreConditions(const QAction*) const; + FILTER_ARITY filterArity(const QAction* filter) const; }; diff --git a/src/meshlabplugins/filter_voronoi/filter_voronoi.cpp b/src/meshlabplugins/filter_voronoi/filter_voronoi.cpp index 2587580fc..3cdefe7e7 100644 --- a/src/meshlabplugins/filter_voronoi/filter_voronoi.cpp +++ b/src/meshlabplugins/filter_voronoi/filter_voronoi.cpp @@ -95,26 +95,26 @@ QString FilterVoronoiPlugin::filterInfo(FilterIDType filterId) const } } -FilterVoronoiPlugin::FilterClass FilterVoronoiPlugin::getClass(QAction* a) +FilterVoronoiPlugin::FilterClass FilterVoronoiPlugin::getClass(const QAction* a) const { switch(ID(a)) { case VORONOI_SAMPLING : case VOLUME_SAMPLING: case VORONOI_SCAFFOLDING: - return MeshFilterInterface::Sampling; + return FilterPluginInterface::Sampling; case BUILD_SHELL: - return MeshFilterInterface::Remeshing; + return FilterPluginInterface::Remeshing; case CROSS_FIELD_CREATION: - return MeshFilterInterface::Normal; + return FilterPluginInterface::Normal; // case CROSS_FIELD_SMOOTHING: // return MeshFilterInterface::Smoothing; default : assert(0); - return MeshFilterInterface::Generic; + return FilterPluginInterface::Generic; } } -MeshFilterInterface::FILTER_ARITY FilterVoronoiPlugin::filterArity(QAction* a) const +FilterPluginInterface::FILTER_ARITY FilterVoronoiPlugin::filterArity(const QAction* a) const { switch(ID(a)) { case VORONOI_SAMPLING : @@ -131,7 +131,7 @@ MeshFilterInterface::FILTER_ARITY FilterVoronoiPlugin::filterArity(QAction* a) c } } -void FilterVoronoiPlugin::initParameterSet(QAction* action, MeshModel& m, RichParameterList& par) +void FilterVoronoiPlugin::initParameterList(const QAction* action, MeshModel& m, RichParameterList& par) { switch(ID(action)) { case VORONOI_SAMPLING : @@ -194,7 +194,7 @@ void FilterVoronoiPlugin::initParameterSet(QAction* action, MeshModel& m, RichPa } } -int FilterVoronoiPlugin::getPreConditions(QAction* action) const +int FilterVoronoiPlugin::getPreConditions(const QAction* action) const { switch(ID(action)) { case VORONOI_SAMPLING : @@ -211,7 +211,7 @@ int FilterVoronoiPlugin::getPreConditions(QAction* action) const } } -bool FilterVoronoiPlugin::applyFilter(QAction * action, MeshDocument &md, const RichParameterList & par, vcg::CallBackPos *cb) +bool FilterVoronoiPlugin::applyFilter(const QAction * action, MeshDocument &md, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb) { switch(ID(action)) { case VORONOI_SAMPLING : @@ -253,7 +253,7 @@ bool FilterVoronoiPlugin::applyFilter(QAction * action, MeshDocument &md, const } } -int FilterVoronoiPlugin::postCondition(QAction* action) const +int FilterVoronoiPlugin::postCondition(const QAction* action) const { switch(ID(action)) { case VORONOI_SAMPLING : @@ -403,7 +403,7 @@ bool FilterVoronoiPlugin::volumeSampling( mcVm->updateDataMask(MeshModel::MM_VERTCOLOR | MeshModel::MM_VERTQUALITY); pSm->updateDataMask(MeshModel::MM_VERTCOLOR | MeshModel::MM_VERTQUALITY); VoronoiVolumeSampling vvs(m->cm); - Log("Sampling Surface at a radius %f ",sampleSurfRadius); + log("Sampling Surface at a radius %f ",sampleSurfRadius); cb(1, "Init"); vvs.Init(sampleSurfRadius); cb(30, "Sampling Volume..."); @@ -442,12 +442,12 @@ bool FilterVoronoiPlugin::voronoiScaffolding( VoronoiVolumeSampling vvs(m->cm); VoronoiVolumeSampling::Param par; - Log("Sampling Surface at a radius %f ",sampleSurfRadius); + log("Sampling Surface at a radius %f ",sampleSurfRadius); vvs.Init(sampleSurfRadius); cb(30, "Sampling Volume..."); CMeshO::ScalarType poissonVolumeRadius=0; vvs.BuildVolumeSampling(sampleVolNum,poissonVolumeRadius,0); - Log("Base Poisson volume sampling at a radius %f ",poissonVolumeRadius); + log("Base Poisson volume sampling at a radius %f ",poissonVolumeRadius); cb(40, "Relaxing Volume..."); vvs.BarycentricRelaxVoronoiSamples(relaxStep); diff --git a/src/meshlabplugins/filter_voronoi/filter_voronoi.h b/src/meshlabplugins/filter_voronoi/filter_voronoi.h index 844f64502..f6e3b23ff 100644 --- a/src/meshlabplugins/filter_voronoi/filter_voronoi.h +++ b/src/meshlabplugins/filter_voronoi/filter_voronoi.h @@ -24,13 +24,13 @@ #ifndef FILTER_VORONOI_H #define FILTER_VORONOI_H -#include +#include -class FilterVoronoiPlugin : public QObject, public MeshFilterInterface +class FilterVoronoiPlugin : public QObject, public FilterPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_FILTER_INTERFACE_IID) - Q_INTERFACES(MeshFilterInterface) + MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(FilterPluginInterface) public: enum { @@ -47,12 +47,12 @@ public: QString pluginName() const; QString filterName(FilterIDType filter) const; QString filterInfo(FilterIDType filter) const; - FilterClass getClass(QAction* a); - FILTER_ARITY filterArity(QAction* a) const; - void initParameterSet(QAction* action, MeshModel& m, RichParameterList& par); - int getPreConditions(QAction* action) const; - bool applyFilter(QAction* action, MeshDocument& md, const RichParameterList& par, vcg::CallBackPos* cb) ; - int postCondition(QAction* ) const; + FilterClass getClass(const QAction* a) const; + FILTER_ARITY filterArity(const QAction* a) const; + void initParameterList(const QAction* action, MeshModel& m, RichParameterList& par); + int getPreConditions(const QAction* action) const; + bool applyFilter(const QAction* action, MeshDocument& md, unsigned int& postConditionMask, const RichParameterList& par, vcg::CallBackPos* cb) ; + int postCondition(const QAction* ) const; private: bool voronoiSampling( diff --git a/src/meshlabplugins/io_3ds/import_3ds.h b/src/meshlabplugins/io_3ds/import_3ds.h index 13b36d83e..5a97791e9 100644 --- a/src/meshlabplugins/io_3ds/import_3ds.h +++ b/src/meshlabplugins/io_3ds/import_3ds.h @@ -41,12 +41,14 @@ #ifndef __VCGLIB_IMPORT_3DS #define __VCGLIB_IMPORT_3DS -#include #include "io_3ds.h" + +#include #include +#include // lib3ds headers -#include +#include #include #include #include diff --git a/src/meshlabplugins/io_3ds/meshio.cpp b/src/meshlabplugins/io_3ds/meshio.cpp index beb01eef9..a28986820 100644 --- a/src/meshlabplugins/io_3ds/meshio.cpp +++ b/src/meshlabplugins/io_3ds/meshio.cpp @@ -41,6 +41,8 @@ #include #include +#include +#include using namespace std; using namespace vcg; @@ -233,7 +235,7 @@ bool ExtraMeshIOPlugin::save(const QString &formatName, const QString &fileName, /* returns the list of the file's type which can be imported */ -QList ExtraMeshIOPlugin::importFormats() const +QList ExtraMeshIOPlugin::importFormats() const { QList formatList; formatList << Format("3D-Studio File Format" ,tr("3DS")); @@ -243,7 +245,7 @@ QList ExtraMeshIOPlugin::importFormats() const /* returns the list of the file's type which can be exported */ -QList ExtraMeshIOPlugin::exportFormats() const +QList ExtraMeshIOPlugin::exportFormats() const { QList formatList; formatList << Format("3D-Studio File Format" ,tr("3DS")); diff --git a/src/meshlabplugins/io_3ds/meshio.h b/src/meshlabplugins/io_3ds/meshio.h index 8ef42e690..110b161c9 100644 --- a/src/meshlabplugins/io_3ds/meshio.h +++ b/src/meshlabplugins/io_3ds/meshio.h @@ -27,13 +27,13 @@ #include #include -#include +#include -class ExtraMeshIOPlugin : public QObject, public MeshIOInterface +class ExtraMeshIOPlugin : public QObject, public IOPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_IO_INTERFACE_IID) - Q_INTERFACES(MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(IO_PLUGIN_INTERFACE_IID) + Q_INTERFACES(IOPluginInterface) public: diff --git a/src/meshlabplugins/io_base/baseio.cpp b/src/meshlabplugins/io_base/baseio.cpp index e46ff0bea..c70a011cd 100644 --- a/src/meshlabplugins/io_base/baseio.cpp +++ b/src/meshlabplugins/io_base/baseio.cpp @@ -22,6 +22,7 @@ ****************************************************************************/ #include "baseio.h" +#include #include #include @@ -69,8 +70,7 @@ class PMesh : public tri::TriMesh< vector, vector, vector // initialize importing parameters void BaseMeshIOPlugin::initPreOpenParameter(const QString &formatName, const QString &/*filename*/, RichParameterList &parlst) { - if (formatName.toUpper() == tr("PTX")) - { + if (formatName.toUpper() == tr("PTX")) { parlst.addParam(RichInt("meshindex", 0, "Index of Range Map to be Imported", "PTX files may contain more than one range map. 0 is the first range map. If the number if higher than the actual mesh number, the import will fail")); parlst.addParam(RichBool("pointsonly", true, "Keep only points", "Import points a point cloud only, with radius and normals, no triangulation involved, isolated points and points with normals with steep angles are removed.")); @@ -80,6 +80,9 @@ void BaseMeshIOPlugin::initPreOpenParameter(const QString &formatName, const QSt parlst.addParam(RichBool("anglecull", true, "Cull faces by angle", "short")); 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")); + } } bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterList &parlst, CallBackPos *cb, QWidget * /*parent*/) @@ -287,7 +290,7 @@ bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName, } } if (someTextureNotFound) - Log("Missing texture files: %s", qUtf8Printable(missingTextureFilesMsg)); + log("Missing texture files: %s", qUtf8Printable(missingTextureFilesMsg)); if (cb != NULL) (*cb)(99, "Done"); @@ -429,7 +432,7 @@ QString BaseMeshIOPlugin::pluginName() const /* returns the list of the file's type which can be imported */ -QList BaseMeshIOPlugin::importFormats() const +QList BaseMeshIOPlugin::importFormats() const { QList formatList; formatList << Format("Stanford Polygon File Format", tr("PLY")); @@ -447,7 +450,7 @@ QList BaseMeshIOPlugin::importFormats() const /* returns the list of the file's type which can be exported */ -QList BaseMeshIOPlugin::exportFormats() const +QList BaseMeshIOPlugin::exportFormats() const { QList formatList; formatList << Format("Stanford Polygon File Format", tr("PLY")); @@ -535,11 +538,6 @@ void BaseMeshIOPlugin::initSaveParameter(const QString &format, MeshModel &m, Ri } } -void BaseMeshIOPlugin::initGlobalParameterSet(QAction * /*format*/, RichParameterList & globalparam) -{ - globalparam.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")); -} - //void BaseMeshIOPlugin::applyOpenParameter(const QString &format, MeshModel &m, const RichParameterSet &par) //{ // if(format.toUpper() == tr("STL")) diff --git a/src/meshlabplugins/io_base/baseio.h b/src/meshlabplugins/io_base/baseio.h index 4c93de49d..1238e624b 100644 --- a/src/meshlabplugins/io_base/baseio.h +++ b/src/meshlabplugins/io_base/baseio.h @@ -23,18 +23,19 @@ #ifndef BASEIOPLUGIN_H #define BASEIOPLUGIN_H -#include +#include +#include -class BaseMeshIOPlugin : public QObject, public MeshIOInterface +class BaseMeshIOPlugin : public QObject, public IOPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_IO_INTERFACE_IID) - Q_INTERFACES(MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(IO_PLUGIN_INTERFACE_IID) + Q_INTERFACES(IOPluginInterface) public: - BaseMeshIOPlugin() : MeshIOInterface() {} + BaseMeshIOPlugin() : IOPluginInterface() {} QString pluginName() const; QList importFormats() const; @@ -49,7 +50,6 @@ public: void initPreOpenParameter(const QString &formatName, const QString &filename, RichParameterList &parlst); void initSaveParameter(const QString &format, MeshModel &/*m*/, RichParameterList & par); - void initGlobalParameterSet(QAction * /*format*/, RichParameterList & /*globalparam*/); private: static QString stlUnifyParName() { return QString("MeshLab::IO::STL::UnifyVertices"); } }; diff --git a/src/meshlabplugins/io_bre/io_bre.cpp b/src/meshlabplugins/io_bre/io_bre.cpp index a27a25746..68f25067d 100644 --- a/src/meshlabplugins/io_bre/io_bre.cpp +++ b/src/meshlabplugins/io_bre/io_bre.cpp @@ -160,7 +160,7 @@ QString BreMeshIOPlugin::pluginName() const return "IOBRE"; } -QList BreMeshIOPlugin::importFormats() const +QList BreMeshIOPlugin::importFormats() const { QList formatList; formatList << Format("Breuckmann File Format" , tr("BRE")); @@ -171,7 +171,7 @@ QList BreMeshIOPlugin::importFormats() const /* returns the list of the file's type which can be exported */ -QList BreMeshIOPlugin::exportFormats() const +QList BreMeshIOPlugin::exportFormats() const { QList formatList; //formatList << Format("Breuckmann File Format" , tr("BRE")); diff --git a/src/meshlabplugins/io_bre/io_bre.h b/src/meshlabplugins/io_bre/io_bre.h index fc0b572b8..f9cb3b373 100644 --- a/src/meshlabplugins/io_bre/io_bre.h +++ b/src/meshlabplugins/io_bre/io_bre.h @@ -23,7 +23,8 @@ #ifndef IOBREPLUGIN_H #define IOBREPLUGIN_H -#include +#include +#include namespace vcg { namespace tri { @@ -149,15 +150,15 @@ namespace io { }//namespace tri }//namespace vcg -class BreMeshIOPlugin : public QObject, public MeshIOInterface +class BreMeshIOPlugin : public QObject, public IOPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_IO_INTERFACE_IID) - Q_INTERFACES(MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(IO_PLUGIN_INTERFACE_IID) + Q_INTERFACES(IOPluginInterface) public: - BreMeshIOPlugin() : MeshIOInterface() {} + BreMeshIOPlugin() : IOPluginInterface() {} QString pluginName() const; QList importFormats() const; diff --git a/src/meshlabplugins/io_collada/io_collada.cpp b/src/meshlabplugins/io_collada/io_collada.cpp index bcd1edec2..601c2d9cf 100644 --- a/src/meshlabplugins/io_collada/io_collada.cpp +++ b/src/meshlabplugins/io_collada/io_collada.cpp @@ -88,6 +88,8 @@ #include #include +#include +#include #include "io_collada.h" @@ -217,7 +219,7 @@ QString ColladaIOPlugin::pluginName() const return "IOCollada"; } -QList ColladaIOPlugin::importFormats() const +QList ColladaIOPlugin::importFormats() const { QList formatList; formatList << Format("Collada File Format" ,tr("DAE")); @@ -227,7 +229,7 @@ QList ColladaIOPlugin::importFormats() const /* returns the list of the file's type which can be exported */ -QList ColladaIOPlugin::exportFormats() const +QList ColladaIOPlugin::exportFormats() const { QList formatList; formatList << Format("Collada File Format" ,tr("DAE")); diff --git a/src/meshlabplugins/io_collada/io_collada.h b/src/meshlabplugins/io_collada/io_collada.h index e2f0170a1..82bb7aceb 100644 --- a/src/meshlabplugins/io_collada/io_collada.h +++ b/src/meshlabplugins/io_collada/io_collada.h @@ -44,13 +44,14 @@ #define COLLADAIOPLUGIN_H #include -#include +#include +#include -class ColladaIOPlugin : public QObject, public MeshIOInterface +class ColladaIOPlugin : public QObject, public IOPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_IO_INTERFACE_IID) - Q_INTERFACES(MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(IO_PLUGIN_INTERFACE_IID) + Q_INTERFACES(IOPluginInterface) public: //std::map _mp; diff --git a/src/meshlabplugins/io_ctm/io_ctm.cpp b/src/meshlabplugins/io_ctm/io_ctm.cpp index 6c07d1154..8ed221c3e 100644 --- a/src/meshlabplugins/io_ctm/io_ctm.cpp +++ b/src/meshlabplugins/io_ctm/io_ctm.cpp @@ -71,7 +71,7 @@ QString IOMPlugin::pluginName() const return "IOCTM"; } -QList IOMPlugin::importFormats() const +QList IOMPlugin::importFormats() const { QList formatList; formatList << Format("OpenCTM compressed format" ,tr("CTM")); @@ -81,7 +81,7 @@ QList IOMPlugin::importFormats() const /* returns the list of the file's type which can be exported */ -QList IOMPlugin::exportFormats() const +QList IOMPlugin::exportFormats() const { QList formatList; formatList << Format("OpenCTM compressed format" ,tr("CTM")); diff --git a/src/meshlabplugins/io_ctm/io_ctm.h b/src/meshlabplugins/io_ctm/io_ctm.h index c720bb3e9..dc0e1b013 100644 --- a/src/meshlabplugins/io_ctm/io_ctm.h +++ b/src/meshlabplugins/io_ctm/io_ctm.h @@ -31,13 +31,14 @@ #include -#include +#include +#include -class IOMPlugin : public QObject, public MeshIOInterface +class IOMPlugin : public QObject, public IOPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_IO_INTERFACE_IID) - Q_INTERFACES(MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(IO_PLUGIN_INTERFACE_IID) + Q_INTERFACES(IOPluginInterface) public: diff --git a/src/meshlabplugins/io_expe/io_expe.cpp b/src/meshlabplugins/io_expe/io_expe.cpp index 207bba10f..5caa4e561 100644 --- a/src/meshlabplugins/io_expe/io_expe.cpp +++ b/src/meshlabplugins/io_expe/io_expe.cpp @@ -150,7 +150,7 @@ QString ExpeIOPlugin::pluginName() const return "IOExpe"; } -QList ExpeIOPlugin::importFormats() const +QList ExpeIOPlugin::importFormats() const { QList formatList; formatList << Format("Expe's point set (binary)" ,tr("pts")); @@ -162,7 +162,7 @@ QList ExpeIOPlugin::importFormats() const /* returns the list of the file's type which can be exported */ -QList ExpeIOPlugin::exportFormats() const +QList ExpeIOPlugin::exportFormats() const { QList formatList; // formatList << Format("Expe's point set (binary)" ,tr("pts")); diff --git a/src/meshlabplugins/io_expe/io_expe.h b/src/meshlabplugins/io_expe/io_expe.h index 1ddc91222..17cbd9cb2 100644 --- a/src/meshlabplugins/io_expe/io_expe.h +++ b/src/meshlabplugins/io_expe/io_expe.h @@ -26,13 +26,14 @@ #include -#include +#include +#include -class ExpeIOPlugin : public QObject, public MeshIOInterface +class ExpeIOPlugin : public QObject, public IOPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_IO_INTERFACE_IID) - Q_INTERFACES(MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(IO_PLUGIN_INTERFACE_IID) + Q_INTERFACES(IOPluginInterface) public: diff --git a/src/meshlabplugins/io_json/io_json.cpp b/src/meshlabplugins/io_json/io_json.cpp index 0f6d6fff9..c17aaf458 100644 --- a/src/meshlabplugins/io_json/io_json.cpp +++ b/src/meshlabplugins/io_json/io_json.cpp @@ -30,7 +30,7 @@ #include #include -JSONIOPlugin::JSONIOPlugin(void) : MeshIOInterface() +JSONIOPlugin::JSONIOPlugin(void) : IOPluginInterface() { ; } @@ -426,7 +426,7 @@ bool JSONIOPlugin::save(const QString & formatName,const QString & fileName, Mes /* returns the list of the file's type which can be imported */ -QList JSONIOPlugin::importFormats(void) const +QList JSONIOPlugin::importFormats(void) const { QList formatList; //formatList << Format("JavaScript JSON", tr("JSON")); @@ -436,7 +436,7 @@ QList JSONIOPlugin::importFormats(void) const /* returns the list of the file's type which can be exported */ -QList JSONIOPlugin::exportFormats(void) const +QList JSONIOPlugin::exportFormats(void) const { QList formatList; formatList << Format("JavaScript JSON", tr("JSON")); diff --git a/src/meshlabplugins/io_json/io_json.h b/src/meshlabplugins/io_json/io_json.h index afee1f9a7..333286cca 100644 --- a/src/meshlabplugins/io_json/io_json.h +++ b/src/meshlabplugins/io_json/io_json.h @@ -23,13 +23,14 @@ #ifndef JSONIOPLUGIN_H #define JSONIOPLUGIN_H -#include +#include +#include -class JSONIOPlugin : public QObject, public MeshIOInterface +class JSONIOPlugin : public QObject, public IOPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_IO_INTERFACE_IID) - Q_INTERFACES(MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(IO_PLUGIN_INTERFACE_IID) + Q_INTERFACES(IOPluginInterface) public: diff --git a/src/meshlabplugins/io_pdb/io_pdb.cpp b/src/meshlabplugins/io_pdb/io_pdb.cpp index 610ac6f04..4383a493b 100644 --- a/src/meshlabplugins/io_pdb/io_pdb.cpp +++ b/src/meshlabplugins/io_pdb/io_pdb.cpp @@ -148,7 +148,7 @@ QString PDBIOPlugin::pluginName() const return "IOPDB"; } -QList PDBIOPlugin::importFormats() const +QList PDBIOPlugin::importFormats() const { QList formatList; formatList << Format("Protein Data Bank" , tr("PDB")); @@ -159,7 +159,7 @@ QList PDBIOPlugin::importFormats() const /* returns the list of the file's type which can be exported */ -QList PDBIOPlugin::exportFormats() const +QList PDBIOPlugin::exportFormats() const { QList formatList; // formatList << Format("Stanford Polygon File Format" , tr("PLY")); diff --git a/src/meshlabplugins/io_pdb/io_pdb.h b/src/meshlabplugins/io_pdb/io_pdb.h index 562a10085..d211d9867 100644 --- a/src/meshlabplugins/io_pdb/io_pdb.h +++ b/src/meshlabplugins/io_pdb/io_pdb.h @@ -24,14 +24,14 @@ #ifndef PDBIOPLUGIN_H #define PDBIOPLUGIN_H +#include +#include -#include - -class PDBIOPlugin : public QObject, public MeshIOInterface +class PDBIOPlugin : public QObject, public IOPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_IO_INTERFACE_IID) - Q_INTERFACES(MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(IO_PLUGIN_INTERFACE_IID) + Q_INTERFACES(IOPluginInterface) public: diff --git a/src/meshlabplugins/io_tri/io_tri.cpp b/src/meshlabplugins/io_tri/io_tri.cpp index 2f1f113a7..0eff96a30 100755 --- a/src/meshlabplugins/io_tri/io_tri.cpp +++ b/src/meshlabplugins/io_tri/io_tri.cpp @@ -87,7 +87,7 @@ QString TriIOPlugin::pluginName() const return "IOTRI"; } -QList TriIOPlugin::importFormats() const +QList TriIOPlugin::importFormats() const { QList formatList; formatList @@ -99,7 +99,7 @@ QList TriIOPlugin::importFormats() const /* returns the list of the file's type which can be exported */ -QList TriIOPlugin::exportFormats() const +QList TriIOPlugin::exportFormats() const { QList formatList; return formatList; diff --git a/src/meshlabplugins/io_tri/io_tri.h b/src/meshlabplugins/io_tri/io_tri.h index 6047d439e..6b3615a05 100755 --- a/src/meshlabplugins/io_tri/io_tri.h +++ b/src/meshlabplugins/io_tri/io_tri.h @@ -31,13 +31,14 @@ #include -#include +#include +#include -class TriIOPlugin : public QObject, public MeshIOInterface +class TriIOPlugin : public QObject, public IOPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_IO_INTERFACE_IID) - Q_INTERFACES(MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(IO_PLUGIN_INTERFACE_IID) + Q_INTERFACES(IOPluginInterface) public: diff --git a/src/meshlabplugins/io_txt/io_txt.cpp b/src/meshlabplugins/io_txt/io_txt.cpp index 04259e540..4b42d0b21 100755 --- a/src/meshlabplugins/io_txt/io_txt.cpp +++ b/src/meshlabplugins/io_txt/io_txt.cpp @@ -103,7 +103,7 @@ QString TxtIOPlugin::pluginName() const return "IOTXT"; } -QList TxtIOPlugin::importFormats() const +QList TxtIOPlugin::importFormats() const { QList formatList; formatList << Format("TXT (Generic ASCII point list)", tr("TXT")); @@ -114,7 +114,7 @@ QList TxtIOPlugin::importFormats() const /* returns the list of the file's type which can be exported */ -QList TxtIOPlugin::exportFormats() const +QList TxtIOPlugin::exportFormats() const { QList formatList; return formatList; diff --git a/src/meshlabplugins/io_txt/io_txt.h b/src/meshlabplugins/io_txt/io_txt.h index 026da498f..5bcd8b725 100755 --- a/src/meshlabplugins/io_txt/io_txt.h +++ b/src/meshlabplugins/io_txt/io_txt.h @@ -25,13 +25,14 @@ #include -#include +#include +#include -class TxtIOPlugin : public QObject, public MeshIOInterface +class TxtIOPlugin : public QObject, public IOPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_IO_INTERFACE_IID) - Q_INTERFACES(MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(IO_PLUGIN_INTERFACE_IID) + Q_INTERFACES(IOPluginInterface) public: diff --git a/src/meshlabplugins/io_u3d/io_u3d.cpp b/src/meshlabplugins/io_u3d/io_u3d.cpp index 0410f4a0c..fa8286edc 100644 --- a/src/meshlabplugins/io_u3d/io_u3d.cpp +++ b/src/meshlabplugins/io_u3d/io_u3d.cpp @@ -34,6 +34,8 @@ #include #include +#include +#include #include "Converter.h" using namespace std; @@ -41,7 +43,7 @@ using namespace vcg; U3DIOPlugin::U3DIOPlugin() -:QObject(),MeshIOInterface(),_param() +:QObject(),IOPluginInterface(),_param() { } @@ -125,7 +127,7 @@ QString U3DIOPlugin::pluginName() const return "IOU3D"; } -QList U3DIOPlugin::importFormats() const +QList U3DIOPlugin::importFormats() const { QList formatList; return formatList; @@ -134,7 +136,7 @@ QList U3DIOPlugin::importFormats() const /* returns the list of the file's type which can be exported */ -QList U3DIOPlugin::exportFormats() const +QList U3DIOPlugin::exportFormats() const { QList formatList; formatList << Format("U3D File Format" ,tr("U3D")); diff --git a/src/meshlabplugins/io_u3d/io_u3d.h b/src/meshlabplugins/io_u3d/io_u3d.h index 6ab1ba8c9..33b175fad 100644 --- a/src/meshlabplugins/io_u3d/io_u3d.h +++ b/src/meshlabplugins/io_u3d/io_u3d.h @@ -28,15 +28,16 @@ #include #include -#include +#include +#include #include #include -class U3DIOPlugin : public QObject, public MeshIOInterface +class U3DIOPlugin : public QObject, public IOPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_IO_INTERFACE_IID) - Q_INTERFACES(MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(IO_PLUGIN_INTERFACE_IID) + Q_INTERFACES(IOPluginInterface) public: QString pluginName() const; diff --git a/src/meshlabplugins/io_x3d/io_x3d.cpp b/src/meshlabplugins/io_x3d/io_x3d.cpp index 2222a9567..66f605d4f 100644 --- a/src/meshlabplugins/io_x3d/io_x3d.cpp +++ b/src/meshlabplugins/io_x3d/io_x3d.cpp @@ -155,7 +155,7 @@ QString IoX3DPlugin::pluginName() const return "IOX3D"; } -QList IoX3DPlugin::importFormats() const +QList IoX3DPlugin::importFormats() const { QList formatList; formatList << Format("X3D File Format - XML encoding", tr("X3D")); @@ -167,7 +167,7 @@ QList IoX3DPlugin::importFormats() const /* returns the list of the file's type which can be exported */ -QList IoX3DPlugin::exportFormats() const +QList IoX3DPlugin::exportFormats() const { QList formatList; formatList << Format("X3D File Format", tr("X3D")); diff --git a/src/meshlabplugins/io_x3d/io_x3d.h b/src/meshlabplugins/io_x3d/io_x3d.h index afd9ed202..03ccb6682 100644 --- a/src/meshlabplugins/io_x3d/io_x3d.h +++ b/src/meshlabplugins/io_x3d/io_x3d.h @@ -34,13 +34,14 @@ #include -#include +#include +#include -class IoX3DPlugin : public QObject, public MeshIOInterface +class IoX3DPlugin : public QObject, public IOPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_IO_INTERFACE_IID) - Q_INTERFACES(MeshIOInterface) + MESHLAB_PLUGIN_IID_EXPORTER(IO_PLUGIN_INTERFACE_IID) + Q_INTERFACES(IOPluginInterface) public: diff --git a/src/meshlabplugins/render_gdp/meshrender.cpp b/src/meshlabplugins/render_gdp/meshrender.cpp index 6a63d4cdf..86055ae1c 100644 --- a/src/meshlabplugins/render_gdp/meshrender.cpp +++ b/src/meshlabplugins/render_gdp/meshrender.cpp @@ -28,6 +28,8 @@ #include "meshrender.h" #include #include +#include +#include #include "../../meshlab/glarea.h" using namespace std; diff --git a/src/meshlabplugins/render_gdp/meshrender.h b/src/meshlabplugins/render_gdp/meshrender.h index b0cbb8228..aeb9ad289 100644 --- a/src/meshlabplugins/render_gdp/meshrender.h +++ b/src/meshlabplugins/render_gdp/meshrender.h @@ -25,17 +25,17 @@ #define SHADERRENDERPLUGIN_H #include -#include +#include #include "textfile.h" #include "shaderStructs.h" #include "shaderDialog.h" -class MeshShaderRenderPlugin : public QObject, public MeshRenderInterface +class MeshShaderRenderPlugin : public QObject, public RenderPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_RENDER_INTERFACE_IID) - Q_INTERFACES(MeshRenderInterface) + MESHLAB_PLUGIN_IID_EXPORTER(RENDER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(RenderPluginInterface) GLhandleARB v; GLhandleARB f; diff --git a/src/meshlabplugins/render_radiance_scaling/radianceScalingRenderer.h b/src/meshlabplugins/render_radiance_scaling/radianceScalingRenderer.h index 424a963b3..d245319a9 100644 --- a/src/meshlabplugins/render_radiance_scaling/radianceScalingRenderer.h +++ b/src/meshlabplugins/render_radiance_scaling/radianceScalingRenderer.h @@ -24,7 +24,7 @@ #define RADIANCESCALINGRENDERER_H #include -#include +#include #include #include @@ -35,10 +35,10 @@ #include "framebufferObject.h" #include "texture2D.h" -class RadianceScalingRendererPlugin : public QObject, public MeshRenderInterface { +class RadianceScalingRendererPlugin : public QObject, public RenderPluginInterface { Q_OBJECT - MESHLAB_PLUGIN_IID_EXPORTER(MESH_RENDER_INTERFACE_IID) - Q_INTERFACES(MeshRenderInterface) + MESHLAB_PLUGIN_IID_EXPORTER(RENDER_PLUGIN_INTERFACE_IID) + Q_INTERFACES(RenderPluginInterface) bool _supported; QList _actionList; diff --git a/src/meshlabserver/mainserver.cpp b/src/meshlabserver/mainserver.cpp index 90e70d98e..aa0bc8cff 100644 --- a/src/meshlabserver/mainserver.cpp +++ b/src/meshlabserver/mainserver.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -38,6 +37,8 @@ #include #include +#include +#include class FilterData @@ -89,7 +90,7 @@ public: void dumpPluginInfoWiki(FILE *fp) { if(!fp) return; - foreach(MeshFilterInterface *iFilter, PM.meshFilterPlugins()) + foreach(FilterPluginInterface *iFilter, PM.meshFilterPlugins()) foreach(QAction *filterAction, iFilter->actions()) fprintf(fp, "*%s
%s
\n", qUtf8Printable(filterAction->text()), qUtf8Printable(iFilter->filterInfo(filterAction))); } @@ -102,7 +103,7 @@ public: fprintf(fp,"/*! \\mainpage MeshLab Filter Documentation\n"); //fprintf(fp,"\\AtBeginDocument{\\setcounter{tocdepth}{1}}"); - foreach(MeshFilterInterface *iFilter, PM.meshFilterPlugins()) + foreach(FilterPluginInterface *iFilter, PM.meshFilterPlugins()) { foreach(QAction *filterAction, iFilter->actions()) { @@ -138,7 +139,7 @@ public: // HashTable storing all supported formats together with // the (1-based) index of first plugin which is able to open it - QHash allKnownFormats; + QHash allKnownFormats; //PM.LoadFormats(filters, allKnownFormats,PluginManager::IMPORT); @@ -150,7 +151,7 @@ public: QString extension = fi.suffix(); qDebug("Opening a file with extension %s", qUtf8Printable(extension)); // retrieving corresponding IO plugin - MeshIOInterface* pCurrentIOPlugin = PM.allKnowInputFormats[extension.toLower()]; + IOPluginInterface* pCurrentIOPlugin = PM.allKnowInputFormats[extension.toLower()]; if (pCurrentIOPlugin == 0) { fprintf(fp,"Error encountered while opening file: "); @@ -215,7 +216,7 @@ public: QString extension = fi.suffix(); // retrieving corresponding IO plugin - MeshIOInterface* pCurrentIOPlugin = PM.allKnowOutputFormats[extension.toLower()]; + IOPluginInterface* pCurrentIOPlugin = PM.allKnowOutputFormats[extension.toLower()]; if (pCurrentIOPlugin == 0) { fprintf(fp,"Error encountered while opening file: "); @@ -245,7 +246,7 @@ public: return true; } - bool loadMesh(const QString& fileName, MeshIOInterface *pCurrentIOPlugin, MeshModel* mm, int& mask,RichParameterList* prePar, const Matrix44m &mtr, MeshDocument* md, FILE* fp = stdout) + bool loadMesh(const QString& fileName, IOPluginInterface *pCurrentIOPlugin, MeshModel* mm, int& mask,RichParameterList* prePar, const Matrix44m &mtr, MeshDocument* md, FILE* fp = stdout) { if (mm == NULL) return false; @@ -380,7 +381,7 @@ public: mm->Clear(); QFileInfo fi(fullPath); QString extension = fi.suffix(); - MeshIOInterface *pCurrentIOPlugin = PM.allKnowInputFormats[extension.toLower()]; + IOPluginInterface *pCurrentIOPlugin = PM.allKnowInputFormats[extension.toLower()]; if(pCurrentIOPlugin != NULL) { @@ -585,7 +586,7 @@ public: return false; } - MeshFilterInterface *iFilter = qobject_cast(action->parent()); + FilterPluginInterface *iFilter = qobject_cast(action->parent()); iFilter->setLog(&log); int req = iFilter->getRequirements(action); if (mm != NULL) @@ -596,7 +597,7 @@ public: //So we have to ask to the filter the default values for all the parameters and integrate them with the parameters' values //defined in the script file. RichParameterList required; - iFilter->initParameterSet(action,meshDocument,required); + iFilter->initParameterList(action,meshDocument,required); RichParameterList ¶meterSet = pair.second; //The parameters in the script file are more than the required parameters of the filter. The script file is not correct. @@ -644,7 +645,7 @@ public: atts[MLRenderingData::ATT_NAMES::ATT_VERTPOSITION] = true; atts[MLRenderingData::ATT_NAMES::ATT_VERTNORMAL] = true; - if (iFilter->filterArity(action) == MeshFilterInterface::SINGLE_MESH) + if (iFilter->filterArity(action) == FilterPluginInterface::SINGLE_MESH) { MLRenderingData::PRIMITIVE_MODALITY pm = MLPoliciesStandAloneFunctions::bestPrimitiveModalityAccordingToMesh(meshDocument.mm()); if ((pm != MLRenderingData::PR_ARITY) && (meshDocument.mm() != NULL)) @@ -681,7 +682,8 @@ public: } } meshDocument.setBusy(true); - ret = iFilter->applyFilter( action, meshDocument, pair.second, filterCallBack); + unsigned int postConditionMask = MeshModel::MM_UNKNOWN; + ret = iFilter->applyFilter( action, meshDocument, postConditionMask, pair.second, filterCallBack); meshDocument.setBusy(false); if (shared != NULL) delete iFilter->glContext; diff --git a/src/meshlabplugins/edit_hole/CMakeLists.txt b/src/plugins_unsupported/edit_hole/CMakeLists.txt similarity index 100% rename from src/meshlabplugins/edit_hole/CMakeLists.txt rename to src/plugins_unsupported/edit_hole/CMakeLists.txt diff --git a/src/meshlabplugins/edit_hole/edit_hole.cpp b/src/plugins_unsupported/edit_hole/edit_hole.cpp similarity index 100% rename from src/meshlabplugins/edit_hole/edit_hole.cpp rename to src/plugins_unsupported/edit_hole/edit_hole.cpp diff --git a/src/meshlabplugins/edit_hole/edit_hole.h b/src/plugins_unsupported/edit_hole/edit_hole.h similarity index 100% rename from src/meshlabplugins/edit_hole/edit_hole.h rename to src/plugins_unsupported/edit_hole/edit_hole.h diff --git a/src/meshlabplugins/edit_hole/edit_hole.pro b/src/plugins_unsupported/edit_hole/edit_hole.pro similarity index 100% rename from src/meshlabplugins/edit_hole/edit_hole.pro rename to src/plugins_unsupported/edit_hole/edit_hole.pro diff --git a/src/meshlabplugins/edit_hole/edit_hole.qrc b/src/plugins_unsupported/edit_hole/edit_hole.qrc similarity index 100% rename from src/meshlabplugins/edit_hole/edit_hole.qrc rename to src/plugins_unsupported/edit_hole/edit_hole.qrc diff --git a/src/meshlabplugins/edit_hole/edit_hole.ui b/src/plugins_unsupported/edit_hole/edit_hole.ui similarity index 100% rename from src/meshlabplugins/edit_hole/edit_hole.ui rename to src/plugins_unsupported/edit_hole/edit_hole.ui diff --git a/src/meshlabplugins/edit_hole/edit_hole_factory.cpp b/src/plugins_unsupported/edit_hole/edit_hole_factory.cpp similarity index 100% rename from src/meshlabplugins/edit_hole/edit_hole_factory.cpp rename to src/plugins_unsupported/edit_hole/edit_hole_factory.cpp diff --git a/src/meshlabplugins/edit_hole/edit_hole_factory.h b/src/plugins_unsupported/edit_hole/edit_hole_factory.h similarity index 100% rename from src/meshlabplugins/edit_hole/edit_hole_factory.h rename to src/plugins_unsupported/edit_hole/edit_hole_factory.h diff --git a/src/meshlabplugins/edit_hole/fgtBridge.h b/src/plugins_unsupported/edit_hole/fgtBridge.h similarity index 100% rename from src/meshlabplugins/edit_hole/fgtBridge.h rename to src/plugins_unsupported/edit_hole/fgtBridge.h diff --git a/src/meshlabplugins/edit_hole/fgtHole.h b/src/plugins_unsupported/edit_hole/fgtHole.h similarity index 100% rename from src/meshlabplugins/edit_hole/fgtHole.h rename to src/plugins_unsupported/edit_hole/fgtHole.h diff --git a/src/meshlabplugins/edit_hole/fillerDialog.cpp b/src/plugins_unsupported/edit_hole/fillerDialog.cpp similarity index 100% rename from src/meshlabplugins/edit_hole/fillerDialog.cpp rename to src/plugins_unsupported/edit_hole/fillerDialog.cpp diff --git a/src/meshlabplugins/edit_hole/fillerDialog.h b/src/plugins_unsupported/edit_hole/fillerDialog.h similarity index 100% rename from src/meshlabplugins/edit_hole/fillerDialog.h rename to src/plugins_unsupported/edit_hole/fillerDialog.h diff --git a/src/meshlabplugins/edit_hole/holeListModel.cpp b/src/plugins_unsupported/edit_hole/holeListModel.cpp similarity index 100% rename from src/meshlabplugins/edit_hole/holeListModel.cpp rename to src/plugins_unsupported/edit_hole/holeListModel.cpp diff --git a/src/meshlabplugins/edit_hole/holeListModel.h b/src/plugins_unsupported/edit_hole/holeListModel.h similarity index 100% rename from src/meshlabplugins/edit_hole/holeListModel.h rename to src/plugins_unsupported/edit_hole/holeListModel.h diff --git a/src/meshlabplugins/edit_hole/holeSetManager.h b/src/plugins_unsupported/edit_hole/holeSetManager.h similarity index 100% rename from src/meshlabplugins/edit_hole/holeSetManager.h rename to src/plugins_unsupported/edit_hole/holeSetManager.h diff --git a/src/meshlabplugins/edit_hole/images/bridgeCursor.png b/src/plugins_unsupported/edit_hole/images/bridgeCursor.png similarity index 100% rename from src/meshlabplugins/edit_hole/images/bridgeCursor.png rename to src/plugins_unsupported/edit_hole/images/bridgeCursor.png diff --git a/src/meshlabplugins/edit_hole/images/bridgeCursor1.png b/src/plugins_unsupported/edit_hole/images/bridgeCursor1.png similarity index 100% rename from src/meshlabplugins/edit_hole/images/bridgeCursor1.png rename to src/plugins_unsupported/edit_hole/images/bridgeCursor1.png diff --git a/src/meshlabplugins/edit_hole/images/hole_filler.png b/src/plugins_unsupported/edit_hole/images/hole_filler.png similarity index 100% rename from src/meshlabplugins/edit_hole/images/hole_filler.png rename to src/plugins_unsupported/edit_hole/images/hole_filler.png diff --git a/src/meshlabplugins/edit_slice/CMakeLists.txt b/src/plugins_unsupported/edit_slice/CMakeLists.txt similarity index 100% rename from src/meshlabplugins/edit_slice/CMakeLists.txt rename to src/plugins_unsupported/edit_slice/CMakeLists.txt diff --git a/src/meshlabplugins/edit_slice/edit_slice_factory.cpp b/src/plugins_unsupported/edit_slice/edit_slice_factory.cpp similarity index 100% rename from src/meshlabplugins/edit_slice/edit_slice_factory.cpp rename to src/plugins_unsupported/edit_slice/edit_slice_factory.cpp diff --git a/src/meshlabplugins/edit_slice/edit_slice_factory.h b/src/plugins_unsupported/edit_slice/edit_slice_factory.h similarity index 100% rename from src/meshlabplugins/edit_slice/edit_slice_factory.h rename to src/plugins_unsupported/edit_slice/edit_slice_factory.h diff --git a/src/meshlabplugins/edit_slice/editslice.cpp b/src/plugins_unsupported/edit_slice/editslice.cpp similarity index 100% rename from src/meshlabplugins/edit_slice/editslice.cpp rename to src/plugins_unsupported/edit_slice/editslice.cpp diff --git a/src/meshlabplugins/edit_slice/editslice.h b/src/plugins_unsupported/edit_slice/editslice.h similarity index 100% rename from src/meshlabplugins/edit_slice/editslice.h rename to src/plugins_unsupported/edit_slice/editslice.h diff --git a/src/meshlabplugins/edit_slice/editslice.pro b/src/plugins_unsupported/edit_slice/editslice.pro similarity index 100% rename from src/meshlabplugins/edit_slice/editslice.pro rename to src/plugins_unsupported/edit_slice/editslice.pro diff --git a/src/meshlabplugins/edit_slice/images/iconslice.png b/src/plugins_unsupported/edit_slice/images/iconslice.png similarity index 100% rename from src/meshlabplugins/edit_slice/images/iconslice.png rename to src/plugins_unsupported/edit_slice/images/iconslice.png diff --git a/src/meshlabplugins/edit_slice/meshlab.qrc b/src/plugins_unsupported/edit_slice/meshlab.qrc similarity index 100% rename from src/meshlabplugins/edit_slice/meshlab.qrc rename to src/plugins_unsupported/edit_slice/meshlab.qrc diff --git a/src/meshlabplugins/edit_slice/slicedialog.cpp b/src/plugins_unsupported/edit_slice/slicedialog.cpp similarity index 100% rename from src/meshlabplugins/edit_slice/slicedialog.cpp rename to src/plugins_unsupported/edit_slice/slicedialog.cpp diff --git a/src/meshlabplugins/edit_slice/slicedialog.h b/src/plugins_unsupported/edit_slice/slicedialog.h similarity index 100% rename from src/meshlabplugins/edit_slice/slicedialog.h rename to src/plugins_unsupported/edit_slice/slicedialog.h diff --git a/src/meshlabplugins/edit_slice/slicedialog.ui b/src/plugins_unsupported/edit_slice/slicedialog.ui similarity index 100% rename from src/meshlabplugins/edit_slice/slicedialog.ui rename to src/plugins_unsupported/edit_slice/slicedialog.ui diff --git a/src/meshlabplugins/edit_slice/svgpro.cpp b/src/plugins_unsupported/edit_slice/svgpro.cpp similarity index 100% rename from src/meshlabplugins/edit_slice/svgpro.cpp rename to src/plugins_unsupported/edit_slice/svgpro.cpp diff --git a/src/meshlabplugins/edit_slice/svgpro.h b/src/plugins_unsupported/edit_slice/svgpro.h similarity index 100% rename from src/meshlabplugins/edit_slice/svgpro.h rename to src/plugins_unsupported/edit_slice/svgpro.h diff --git a/src/meshlabplugins/edit_slice/svgpro.ui b/src/plugins_unsupported/edit_slice/svgpro.ui similarity index 100% rename from src/meshlabplugins/edit_slice/svgpro.ui rename to src/plugins_unsupported/edit_slice/svgpro.ui diff --git a/src/meshlabplugins/edit_texture/CMakeLists.txt b/src/plugins_unsupported/edit_texture/CMakeLists.txt similarity index 100% rename from src/meshlabplugins/edit_texture/CMakeLists.txt rename to src/plugins_unsupported/edit_texture/CMakeLists.txt diff --git a/src/meshlabplugins/edit_texture/edit_texture.pro b/src/plugins_unsupported/edit_texture/edit_texture.pro similarity index 100% rename from src/meshlabplugins/edit_texture/edit_texture.pro rename to src/plugins_unsupported/edit_texture/edit_texture.pro diff --git a/src/meshlabplugins/edit_texture/edit_texture_factory.cpp b/src/plugins_unsupported/edit_texture/edit_texture_factory.cpp similarity index 100% rename from src/meshlabplugins/edit_texture/edit_texture_factory.cpp rename to src/plugins_unsupported/edit_texture/edit_texture_factory.cpp diff --git a/src/meshlabplugins/edit_texture/edit_texture_factory.h b/src/plugins_unsupported/edit_texture/edit_texture_factory.h similarity index 100% rename from src/meshlabplugins/edit_texture/edit_texture_factory.h rename to src/plugins_unsupported/edit_texture/edit_texture_factory.h diff --git a/src/meshlabplugins/edit_texture/edittexture.cpp b/src/plugins_unsupported/edit_texture/edittexture.cpp similarity index 100% rename from src/meshlabplugins/edit_texture/edittexture.cpp rename to src/plugins_unsupported/edit_texture/edittexture.cpp diff --git a/src/meshlabplugins/edit_texture/edittexture.h b/src/plugins_unsupported/edit_texture/edittexture.h similarity index 100% rename from src/meshlabplugins/edit_texture/edittexture.h rename to src/plugins_unsupported/edit_texture/edittexture.h diff --git a/src/meshlabplugins/edit_texture/images/collapse.png b/src/plugins_unsupported/edit_texture/images/collapse.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/collapse.png rename to src/plugins_unsupported/edit_texture/images/collapse.png diff --git a/src/meshlabplugins/edit_texture/images/edit_texture.png b/src/plugins_unsupported/edit_texture/images/edit_texture.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/edit_texture.png rename to src/plugins_unsupported/edit_texture/images/edit_texture.png diff --git a/src/meshlabplugins/edit_texture/images/flipH.png b/src/plugins_unsupported/edit_texture/images/flipH.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/flipH.png rename to src/plugins_unsupported/edit_texture/images/flipH.png diff --git a/src/meshlabplugins/edit_texture/images/flipV.png b/src/plugins_unsupported/edit_texture/images/flipV.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/flipV.png rename to src/plugins_unsupported/edit_texture/images/flipV.png diff --git a/src/meshlabplugins/edit_texture/images/invertsel.png b/src/plugins_unsupported/edit_texture/images/invertsel.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/invertsel.png rename to src/plugins_unsupported/edit_texture/images/invertsel.png diff --git a/src/meshlabplugins/edit_texture/images/rotate.png b/src/plugins_unsupported/edit_texture/images/rotate.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/rotate.png rename to src/plugins_unsupported/edit_texture/images/rotate.png diff --git a/src/meshlabplugins/edit_texture/images/scale.png b/src/plugins_unsupported/edit_texture/images/scale.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/scale.png rename to src/plugins_unsupported/edit_texture/images/scale.png diff --git a/src/meshlabplugins/edit_texture/images/sel_rect.png b/src/plugins_unsupported/edit_texture/images/sel_rect.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/sel_rect.png rename to src/plugins_unsupported/edit_texture/images/sel_rect.png diff --git a/src/meshlabplugins/edit_texture/images/sel_rect_minus.png b/src/plugins_unsupported/edit_texture/images/sel_rect_minus.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/sel_rect_minus.png rename to src/plugins_unsupported/edit_texture/images/sel_rect_minus.png diff --git a/src/meshlabplugins/edit_texture/images/sel_rect_plus.png b/src/plugins_unsupported/edit_texture/images/sel_rect_plus.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/sel_rect_plus.png rename to src/plugins_unsupported/edit_texture/images/sel_rect_plus.png diff --git a/src/meshlabplugins/edit_texture/images/selarea.png b/src/plugins_unsupported/edit_texture/images/selarea.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/selarea.png rename to src/plugins_unsupported/edit_texture/images/selarea.png diff --git a/src/meshlabplugins/edit_texture/images/selcanc.png b/src/plugins_unsupported/edit_texture/images/selcanc.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/selcanc.png rename to src/plugins_unsupported/edit_texture/images/selcanc.png diff --git a/src/meshlabplugins/edit_texture/images/selcon.png b/src/plugins_unsupported/edit_texture/images/selcon.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/selcon.png rename to src/plugins_unsupported/edit_texture/images/selcon.png diff --git a/src/meshlabplugins/edit_texture/images/selpan.png b/src/plugins_unsupported/edit_texture/images/selpan.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/selpan.png rename to src/plugins_unsupported/edit_texture/images/selpan.png diff --git a/src/meshlabplugins/edit_texture/images/selver.png b/src/plugins_unsupported/edit_texture/images/selver.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/selver.png rename to src/plugins_unsupported/edit_texture/images/selver.png diff --git a/src/meshlabplugins/edit_texture/images/unify.png b/src/plugins_unsupported/edit_texture/images/unify.png similarity index 100% rename from src/meshlabplugins/edit_texture/images/unify.png rename to src/plugins_unsupported/edit_texture/images/unify.png diff --git a/src/meshlabplugins/edit_texture/meshlab.qrc b/src/plugins_unsupported/edit_texture/meshlab.qrc similarity index 100% rename from src/meshlabplugins/edit_texture/meshlab.qrc rename to src/plugins_unsupported/edit_texture/meshlab.qrc diff --git a/src/meshlabplugins/edit_texture/renderarea.cpp b/src/plugins_unsupported/edit_texture/renderarea.cpp similarity index 100% rename from src/meshlabplugins/edit_texture/renderarea.cpp rename to src/plugins_unsupported/edit_texture/renderarea.cpp diff --git a/src/meshlabplugins/edit_texture/renderarea.h b/src/plugins_unsupported/edit_texture/renderarea.h similarity index 100% rename from src/meshlabplugins/edit_texture/renderarea.h rename to src/plugins_unsupported/edit_texture/renderarea.h diff --git a/src/meshlabplugins/edit_texture/textureeditor.cpp b/src/plugins_unsupported/edit_texture/textureeditor.cpp similarity index 100% rename from src/meshlabplugins/edit_texture/textureeditor.cpp rename to src/plugins_unsupported/edit_texture/textureeditor.cpp diff --git a/src/meshlabplugins/edit_texture/textureeditor.h b/src/plugins_unsupported/edit_texture/textureeditor.h similarity index 100% rename from src/meshlabplugins/edit_texture/textureeditor.h rename to src/plugins_unsupported/edit_texture/textureeditor.h diff --git a/src/meshlabplugins/edit_texture/textureeditor.ui b/src/plugins_unsupported/edit_texture/textureeditor.ui similarity index 100% rename from src/meshlabplugins/edit_texture/textureeditor.ui rename to src/plugins_unsupported/edit_texture/textureeditor.ui diff --git a/src/meshlabplugins/filter_aging/CMakeLists.txt b/src/plugins_unsupported/filter_aging/CMakeLists.txt similarity index 100% rename from src/meshlabplugins/filter_aging/CMakeLists.txt rename to src/plugins_unsupported/filter_aging/CMakeLists.txt diff --git a/src/meshlabplugins/filter_aging/edgepred.h b/src/plugins_unsupported/filter_aging/edgepred.h similarity index 100% rename from src/meshlabplugins/filter_aging/edgepred.h rename to src/plugins_unsupported/filter_aging/edgepred.h diff --git a/src/meshlabplugins/filter_aging/filter_aging.cpp b/src/plugins_unsupported/filter_aging/filter_aging.cpp similarity index 100% rename from src/meshlabplugins/filter_aging/filter_aging.cpp rename to src/plugins_unsupported/filter_aging/filter_aging.cpp diff --git a/src/meshlabplugins/filter_aging/filter_aging.h b/src/plugins_unsupported/filter_aging/filter_aging.h similarity index 100% rename from src/meshlabplugins/filter_aging/filter_aging.h rename to src/plugins_unsupported/filter_aging/filter_aging.h diff --git a/src/meshlabplugins/filter_aging/filter_aging.pro b/src/plugins_unsupported/filter_aging/filter_aging.pro similarity index 100% rename from src/meshlabplugins/filter_aging/filter_aging.pro rename to src/plugins_unsupported/filter_aging/filter_aging.pro diff --git a/src/meshlabplugins/filter_bnpts/CMakeLists.txt b/src/plugins_unsupported/filter_bnpts/CMakeLists.txt similarity index 100% rename from src/meshlabplugins/filter_bnpts/CMakeLists.txt rename to src/plugins_unsupported/filter_bnpts/CMakeLists.txt diff --git a/src/meshlabplugins/filter_bnpts/filter_bnpts.cpp b/src/plugins_unsupported/filter_bnpts/filter_bnpts.cpp similarity index 100% rename from src/meshlabplugins/filter_bnpts/filter_bnpts.cpp rename to src/plugins_unsupported/filter_bnpts/filter_bnpts.cpp diff --git a/src/meshlabplugins/filter_bnpts/filter_bnpts.h b/src/plugins_unsupported/filter_bnpts/filter_bnpts.h similarity index 100% rename from src/meshlabplugins/filter_bnpts/filter_bnpts.h rename to src/plugins_unsupported/filter_bnpts/filter_bnpts.h diff --git a/src/meshlabplugins/filter_bnpts/filter_bnpts.pro b/src/plugins_unsupported/filter_bnpts/filter_bnpts.pro similarity index 100% rename from src/meshlabplugins/filter_bnpts/filter_bnpts.pro rename to src/plugins_unsupported/filter_bnpts/filter_bnpts.pro diff --git a/vcglib b/vcglib index d33a25db2..62f16491e 160000 --- a/vcglib +++ b/vcglib @@ -1 +1 @@ -Subproject commit d33a25db2dfc63d74d9c40a7f0bd40633c4b8142 +Subproject commit 62f16491ea1835dced9da876bff9cb3f56f8b7f6
Hop Thr:%8.3f (Wheel to change it)
Radius: %8.3f (Drag or Alt+Wheel to change it)