From e0e3780581899eb2423a6e170a3d02d5d43c7ca6 Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Mon, 30 Nov 2020 16:08:26 +0100 Subject: [PATCH 1/5] first draft of singletons collection class --- src/common/CMakeLists.txt | 6 ++- src/common/common.pro | 6 ++- src/common/meshlab_singletons.cpp | 29 ++++++++++++ src/common/meshlab_singletons.h | 47 +++++++++++++++++++ .../{pluginmanager.cpp => plugin_manager.cpp} | 25 +++++++++- .../{pluginmanager.h => plugin_manager.h} | 10 ++-- src/meshlab/mainwindow.h | 4 +- .../decorate_background.cpp | 2 +- .../decorate_raster_proj.cpp | 4 -- .../decorate_shadow/shadow_mapping.cpp | 2 +- src/meshlabplugins/decorate_shadow/ssao.cpp | 2 +- .../variance_shadow_mapping.cpp | 2 +- .../variance_shadow_mapping_blur.cpp | 2 +- .../filter_img_patch_param/TexturePainter.cpp | 2 +- .../VisibilityCheck.cpp | 4 -- src/meshlabplugins/io_u3d/io_u3d.cpp | 17 ------- src/meshlabplugins/io_u3d/io_u3d.h | 2 - 17 files changed, 120 insertions(+), 46 deletions(-) create mode 100644 src/common/meshlab_singletons.cpp create mode 100644 src/common/meshlab_singletons.h rename src/common/{pluginmanager.cpp => plugin_manager.cpp} (87%) rename src/common/{pluginmanager.h => plugin_manager.h} (96%) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index f3265648e..9694790d0 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -32,6 +32,7 @@ set(HEADERS GLExtensionsManager.h GLLogStream.h filterscript.h + meshlab_singletons.h meshlabdocumentbundler.h meshlabdocumentxml.h ml_selection_buffers.h @@ -39,7 +40,7 @@ set(HEADERS ml_thread_safe_memory_info.h mlapplication.h mlexception.h - pluginmanager.h + plugin_manager.h searcher.h) set(SOURCES @@ -59,13 +60,14 @@ set(SOURCES GLExtensionsManager.cpp GLLogStream.cpp filterscript.cpp + meshlab_singletons.cpp meshlabdocumentbundler.cpp meshlabdocumentxml.cpp ml_selection_buffers.cpp ml_shared_data_context.cpp ml_thread_safe_memory_info.cpp mlapplication.cpp - pluginmanager.cpp + plugin_manager.cpp searcher.cpp ${EXTERNAL_DIR}/easyexif/exif.cpp) diff --git a/src/common/common.pro b/src/common/common.pro index c88d60d2e..3ae41a50a 100644 --- a/src/common/common.pro +++ b/src/common/common.pro @@ -63,7 +63,8 @@ HEADERS += \ ml_document/raster_model.h \ ml_document/render_raster.h \ utilities/file_format.h \ - pluginmanager.h \ + meshlab_singletons.h \ + plugin_manager.h \ mlexception.h \ mlapplication.h \ meshlabdocumentxml.h \ @@ -88,7 +89,8 @@ SOURCES += \ ml_document/mesh_document.cpp \ ml_document/raster_model.cpp \ ml_document/render_raster.cpp \ - pluginmanager.cpp \ + meshlab_singletons.cpp \ + plugin_manager.cpp \ mlapplication.cpp \ searcher.cpp \ meshlabdocumentxml.cpp \ diff --git a/src/common/meshlab_singletons.cpp b/src/common/meshlab_singletons.cpp new file mode 100644 index 000000000..d9f73f875 --- /dev/null +++ b/src/common/meshlab_singletons.cpp @@ -0,0 +1,29 @@ +#include "meshlab_singletons.h" + +#include "plugin_manager.h" + +namespace meshlab { + +MeshLabSingletons::MeshLabSingletons() +{ +} + +RichParameterList& MeshLabSingletons::globalRPLInstance() +{ + static RichParameterList globalRPS; + return globalRPS; +} + +PluginManager& MeshLabSingletons::pluginManagerInstance() +{ + static bool initialized = false; + static PluginManager pm; + if (!initialized){ + initialized = true; + RichParameterList& globalRPS = globalRPLInstance(); + pm.loadPlugins(globalRPS); + } + return pm; +} + +} //namespace meshlab diff --git a/src/common/meshlab_singletons.h b/src/common/meshlab_singletons.h new file mode 100644 index 000000000..3db455afc --- /dev/null +++ b/src/common/meshlab_singletons.h @@ -0,0 +1,47 @@ +/**************************************************************************** +* 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_SINGLETONS_H +#define MESHLAB_SINGLETONS_H + +class RichParameterList; +class PluginManager; + +namespace meshlab { + +class MeshLabSingletons +{ +public: + /** Singleton Instances **/ + static RichParameterList& globalRPLInstance(); + static PluginManager& pluginManagerInstance(); + + MeshLabSingletons(MeshLabSingletons const&) = delete; + void operator=(MeshLabSingletons const&) = delete; +private: + MeshLabSingletons(); +}; + +} + +#endif // MESHLAB_SINGLETONS_H diff --git a/src/common/pluginmanager.cpp b/src/common/plugin_manager.cpp similarity index 87% rename from src/common/pluginmanager.cpp rename to src/common/plugin_manager.cpp index 465e963aa..56ec52065 100644 --- a/src/common/pluginmanager.cpp +++ b/src/common/plugin_manager.cpp @@ -1,4 +1,27 @@ -#include "pluginmanager.h" +/**************************************************************************** +* 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. * +* * +****************************************************************************/ + +#include "plugin_manager.h" #include #include #include diff --git a/src/common/pluginmanager.h b/src/common/plugin_manager.h similarity index 96% rename from src/common/pluginmanager.h rename to src/common/plugin_manager.h index 4164cba52..978018fae 100644 --- a/src/common/pluginmanager.h +++ b/src/common/plugin_manager.h @@ -2,7 +2,7 @@ * MeshLab o o * * A versatile mesh processing toolbox o o * * _ O _ * -* Copyright(C) 2005 \/)\/ * +* Copyright(C) 2005-2020 \/)\/ * * Visual Computing Lab /\/| * * ISTI - Italian National Research Council | * * \ * @@ -21,8 +21,8 @@ * * ****************************************************************************/ -#ifndef PLUGINMANAGER_H -#define PLUGINMANAGER_H +#ifndef MESHLAB_PLUGIN_MANAGER_H +#define MESHLAB_PLUGIN_MANAGER_H #include "interfaces/filter_plugin_interface.h" #include "interfaces/iomesh_plugin_interface.h" @@ -31,8 +31,6 @@ #include "interfaces/decorate_plugin_interface.h" #include "interfaces/edit_plugin_interface.h" -//#include "scriptsyntax.h" - #include #include #include @@ -122,4 +120,4 @@ private: const QList& format); }; -#endif // PLUGINMANAGER_H +#endif // MESHLAB_PLUGIN_MANAGER_H diff --git a/src/meshlab/mainwindow.h b/src/meshlab/mainwindow.h index ac0c9d835..e2c83499d 100644 --- a/src/meshlab/mainwindow.h +++ b/src/meshlab/mainwindow.h @@ -29,8 +29,8 @@ #include -#include "../common/interfaces/mainwindow_interface.h" -#include "../common/pluginmanager.h" +#include "common/interfaces/mainwindow_interface.h" +#include "common/plugin_manager.h" #include diff --git a/src/meshlabplugins/decorate_background/decorate_background.cpp b/src/meshlabplugins/decorate_background/decorate_background.cpp index 57c4bef65..0b2464650 100644 --- a/src/meshlabplugins/decorate_background/decorate_background.cpp +++ b/src/meshlabplugins/decorate_background/decorate_background.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include using namespace vcg; diff --git a/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.cpp b/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.cpp index 9b7806fcf..08a6093be 100644 --- a/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.cpp +++ b/src/meshlabplugins/decorate_raster_proj/decorate_raster_proj.cpp @@ -24,13 +24,9 @@ #include "decorate_raster_proj.h" #include #include -#include #include #include - - - void DecorateRasterProjPlugin::MeshDrawer::drawShadow(QGLContext* glctx,MLSceneGLSharedDataContext* ctx) { if ((m_Mesh == NULL) || ( !m_Mesh->visible ) || (ctx == NULL)) diff --git a/src/meshlabplugins/decorate_shadow/shadow_mapping.cpp b/src/meshlabplugins/decorate_shadow/shadow_mapping.cpp index f652108ca..bf96eaded 100644 --- a/src/meshlabplugins/decorate_shadow/shadow_mapping.cpp +++ b/src/meshlabplugins/decorate_shadow/shadow_mapping.cpp @@ -24,7 +24,7 @@ #include #include "decorate_shader.h" #include "shadow_mapping.h" -#include +#include ShadowMapping::ShadowMapping(float intensity):DecorateShader() diff --git a/src/meshlabplugins/decorate_shadow/ssao.cpp b/src/meshlabplugins/decorate_shadow/ssao.cpp index cefb56026..7478eacab 100644 --- a/src/meshlabplugins/decorate_shadow/ssao.cpp +++ b/src/meshlabplugins/decorate_shadow/ssao.cpp @@ -24,7 +24,7 @@ #include #include "ssao.h" -#include +#include SSAO::SSAO(float radius):DecorateShader() { diff --git a/src/meshlabplugins/decorate_shadow/variance_shadow_mapping.cpp b/src/meshlabplugins/decorate_shadow/variance_shadow_mapping.cpp index b08bfbd1f..42de76329 100644 --- a/src/meshlabplugins/decorate_shadow/variance_shadow_mapping.cpp +++ b/src/meshlabplugins/decorate_shadow/variance_shadow_mapping.cpp @@ -23,7 +23,7 @@ #include "decorate_shader.h" #include "variance_shadow_mapping.h" -#include +#include #include diff --git a/src/meshlabplugins/decorate_shadow/variance_shadow_mapping_blur.cpp b/src/meshlabplugins/decorate_shadow/variance_shadow_mapping_blur.cpp index c3a07b967..fba2e06b5 100644 --- a/src/meshlabplugins/decorate_shadow/variance_shadow_mapping_blur.cpp +++ b/src/meshlabplugins/decorate_shadow/variance_shadow_mapping_blur.cpp @@ -24,7 +24,7 @@ #include #include "decorate_shader.h" #include "variance_shadow_mapping_blur.h" -#include +#include VarianceShadowMappingBlur::VarianceShadowMappingBlur(float intensity):VarianceShadowMapping(intensity) { diff --git a/src/meshlabplugins/filter_img_patch_param/TexturePainter.cpp b/src/meshlabplugins/filter_img_patch_param/TexturePainter.cpp index dfc40d87f..f2780eac5 100644 --- a/src/meshlabplugins/filter_img_patch_param/TexturePainter.cpp +++ b/src/meshlabplugins/filter_img_patch_param/TexturePainter.cpp @@ -23,7 +23,7 @@ #include #include "TexturePainter.h" -#include +#include diff --git a/src/meshlabplugins/filter_img_patch_param/VisibilityCheck.cpp b/src/meshlabplugins/filter_img_patch_param/VisibilityCheck.cpp index fcf381078..bc199776c 100644 --- a/src/meshlabplugins/filter_img_patch_param/VisibilityCheck.cpp +++ b/src/meshlabplugins/filter_img_patch_param/VisibilityCheck.cpp @@ -23,10 +23,6 @@ #include #include "VisibilityCheck.h" #include -#include - - - VisibilityCheck* VisibilityCheck::s_Instance = NULL; diff --git a/src/meshlabplugins/io_u3d/io_u3d.cpp b/src/meshlabplugins/io_u3d/io_u3d.cpp index f6ddc35a0..23b4bf12d 100644 --- a/src/meshlabplugins/io_u3d/io_u3d.cpp +++ b/src/meshlabplugins/io_u3d/io_u3d.cpp @@ -27,7 +27,6 @@ #include #include "io_u3d.h" -#include #include #include @@ -58,22 +57,6 @@ bool U3DIOPlugin::open( { return false; } - -QString U3DIOPlugin::computePluginsPath() -{ - QDir pluginsDir(PluginManager::getDefaultPluginDirPath()); - #if defined(Q_OS_WIN) - pluginsDir.cd("U3D_W32"); - #elif defined(Q_OS_MAC) - pluginsDir.cd("U3D_OSX"); - #elif defined(Q_OS_LINUX) - pluginsDir.cd("U3D_LINUX"); - #endif - qDebug("U3D plugins dir %s", qUtf8Printable(pluginsDir.absolutePath())); - return pluginsDir.absolutePath(); -} - - bool U3DIOPlugin::save( const QString &formatName, const QString &fileName, diff --git a/src/meshlabplugins/io_u3d/io_u3d.h b/src/meshlabplugins/io_u3d/io_u3d.h index 899910c0d..f88f35b27 100644 --- a/src/meshlabplugins/io_u3d/io_u3d.h +++ b/src/meshlabplugins/io_u3d/io_u3d.h @@ -54,8 +54,6 @@ public: void initSaveParameter(const QString &format, MeshModel &/*m*/, RichParameterList &par); private: - QString computePluginsPath(); - void saveParameters(const RichParameterList &par); void saveLatex(const QString& file,const vcg::tri::io::u3dparametersclasses::Movie15Parameters& mov_par); From bb73f0cf7fb999d9b2b3c0a58036ae3fb54ebae7 Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Mon, 30 Nov 2020 17:36:12 +0100 Subject: [PATCH 2/5] globals and singletons --- src/common/CMakeLists.txt | 18 ++-- src/common/common.pro | 30 +++--- src/common/globals/globals.cpp | 99 +++++++++++++++++++ src/common/globals/globals.h | 38 +++++++ .../singletons.cpp} | 13 +-- .../singletons.h} | 7 +- .../decorate_background.cpp | 5 - src/meshlabserver/mainserver.cpp | 2 +- 8 files changed, 174 insertions(+), 38 deletions(-) create mode 100644 src/common/globals/globals.cpp create mode 100644 src/common/globals/globals.h rename src/common/{meshlab_singletons.cpp => globals/singletons.cpp} (56%) rename src/common/{meshlab_singletons.h => globals/singletons.h} (92%) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 9694790d0..d8f2a0b4b 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -8,9 +8,8 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../ML_VERSION") endif() set(HEADERS - parameters/rich_parameter.h - parameters/rich_parameter_list.h - parameters/value.h + globals/globals.h + globals/singletons.h interfaces/decorate_plugin_interface.h interfaces/edit_plugin_interface.h interfaces/filter_plugin_interface.h @@ -28,11 +27,13 @@ set(HEADERS ml_document/mesh_model_state.h ml_document/raster_model.h ml_document/render_raster.h + parameters/rich_parameter.h + parameters/rich_parameter_list.h + parameters/value.h utilities/file_format.h GLExtensionsManager.h GLLogStream.h filterscript.h - meshlab_singletons.h meshlabdocumentbundler.h meshlabdocumentxml.h ml_selection_buffers.h @@ -44,9 +45,8 @@ set(HEADERS searcher.h) set(SOURCES - parameters/rich_parameter.cpp - parameters/rich_parameter_list.cpp - parameters/value.cpp + globals/globals.cpp + globals/singletons.cpp interfaces/decorate_plugin_interface.cpp interfaces/filter_plugin_interface.cpp interfaces/plugin_interface.cpp @@ -57,10 +57,12 @@ set(SOURCES ml_document/mesh_model_state.cpp ml_document/raster_model.cpp ml_document/render_raster.cpp + parameters/rich_parameter.cpp + parameters/rich_parameter_list.cpp + parameters/value.cpp GLExtensionsManager.cpp GLLogStream.cpp filterscript.cpp - meshlab_singletons.cpp meshlabdocumentbundler.cpp meshlabdocumentxml.cpp ml_selection_buffers.cpp diff --git a/src/common/common.pro b/src/common/common.pro index 3ae41a50a..305afc04e 100644 --- a/src/common/common.pro +++ b/src/common/common.pro @@ -40,12 +40,8 @@ exists(../../ML_VERSION){ # Input HEADERS += \ - GLExtensionsManager.h \ - parameters/rich_parameter_list.h \ - parameters/value.h \ - parameters/rich_parameter.h \ - filterscript.h \ - GLLogStream.h \ + globals/globals.h \ + globals/singletons.h \ interfaces/decorate_plugin_interface.h \ interfaces/edit_plugin_interface.h \ interfaces/filter_plugin_interface.h \ @@ -62,8 +58,13 @@ HEADERS += \ ml_document/mesh_document.h \ ml_document/raster_model.h \ ml_document/render_raster.h \ + parameters/rich_parameter_list.h \ + parameters/value.h \ + parameters/rich_parameter.h \ utilities/file_format.h \ - meshlab_singletons.h \ + GLExtensionsManager.h \ + filterscript.h \ + GLLogStream.h \ plugin_manager.h \ mlexception.h \ mlapplication.h \ @@ -73,12 +74,8 @@ HEADERS += \ meshlabdocumentxml.h SOURCES += \ - GLExtensionsManager.cpp \ - parameters/rich_parameter.cpp \ - parameters/rich_parameter_list.cpp \ - parameters/value.cpp \ - filterscript.cpp \ - GLLogStream.cpp \ + globals/globals.cpp \ + globals/singletons.cpp \ interfaces/decorate_plugin_interface.cpp \ interfaces/filter_plugin_interface.cpp \ interfaces/plugin_interface.cpp \ @@ -89,7 +86,12 @@ SOURCES += \ ml_document/mesh_document.cpp \ ml_document/raster_model.cpp \ ml_document/render_raster.cpp \ - meshlab_singletons.cpp \ + parameters/rich_parameter.cpp \ + parameters/rich_parameter_list.cpp \ + parameters/value.cpp \ + GLExtensionsManager.cpp \ + filterscript.cpp \ + GLLogStream.cpp \ plugin_manager.cpp \ mlapplication.cpp \ searcher.cpp \ diff --git a/src/common/globals/globals.cpp b/src/common/globals/globals.cpp new file mode 100644 index 000000000..023da242d --- /dev/null +++ b/src/common/globals/globals.cpp @@ -0,0 +1,99 @@ +/**************************************************************************** +* 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. * +* * +****************************************************************************/ + +#include "globals.h" + +#include +#include + +#include "../parameters/rich_parameter_list.h" + +RichParameterList& meshlab::defaultGlobalParameterList() +{ + static RichParameterList globalRPS; + return globalRPS; +} + +QString basePath() +{ + QDir baseDir(qApp->applicationDirPath()); + +#if defined(Q_OS_WIN) + // Windows: + // during development with visual studio binary could be in the debug/release subdir. + // once deployed plugins dir is in the application directory, so + if (baseDir.dirName() == "debug" || baseDir.dirName() == "release") baseDir.cdUp(); +#endif + +#if defined(Q_OS_MAC) + // Mac: during developmentwith xcode and well deployed the binary is well buried. + for(int i=0;i<6;++i){ + if(baseDir.exists("plugins")) break; + baseDir.cdUp(); + } + qDebug("The base dir is %s", qUtf8Printable(baseDir.absolutePath())); +#endif + return baseDir.absolutePath(); +} + +QString meshlab::defaultPluginPath() +{ + QDir pluginsDir(basePath()); +#if defined(Q_OS_WIN) + QString d = pluginsDir.dirName(); + QString dLower = d.toLower(); + if (dLower == "release" || dLower == "relwithdebinfo" || dLower == "debug" || + dLower == "minsizerel") { + // This is a configuration directory for MS Visual Studio. + pluginsDir.cdUp(); + } else { + d.clear(); + } +#endif + if (pluginsDir.exists("plugins")) { + pluginsDir.cd("plugins"); + +#if defined(Q_OS_WIN) + // Re-apply the configuration dir, if any. + if (!d.isEmpty() && pluginsDir.exists(d)) { + pluginsDir.cd(d); + } +#endif + + return pluginsDir.absolutePath(); + } +#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) + else if (pluginsDir.dirName() == "bin") { + pluginsDir.cdUp(); + pluginsDir.cd("lib"); + pluginsDir.cd("meshlab"); + if (pluginsDir.exists("plugins")) { + pluginsDir.cd("plugins"); + return pluginsDir.absolutePath(); + } + } +#endif + //QMessageBox::warning(0,"Meshlab Initialization","Serious error. Unable to find the plugins directory."); + qDebug("Meshlab Initialization: Serious error. Unable to find the plugins directory."); + return {}; +} diff --git a/src/common/globals/globals.h b/src/common/globals/globals.h new file mode 100644 index 000000000..a5350bb2f --- /dev/null +++ b/src/common/globals/globals.h @@ -0,0 +1,38 @@ +/**************************************************************************** +* 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_GLOBALS_H +#define MESHLAB_GLOBALS_H + +#include + +class RichParameterList; + +namespace meshlab { + +RichParameterList& defaultGlobalParameterList(); +QString defaultPluginPath(); + +} + +#endif // MESHLAB_GLOBALS_H diff --git a/src/common/meshlab_singletons.cpp b/src/common/globals/singletons.cpp similarity index 56% rename from src/common/meshlab_singletons.cpp rename to src/common/globals/singletons.cpp index d9f73f875..66bd2c91a 100644 --- a/src/common/meshlab_singletons.cpp +++ b/src/common/globals/singletons.cpp @@ -1,6 +1,7 @@ -#include "meshlab_singletons.h" +#include "singletons.h" -#include "plugin_manager.h" +#include "../plugin_manager.h" +#include "globals.h" namespace meshlab { @@ -8,19 +9,13 @@ MeshLabSingletons::MeshLabSingletons() { } -RichParameterList& MeshLabSingletons::globalRPLInstance() -{ - static RichParameterList globalRPS; - return globalRPS; -} - PluginManager& MeshLabSingletons::pluginManagerInstance() { static bool initialized = false; static PluginManager pm; if (!initialized){ initialized = true; - RichParameterList& globalRPS = globalRPLInstance(); + RichParameterList& globalRPS = defaultGlobalParameterList(); pm.loadPlugins(globalRPS); } return pm; diff --git a/src/common/meshlab_singletons.h b/src/common/globals/singletons.h similarity index 92% rename from src/common/meshlab_singletons.h rename to src/common/globals/singletons.h index 3db455afc..3b4f8f186 100644 --- a/src/common/meshlab_singletons.h +++ b/src/common/globals/singletons.h @@ -29,11 +29,16 @@ class PluginManager; namespace meshlab { +/** + * @brief The MeshLabSingletons class + * This class contains all the singleton instances used on MeshLab. + * - pluginManager + * - defaultGlobalParameterList + */ class MeshLabSingletons { public: /** Singleton Instances **/ - static RichParameterList& globalRPLInstance(); static PluginManager& pluginManagerInstance(); MeshLabSingletons(MeshLabSingletons const&) = delete; diff --git a/src/meshlabplugins/decorate_background/decorate_background.cpp b/src/meshlabplugins/decorate_background/decorate_background.cpp index 0b2464650..7169b18dd 100644 --- a/src/meshlabplugins/decorate_background/decorate_background.cpp +++ b/src/meshlabplugins/decorate_background/decorate_background.cpp @@ -66,11 +66,6 @@ void DecorateBackgroundPlugin::initGlobalParameterList(const QAction* action, Ri switch(ID(action)) { case DP_SHOW_CUBEMAPPED_ENV : - if(!parset.hasParameter(CubeMapPathParam())) - { - QString cubemapDirPath = PluginManager::getBaseDirPath() + QString("/textures/cubemaps/uffizi.jpg"); - //parset.addParam(RichString(CubeMapPathParam(), cubemapDirPath,"","")); - } break; case DP_SHOW_GRID : parset.addParam(RichFloat(BoxRatioParam(),1.2f,"Box Ratio","The size of the grid around the object w.r.t. the bbox of the object")); diff --git a/src/meshlabserver/mainserver.cpp b/src/meshlabserver/mainserver.cpp index c042e4cd6..5e3b7e3b8 100644 --- a/src/meshlabserver/mainserver.cpp +++ b/src/meshlabserver/mainserver.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include From 548537ec18419e66bf29679032b53a9c6d703631 Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Tue, 1 Dec 2020 11:31:53 +0100 Subject: [PATCH 3/5] shadersPath --- src/common/globals/globals.cpp | 5 +++++ src/common/globals/globals.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/common/globals/globals.cpp b/src/common/globals/globals.cpp index 023da242d..a22ccb5d6 100644 --- a/src/common/globals/globals.cpp +++ b/src/common/globals/globals.cpp @@ -97,3 +97,8 @@ QString meshlab::defaultPluginPath() qDebug("Meshlab Initialization: Serious error. Unable to find the plugins directory."); return {}; } + +QString meshlab::defaultShadersPath() +{ + return basePath() + "/shaders"; +} diff --git a/src/common/globals/globals.h b/src/common/globals/globals.h index a5350bb2f..65b6855d1 100644 --- a/src/common/globals/globals.h +++ b/src/common/globals/globals.h @@ -32,6 +32,7 @@ namespace meshlab { RichParameterList& defaultGlobalParameterList(); QString defaultPluginPath(); +QString defaultShadersPath(); } From b9bb5703fce86dd641d1260be2de5c08e4845d4e Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Mon, 7 Dec 2020 15:51:56 +0100 Subject: [PATCH 4/5] proper constructors for plugin manager, meshlab using global defaultGlobalParameters, defaultPluginsPath and defaultShadersPath --- src/common/globals/singletons.cpp | 8 +- src/common/plugin_manager.cpp | 108 ++++-------------- src/common/plugin_manager.h | 57 +++++---- src/meshlab/mainwindow.h | 4 +- src/meshlab/mainwindow_Init.cpp | 13 ++- src/meshlab/mainwindow_RunTime.cpp | 15 +-- .../decorate_shadow/decorate_shader.h | 2 +- .../decorate_shadow/shadow_mapping.cpp | 4 +- src/meshlabplugins/decorate_shadow/ssao.cpp | 8 +- .../variance_shadow_mapping.cpp | 6 +- .../variance_shadow_mapping_blur.cpp | 8 +- 11 files changed, 85 insertions(+), 148 deletions(-) diff --git a/src/common/globals/singletons.cpp b/src/common/globals/singletons.cpp index 66bd2c91a..154cfefe8 100644 --- a/src/common/globals/singletons.cpp +++ b/src/common/globals/singletons.cpp @@ -11,13 +11,7 @@ MeshLabSingletons::MeshLabSingletons() PluginManager& MeshLabSingletons::pluginManagerInstance() { - static bool initialized = false; - static PluginManager pm; - if (!initialized){ - initialized = true; - RichParameterList& globalRPS = defaultGlobalParameterList(); - pm.loadPlugins(globalRPS); - } + static PluginManager pm(defaultGlobalParameterList()); return pm; } diff --git a/src/common/plugin_manager.cpp b/src/common/plugin_manager.cpp index 56ec52065..f6be23c9d 100644 --- a/src/common/plugin_manager.cpp +++ b/src/common/plugin_manager.cpp @@ -29,6 +29,7 @@ #include #include "mlexception.h" +#include "globals/globals.h" static QStringList fileNamePluginDLLs() { QStringList l; @@ -55,40 +56,47 @@ static QString fileNamePrefixPluginDLLs() { PluginManager::PluginManager() { - //pluginsDir=QDir(getPluginDirPath()); - //without adding the correct library path in the mac the loading of jpg (done via qt plugins) fails - //qApp->addLibraryPath(getPluginDirPath()); - //qApp->addLibraryPath(getBaseDirPath()); +} + +PluginManager::PluginManager(RichParameterList& defaultGlobal) +{ + loadPlugins(defaultGlobal); +} + +PluginManager::PluginManager(RichParameterList& defaultGlobal, const QDir& pluginsDirectory) +{ + loadPlugins(defaultGlobal, pluginsDirectory); } PluginManager::~PluginManager() { ioMeshPlugins.clear(); - meshFilterPlug.clear(); - meshRenderPlug.clear(); - meshDecoratePlug.clear(); + filterPlugins.clear(); + renderPlugins.clear(); + decoratePlugins.clear(); for (PluginInterface* plugin : ownerPlug) delete plugin; ownerPlug.clear(); - for (int ii = 0; ii < meshEditInterfacePlug.size(); ++ii) - delete meshEditInterfacePlug[ii]; - meshEditInterfacePlug.clear(); + for (int ii = 0; ii < editPlugins.size(); ++ii) + delete editPlugins[ii]; + editPlugins.clear(); } void PluginManager::loadPlugins(RichParameterList& defaultGlobal) { - loadPlugins(defaultGlobal, QDir(getDefaultPluginDirPath())); + loadPlugins(defaultGlobal, QDir(meshlab::defaultPluginPath())); } void PluginManager::loadPlugins(RichParameterList& defaultGlobal, const QDir& pluginsDirectory) { pluginsDir = pluginsDirectory; // without adding the correct library path in the mac the loading of jpg (done via qt plugins) fails - qApp->addLibraryPath(getDefaultPluginDirPath()); - qApp->addLibraryPath(getBaseDirPath()); + // ToDo: get rid of any qApp here + qApp->addLibraryPath(meshlab::defaultPluginPath()); + //qApp->addLibraryPath(getBaseDirPath()); QStringList nameFiltersPlugins = fileNamePluginDLLs(); //only the file with extension pluginfilters will be listed by function entryList() @@ -140,7 +148,7 @@ void PluginManager::loadPlugins(RichParameterList& defaultGlobal, const QDir& pl actionFilterMap.insert(filterAction->text(), filterAction); stringFilterMap.insert(filterAction->text(), iFilter); } - meshFilterPlug.push_back(iFilter); + filterPlugins.push_back(iFilter); } } IOMeshPluginInterface *iIOMesh = qobject_cast(plugin); @@ -160,7 +168,7 @@ void PluginManager::loadPlugins(RichParameterList& defaultGlobal, const QDir& pl if (iDecorator) { iCommon = iDecorator; - meshDecoratePlug.push_back(iDecorator); + decoratePlugins.push_back(iDecorator); for(QAction *decoratorAction : iDecorator->actions()) { decoratorActionList.push_back(decoratorAction); @@ -172,13 +180,13 @@ void PluginManager::loadPlugins(RichParameterList& defaultGlobal, const QDir& pl if (iRender) { iCommon = iRender; - meshRenderPlug.push_back(iRender); + renderPlugins.push_back(iRender); } EditPluginInterfaceFactory *iEditFactory = qobject_cast(plugin); if (iEditFactory) { - meshEditInterfacePlug.push_back(iEditFactory); + editPlugins.push_back(iEditFactory); foreach(QAction* editAction, iEditFactory->actions()) editActionList.push_back(editAction); } @@ -245,72 +253,6 @@ QMap PluginManager::generateFilterParameterMap() return FPM; } -QString PluginManager::getBaseDirPath() -{ - QDir baseDir(qApp->applicationDirPath()); - -#if defined(Q_OS_WIN) - // Windows: - // during development with visual studio binary could be in the debug/release subdir. - // once deployed plugins dir is in the application directory, so - if (baseDir.dirName() == "debug" || baseDir.dirName() == "release") baseDir.cdUp(); -#endif - -#if defined(Q_OS_MAC) - // Mac: during developmentwith xcode and well deployed the binary is well buried. - for(int i=0;i<6;++i){ - if(baseDir.exists("plugins")) break; - baseDir.cdUp(); - } - qDebug("The base dir is %s", qUtf8Printable(baseDir.absolutePath())); -#endif - return baseDir.absolutePath(); -} - -QString PluginManager::getDefaultPluginDirPath() -{ - QDir pluginsDir(getBaseDirPath()); -#if defined(Q_OS_WIN) - QString d = pluginsDir.dirName(); - QString dLower = d.toLower(); - if (dLower == "release" || dLower == "relwithdebinfo" || dLower == "debug" || - dLower == "minsizerel") { - // This is a configuration directory for MS Visual Studio. - pluginsDir.cdUp(); - } else { - d.clear(); - } -#endif - if (pluginsDir.exists("plugins")) { - pluginsDir.cd("plugins"); - -#if defined(Q_OS_WIN) - // Re-apply the configuration dir, if any. - if (!d.isEmpty() && pluginsDir.exists(d)) { - pluginsDir.cd(d); - } -#endif - - return pluginsDir.absolutePath(); - } -#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) - else if (pluginsDir.dirName() == "bin") { - pluginsDir.cdUp(); - pluginsDir.cd("lib"); - pluginsDir.cd("meshlab"); - if (pluginsDir.exists("plugins")) { - pluginsDir.cd("plugins"); - return pluginsDir.absolutePath(); - } - } -#endif - //QMessageBox::warning(0,"Meshlab Initialization","Serious error. Unable to find the plugins directory."); - qDebug("Meshlab Initialization: Serious error. Unable to find the plugins directory."); - return {}; -} - - - void PluginManager::fillKnownIOFormats() { QString allKnownFormatsFilter = QObject::tr("All known formats ("); diff --git a/src/common/plugin_manager.h b/src/common/plugin_manager.h index 978018fae..cd62d0c87 100644 --- a/src/common/plugin_manager.h +++ b/src/common/plugin_manager.h @@ -42,25 +42,25 @@ class PluginManager { public: PluginManager(); + PluginManager(RichParameterList& defaultGlobal); + PluginManager(RichParameterList& defaultGlobal, const QDir& pluginsDirectory); + ~PluginManager(); void loadPlugins(RichParameterList& defaultGlobal); void loadPlugins(RichParameterList& defaultGlobal, const QDir& pluginsDirectory); QString pluginsCode() const; - + int numberIOPlugins() const; unsigned int size() const; - 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(); - + inline QVector& meshFilterPlugins() {return filterPlugins;} + inline QVector& meshRenderPlugins() {return renderPlugins;} + inline QVector& meshDecoratePlugins() {return decoratePlugins;} + inline QVector& meshEditFactoryPlugins() {return editPlugins;} + QMap generateFilterParameterMap(); - + DecoratePluginInterface* getDecoratorInterfaceByName(const QString& name); - + class PluginRangeIterator { friend class PluginManager; @@ -71,11 +71,11 @@ public: PluginRangeIterator(PluginManager* pm) : pm(pm) {} PluginManager* pm; }; - + PluginRangeIterator pluginIterator(); - + static QString osIndependentPluginName(const QString& plname); - + QMap actionFilterMap; QMap stringFilterMap; QMap allKnowInputMeshFormats; @@ -84,36 +84,33 @@ public: QStringList inpMeshFilters; QStringList inpRasterFilters; QStringList outFilters; - - - QVector meshFilterPlug; - QVector meshRenderPlug; - QVector meshDecoratePlug; - QVector meshEditInterfacePlug; + + + QVector filterPlugins; + QVector renderPlugins; + QVector decoratePlugins; + QVector editPlugins; QVector editActionList; QVector decoratorActionList; // Used for unique destruction - this "owns" all IO, Filter, Render, and Decorate plugins - + QStringList pluginsLoaded; - - - + private: QVector ownerPlug; QVector ioMeshPlugins; QVector ioRasterPlugins; QDir pluginsDir; - - + void fillKnownIOFormats(); - - QString addPluginRasterFormats( + + static QString addPluginRasterFormats( QMap& map, QStringList& formatFilters, IORasterPluginInterface* pRasterIOPlugin, const QList& format); - - QString addPluginMeshFormats( + + static QString addPluginMeshFormats( QMap& map, QStringList& formatFilters, IOMeshPluginInterface* pMeshIOPlugin, diff --git a/src/meshlab/mainwindow.h b/src/meshlab/mainwindow.h index e2c83499d..072d5db21 100644 --- a/src/meshlab/mainwindow.h +++ b/src/meshlab/mainwindow.h @@ -292,14 +292,14 @@ private: */ RichParameterList currentGlobalParams; - RichParameterList defaultGlobalParams; + RichParameterList& defaultGlobalParams; QByteArray toolbarState; //toolbar and dockwidgets state QDir lastUsedDirectory; //This will hold the last directory that was used to load/save a file/project in public: - PluginManager PM; + PluginManager& PM; MeshDocument *meshDoc() { if (currentViewContainer() != NULL) diff --git a/src/meshlab/mainwindow_Init.cpp b/src/meshlab/mainwindow_Init.cpp index 0e0dd9bfd..f163358ee 100644 --- a/src/meshlab/mainwindow_Init.cpp +++ b/src/meshlab/mainwindow_Init.cpp @@ -22,10 +22,6 @@ ****************************************************************************/ -#include "../common/searcher.h" -#include "../common/mlapplication.h" -#include "../common/mlexception.h" - #include #include #include @@ -40,6 +36,11 @@ #include #include #include "mainwindow.h" +#include +#include +#include +#include +#include #include "dialogs/options_dialog.h" #include "dialogs/save_snapshot_dialog.h" #include "dialogs/congrats_dialog.h" @@ -50,6 +51,8 @@ QProgressBar *MainWindow::qb; MainWindow::MainWindow(): httpReq(this), gpumeminfo(NULL), + defaultGlobalParams(meshlab::defaultGlobalParameterList()), + PM(meshlab::MeshLabSingletons::pluginManagerInstance()), _currviewcontainer(NULL) { setContextMenuPolicy(Qt::NoContextMenu); @@ -82,7 +85,7 @@ MainWindow::MainWindow(): //should update those values only after I run MeshLab for the very first time or after I installed a new version if (!vers.isValid() || vers.toString() < MeshLabApplication::appVer()) { - settings.setValue(MeshLabApplication::pluginsPathRegisterKeyName(), PluginManager::getDefaultPluginDirPath()); + settings.setValue(MeshLabApplication::pluginsPathRegisterKeyName(), meshlab::defaultPluginPath()); settings.setValue(MeshLabApplication::versionRegisterKeyName(), MeshLabApplication::appVer()); settings.setValue(MeshLabApplication::wordSizeKeyName(), QSysInfo::WordSize); foreach(QString plfile, PM.pluginsLoaded) diff --git a/src/meshlab/mainwindow_RunTime.cpp b/src/meshlab/mainwindow_RunTime.cpp index 1233bdb98..391f55fd0 100644 --- a/src/meshlab/mainwindow_RunTime.cpp +++ b/src/meshlab/mainwindow_RunTime.cpp @@ -40,11 +40,12 @@ #include #include -#include "../common/meshlabdocumentxml.h" -#include "../common/meshlabdocumentbundler.h" -#include "../common/mlapplication.h" -#include "../common/filterscript.h" -#include "../common/mlexception.h" +#include +#include +#include +#include +#include +#include #include "rich_parameter_gui/richparameterlistdialog.h" @@ -2611,8 +2612,8 @@ void MainWindow::about() void MainWindow::aboutPlugins() { - qDebug( "aboutPlugins(): Current Plugins Dir: %s ",qUtf8Printable(pluginManager().getDefaultPluginDirPath())); - PluginInfoDialog dialog(pluginManager().getDefaultPluginDirPath(), pluginManager().pluginsLoaded, this); + qDebug( "aboutPlugins(): Current Plugins Dir: %s ", qUtf8Printable(meshlab::defaultPluginPath())); + PluginInfoDialog dialog(meshlab::defaultPluginPath(), PM.pluginsLoaded, this); dialog.exec(); } diff --git a/src/meshlabplugins/decorate_shadow/decorate_shader.h b/src/meshlabplugins/decorate_shadow/decorate_shader.h index 0332f3bbc..0b842b093 100644 --- a/src/meshlabplugins/decorate_shadow/decorate_shader.h +++ b/src/meshlabplugins/decorate_shadow/decorate_shader.h @@ -238,7 +238,7 @@ protected: * @param path The path to the files. * @return true if no errors during compilation and linking occurs */ - bool compileAndLink(GLuint& program, GLuint& vertex, GLuint& fragment, QString& path){ + bool compileAndLink(GLuint& program, GLuint& vertex, GLuint& fragment, QString path){ //load the file containing the vertex shader QFile vertexShaderFile(path + QString(".vert")); bool ret=vertexShaderFile.open(QIODevice::ReadOnly | QIODevice::Text); diff --git a/src/meshlabplugins/decorate_shadow/shadow_mapping.cpp b/src/meshlabplugins/decorate_shadow/shadow_mapping.cpp index bf96eaded..50574894f 100644 --- a/src/meshlabplugins/decorate_shadow/shadow_mapping.cpp +++ b/src/meshlabplugins/decorate_shadow/shadow_mapping.cpp @@ -24,7 +24,7 @@ #include #include "decorate_shader.h" #include "shadow_mapping.h" -#include +#include ShadowMapping::ShadowMapping(float intensity):DecorateShader() @@ -58,7 +58,7 @@ bool ShadowMapping::init() this->_shadowMappingProgram, this->_shadowMappingVert, this->_shadowMappingFrag, - PluginManager::getBaseDirPath().append(QString("/shaders/decorate_shadow/sm/object"))); + meshlab::defaultShadersPath() + "/decorate_shadow/sm/object"); } void ShadowMapping::renderingFromLightSetup(MeshDocument& md, GLArea* gla){ diff --git a/src/meshlabplugins/decorate_shadow/ssao.cpp b/src/meshlabplugins/decorate_shadow/ssao.cpp index 7478eacab..c11bf44a1 100644 --- a/src/meshlabplugins/decorate_shadow/ssao.cpp +++ b/src/meshlabplugins/decorate_shadow/ssao.cpp @@ -24,7 +24,7 @@ #include #include "ssao.h" -#include +#include SSAO::SSAO(float radius):DecorateShader() { @@ -93,17 +93,17 @@ bool SSAO::init() this->_ssaoShaderProgram, this->_ssaoVert, this->_ssaoFrag, - PluginManager::getBaseDirPath().append(QString("/shaders/decorate_shadow/ssao/ssao"))) || + meshlab::defaultShadersPath() + "/decorate_shadow/ssao/ssao") || !compileAndLink( this->_normalMapShaderProgram, this->_normalMapVert, this->_normalMapFrag, - PluginManager::getBaseDirPath().append(QString("/shaders/decorate_shadow/ssao/normalMap"))) || + meshlab::defaultShadersPath() + "/decorate_shadow/ssao/normalMap") || !compileAndLink( this->_blurShaderProgram, this->_blurVert, this->_blurFrag, - PluginManager::getBaseDirPath().append(QString("/shaders/decorate_shadow/ssao/blur")))) + meshlab::defaultShadersPath() + "/decorate_shadow/ssao/blur")) return false; return true; } diff --git a/src/meshlabplugins/decorate_shadow/variance_shadow_mapping.cpp b/src/meshlabplugins/decorate_shadow/variance_shadow_mapping.cpp index 42de76329..5b1b4ae2b 100644 --- a/src/meshlabplugins/decorate_shadow/variance_shadow_mapping.cpp +++ b/src/meshlabplugins/decorate_shadow/variance_shadow_mapping.cpp @@ -23,7 +23,7 @@ #include "decorate_shader.h" #include "variance_shadow_mapping.h" -#include +#include #include @@ -57,12 +57,12 @@ bool VarianceShadowMapping::init() this->_depthShaderProgram, this->_depthVert, this->_depthFrag, - PluginManager::getBaseDirPath().append(QString("/shaders/decorate_shadow/vsm/depthVSM"))) || + meshlab::defaultShadersPath() + "/decorate_shadow/vsm/depthVSM") || !compileAndLink( this->_shadowMappingProgram, this->_shadowMappingVert, this->_shadowMappingFrag, - PluginManager::getBaseDirPath().append(QString("/shaders/decorate_shadow/vsm/objectVSM")))) + meshlab::defaultShadersPath() + "/shaders/decorate_shadow/vsm/objectVSM")) return false; return true; diff --git a/src/meshlabplugins/decorate_shadow/variance_shadow_mapping_blur.cpp b/src/meshlabplugins/decorate_shadow/variance_shadow_mapping_blur.cpp index fba2e06b5..438c2f500 100644 --- a/src/meshlabplugins/decorate_shadow/variance_shadow_mapping_blur.cpp +++ b/src/meshlabplugins/decorate_shadow/variance_shadow_mapping_blur.cpp @@ -24,7 +24,7 @@ #include #include "decorate_shader.h" #include "variance_shadow_mapping_blur.h" -#include +#include VarianceShadowMappingBlur::VarianceShadowMappingBlur(float intensity):VarianceShadowMapping(intensity) { @@ -56,17 +56,17 @@ bool VarianceShadowMappingBlur::init() this->_depthShaderProgram, this->_depthVert, this->_depthFrag, - PluginManager::getBaseDirPath().append(QString("/shaders/decorate_shadow/vsmb/depthVSM"))) || + meshlab::defaultShadersPath() + "/decorate_shadow/vsmb/depthVSM") || !compileAndLink( this->_shadowMappingProgram, this->_shadowMappingVert, this->_shadowMappingFrag, - PluginManager::getBaseDirPath().append(QString("/shaders/decorate_shadow/vsmb/objectVSM"))) || + meshlab::defaultShadersPath() + "/shaders/decorate_shadow/vsmb/objectVSM") || !compileAndLink( this->_blurShaderProgram, this->_blurVert, this->_blurFrag, - PluginManager::getBaseDirPath().append(QString("/shaders/decorate_shadow/vsmb/blurVSM")))) + meshlab::defaultShadersPath() + "/shaders/decorate_shadow/vsmb/blurVSM")) return false; return true; } From 73da790d49a7b570b36cfe24bd75c637dc84a679 Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Mon, 7 Dec 2020 16:17:41 +0100 Subject: [PATCH 5/5] remove unuseful member plugin manager --- src/common/plugin_manager.cpp | 23 ----------------------- src/common/plugin_manager.h | 2 -- 2 files changed, 25 deletions(-) diff --git a/src/common/plugin_manager.cpp b/src/common/plugin_manager.cpp index f6be23c9d..7ddb50e1b 100644 --- a/src/common/plugin_manager.cpp +++ b/src/common/plugin_manager.cpp @@ -230,29 +230,6 @@ PluginManager::PluginRangeIterator PluginManager::pluginIterator() return PluginRangeIterator(this); } -/* -This function create a map from filtername to dummy RichParameterSet. -containing for each filtername the set of parameter that it uses. -*/ -QMap PluginManager::generateFilterParameterMap() -{ - QMap FPM; - MeshDocument md; - MeshModel* mm = md.addNewMesh("", "dummy", true); - vcg::tri::Tetrahedron(mm->cm); - mm->updateDataMask(MeshModel::MM_ALL); - QMap::iterator ai; - for (ai = this->actionFilterMap.begin(); ai != this->actionFilterMap.end(); ++ai) - { - QString filterName = ai.key();// ->filterName(); - //QAction act(filterName,NULL); - RichParameterList rp; - stringFilterMap[filterName]->initParameterList(ai.value(), md, rp); - FPM[filterName] = rp; - } - return FPM; -} - void PluginManager::fillKnownIOFormats() { QString allKnownFormatsFilter = QObject::tr("All known formats ("); diff --git a/src/common/plugin_manager.h b/src/common/plugin_manager.h index cd62d0c87..a81af87be 100644 --- a/src/common/plugin_manager.h +++ b/src/common/plugin_manager.h @@ -57,8 +57,6 @@ public: inline QVector& meshDecoratePlugins() {return decoratePlugins;} inline QVector& meshEditFactoryPlugins() {return editPlugins;} - QMap generateFilterParameterMap(); - DecoratePluginInterface* getDecoratorInterfaceByName(const QString& name); class PluginRangeIterator