Merge branch 'master-alemuntoni'

# Conflicts:
#	src/common/interfaces.h
#	src/meshlab/mainwindow_RunTime.cpp
This commit is contained in:
alemuntoni 2020-09-23 11:55:29 +02:00
commit 49f844dcbd
280 changed files with 4993 additions and 4624 deletions

View File

@ -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

View File

@ -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

35
.github/workflows/BuildSnap.yml vendored Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 \

View File

@ -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;
}

View File

@ -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 <GL/glew.h>
#include "filter_parameter/rich_parameter_list.h"
#include "GLLogStream.h"
#include "meshmodel.h"
#include <QtCore>
#include <QApplication>
#include <QAction>
#include <QGLContext>
#include <QGLFormat>
#include <QMessageBox>
#include <QTabletEvent>
#include <QDebug>
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 <typename... Ts>
void Log(const char * f, Ts&&... ts )
{
if(log != nullptr)
{
log->Logf(GLLogStream::FILTER, f, std::forward<Ts>(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 <typename... Ts>
void Log(GLLogStream::Levels Level, const char * f, Ts&&... ts )
{
if(log != nullptr)
{
log->Logf(Level, f, std::forward<Ts>(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 <typename... Ts>
void RealTimeLog(QString Id, const QString &meshName, const char * f, Ts&&... ts )
{
if(log != nullptr)
{
log->RealTimeLogf(Id, meshName, f, std::forward<Ts>(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 <b>hardwired</b> 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 <b>saved</b> 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 <b>current</b> 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<Format> importFormats() const = 0;
virtual QList<Format> 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 "<br>" "<b>" and "<i>") 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:
<br>
See: <br />
<i>Luiz Velho, Denis Zorin </i><br/>
<b>"4-8 Subdivision"</b><br/>
CAGD, volume 18, Issue 5, Pages 397-427.<br/>
<br>
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<QAction *> actions() const { return actionList; }
virtual QList<FilterIDType> 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 <QAction *> actionList;
QList <FilterIDType> 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, :
<your own opengl setup>
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<QAction *> actions() = 0;
};
/**
MeshDecorateInterface is the base class of all <b> decorators </b>
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 <i>before</i> the rendering of the document/mesh */
PostRendering = 0x00008 /*!< Decoration that are applied <i>after</i> 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<QAction *> actions() const { return actionList; }
virtual QList<FilterIDType> types() const { return typeList; }
protected:
QList <QAction *> actionList;
QList <FilterIDType> 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 <i>factory</i> 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<QAction *> 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

View File

@ -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 <b>hardwired</b> 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 <b>saved</b> 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 <b>current</b> 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;
}

View File

@ -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 <b> decorators </b>
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 <i>before</i> the rendering of the document/mesh */
PostRendering = 0x00008 /*!< Decoration that are applied <i>after</i> 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<QAction *> actions() const { return actionList; }
virtual QList<FilterIDType> types() const { return typeList; }
virtual QAction *action(QString name) const;
protected:
QList <QAction *> actionList;
QList <FilterIDType> 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

View File

@ -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 <QTabletEvent>
#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 <i>factory</i> 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<QAction *> 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

View File

@ -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;
}

View File

@ -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 "<br>" "<b>" and "<i>") 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:
<br>
See: <br />
<i>Luiz Velho, Denis Zorin </i><br/>
<b>"4-8 Subdivision"</b><br/>
CAGD, volume 18, Issue 5, Pages 397-427.<br/>
<br>
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<QAction*> actions() const { return actionList; }
virtual QList<FilterIDType> 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 <QAction*> actionList;
QList <FilterIDType> 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

View File

@ -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 <wrap/callback.h>
#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<Format> importFormats() const = 0;
virtual QList<Format> 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

View File

@ -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 <QAction>
#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

View File

@ -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);
}
}

View File

@ -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 <QAction>
#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 <typename... Ts>
void log(const char* f, Ts&&... ts);
void log(const char* s);
void log(const std::string& s);
template <typename... Ts>
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 <typename... Ts>
void realTimeLog(QString Id, const QString &meshName, const char * f, Ts&&... ts );
private:
GLLogStream *logstream;
};
/************************
* Template definitions *
************************/
template<typename... Ts>
void PluginInterface::log(const char* f, Ts&&... ts)
{
if(logstream != nullptr) {
logstream->Logf(GLLogStream::FILTER, f, std::forward<Ts>(ts)...);
}
}
template <typename... Ts>
void PluginInterface::log(GLLogStream::Levels Level, const char* f, Ts&&... ts)
{
if(logstream != nullptr) {
logstream->Logf(Level, f, std::forward<Ts>(ts)...);
}
}
template <typename... Ts>
void PluginInterface::realTimeLog(QString Id, const QString& meshName, const char* f, Ts&&... ts)
{
if(logstream != nullptr) {
logstream->RealTimeLogf(Id, meshName, f, std::forward<Ts>(ts)...);
}
}
#endif // MESHLAB_PLUGIN_INTERFACE_H

View File

@ -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, :
<your own opengl setup>
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<QAction *> 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

View File

@ -1,10 +1,14 @@
#include "pluginmanager.h"
#include <QObject>
#include <qapplication.h>
#include <QPluginLoader>
#include <QDebug>
#include <vcg/complex/algorithms/create/platonic.h>
#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<MeshFilterInterface *>(plugin);
PluginInterface *iCommon = nullptr;
FilterPluginInterface *iFilter = qobject_cast<FilterPluginInterface *>(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<MeshIOInterface *>(plugin);
IOPluginInterface *iIO = qobject_cast<IOPluginInterface *>(plugin);
if (iIO)
{
iCommon = iIO;
meshIOPlug.push_back(iIO);
iIO->initGlobalParameterSet(NULL, defaultGlobal);
}
MeshDecorateInterface *iDecorator = qobject_cast<MeshDecorateInterface *>(plugin);
DecoratePluginInterface *iDecorator = qobject_cast<DecoratePluginInterface *>(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<MeshRenderInterface *>(plugin);
RenderPluginInterface *iRender = qobject_cast<RenderPluginInterface *>(plugin);
if (iRender)
{
iCommon = iRender;
meshRenderPlug.push_back(iRender);
}
MeshEditInterfaceFactory *iEditFactory = qobject_cast<MeshEditInterfaceFactory *>(plugin);
EditPluginInterfaceFactory *iEditFactory = qobject_cast<EditPluginInterfaceFactory *>(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<QString, RichParameterList> 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<MeshIOInterface*>::iterator itIOPlugin = meshIOPlug.begin(); itIOPlugin != meshIOPlug.end(); ++itIOPlugin)
for (QVector<IOPluginInterface*>::iterator itIOPlugin = meshIOPlug.begin(); itIOPlugin != meshIOPlug.end(); ++itIOPlugin)
{
MeshIOInterface* pMeshIOPlugin = *itIOPlugin;
QList<MeshIOInterface::Format> format;
QMap<QString, MeshIOInterface*>* map = NULL;
IOPluginInterface* pMeshIOPlugin = *itIOPlugin;
QList<IOPluginInterface::Format> format;
QMap<QString, IOPluginInterface*>* map = NULL;
if (inpOut == int(IMPORT))
{
map = &allKnowInputFormats;
@ -288,9 +290,9 @@ void PluginManager::knownIOFormats()
formatFilters = &outFilters;
format = pMeshIOPlugin->exportFormats();
}
for (QList<MeshIOInterface::Format>::iterator itf = format.begin(); itf != format.end(); ++itf)
for (QList<IOPluginInterface::Format>::iterator itf = format.begin(); itf != format.end(); ++itf)
{
MeshIOInterface::Format currentFormat = *itf;
IOPluginInterface::Format currentFormat = *itf;
QString currentFilterEntry = currentFormat.description + " (";

View File

@ -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<QMap>
#include<QObject>
#include <QDir>
/**
\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<MeshFilterInterface*>& meshFilterPlugins() {return meshFilterPlug;}
inline QVector<MeshRenderInterface*>& meshRenderPlugins() {return meshRenderPlug;}
inline QVector<MeshDecorateInterface*>& meshDecoratePlugins() {return meshDecoratePlug;}
inline QVector<MeshEditInterfaceFactory*>& meshEditFactoryPlugins() {return meshEditInterfacePlug;}
inline QVector<FilterPluginInterface*>& meshFilterPlugins() {return meshFilterPlug;}
inline QVector<RenderPluginInterface*>& meshRenderPlugins() {return meshRenderPlug;}
inline QVector<DecoratePluginInterface*>& meshDecoratePlugins() {return meshDecoratePlug;}
inline QVector<EditPluginInterfaceFactory*>& meshEditFactoryPlugins() {return meshEditInterfacePlug;}
static QString getDefaultPluginDirPath();
static QString getBaseDirPath();
QMap<QString,RichParameterList> generateFilterParameterMap();
MeshDecorateInterface* getDecoratorInterfaceByName(const QString& name);
DecoratePluginInterface* getDecoratorInterfaceByName(const QString& name);
QMap<QString, QAction*> actionFilterMap;
QMap<QString, MeshFilterInterface*> stringFilterMap;
QMap<QString,MeshIOInterface*> allKnowInputFormats;
QMap<QString,MeshIOInterface*> allKnowOutputFormats;
QMap<QString, FilterPluginInterface*> stringFilterMap;
QMap<QString,IOPluginInterface*> allKnowInputFormats;
QMap<QString,IOPluginInterface*> allKnowOutputFormats;
QStringList inpFilters;
QStringList outFilters;
QVector<MeshIOInterface*> meshIOPlug;
QVector<MeshFilterInterface*> meshFilterPlug;
QVector<MeshRenderInterface*> meshRenderPlug;
QVector<MeshDecorateInterface*> meshDecoratePlug;
QVector<MeshEditInterfaceFactory*> meshEditInterfacePlug;
QVector<IOPluginInterface*> meshIOPlug;
QVector<FilterPluginInterface*> meshFilterPlug;
QVector<RenderPluginInterface*> meshRenderPlug;
QVector<DecoratePluginInterface*> meshDecoratePlug;
QVector<EditPluginInterfaceFactory*> meshEditInterfacePlug;
QVector<QAction *> editActionList;
QVector<QAction *> decoratorActionList;
// Used for unique destruction - this "owns" all IO, Filter, Render, and Decorate plugins
QVector<MeshCommonInterface *> ownerPlug;
QVector<PluginInterface *> ownerPlug;
QStringList pluginsLoaded;

View File

@ -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)

View File

@ -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<MeshFilterInterface *>(action->parent());
FilterPluginInterface *iFilter = qobject_cast<FilterPluginInterface *>(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();

View File

@ -23,7 +23,6 @@
#include <common/interfaces.h>
#include <common/GLExtensionsManager.h>
#include "glarea.h"
@ -35,6 +34,8 @@
#include <QClipboard>
#include <QLocale>
#include <QPainterPath>
#include <QElapsedTimer>
#include <QApplication>
#include <wrap/gl/picking.h>
#include <wrap/qt/trackball.h>
@ -484,7 +485,7 @@ void GLArea::paintEvent(QPaintEvent* /*event*/)
QList<QAction *>& tmpset = iPerMeshDecoratorsListMap[mp->id()];
for( QList<QAction *>::iterator it = tmpset.begin(); it != tmpset.end();++it)
{
MeshDecorateInterface * decorInterface = qobject_cast<MeshDecorateInterface *>((*it)->parent());
DecoratePluginInterface * decorInterface = qobject_cast<DecoratePluginInterface *>((*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<QAction *>& tmpset = iPerMeshDecoratorsListMap[mp->id()];
for (QList<QAction *>::iterator it = tmpset.begin(); it != tmpset.end(); ++it)
{
MeshDecorateInterface * decorInterface = qobject_cast<MeshDecorateInterface *>((*it)->parent());
DecoratePluginInterface * decorInterface = qobject_cast<DecoratePluginInterface *>((*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<MeshDecorateInterface *>(p->parent());
DecoratePluginInterface * decorInterface = qobject_cast<DecoratePluginInterface *>(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<MeshDecorateInterface *>(p->parent());
DecoratePluginInterface * decorInterface = qobject_cast<DecoratePluginInterface *>(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<MeshDecorateInterface*>(act->parent());
DecoratePluginInterface* mdec = qobject_cast<DecoratePluginInterface*>(act->parent());
mdec->endDecorate(act,*md(),glas.currentGlobalParamSet,this);
mdec->setLog(NULL);
}
@ -1165,7 +1166,7 @@ bool GLArea::readyToClose()
for(QSet<QAction *>::iterator it = dectobeclose.begin();it != dectobeclose.end();++it)
{
MeshDecorateInterface* mdec = qobject_cast<MeshDecorateInterface*>((*it)->parent());
DecoratePluginInterface* mdec = qobject_cast<DecoratePluginInterface*>((*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 &currentMeshModel = *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

View File

@ -36,7 +36,9 @@
#include <QTimer>
#include <QTime>
#include <common/interfaces.h>
#include <common/interfaces/render_plugin_interface.h>
#include <common/interfaces/decorate_plugin_interface.h>
#include <common/interfaces/edit_plugin_interface.h>
#include <common/ml_shared_data_context.h>
#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<QAction *> iPerDocDecoratorlist;
QList<QAction *> &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<MeshDecorateInterface *>(p->parent());
DecoratePluginInterface * decorInterface = qobject_cast<DecoratePluginInterface *>(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<QAction*, MeshEditInterface*> actionToMeshEditMap;
QMap<QAction*, EditPluginInterface*> actionToMeshEditMap;
//the last model that start edit was called with
MeshModel *lastModelEdited;

View File

@ -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)"));

View File

@ -71,7 +71,7 @@ public:
void updateGlobalParameterSet(const RichParameterList& rps );
static void initGlobalParameterSet( RichParameterList * defaultGlobalParamSet);
static void initGlobalParameterList( RichParameterList * defaultGlobalParamSet);
const RichParameterList *currentGlobalParamSet;
};

View File

@ -32,6 +32,7 @@ $Log: stdpardialog.cpp,v $
#include <QActionGroup>
#include <QDebug>
#include <QFontMetrics>
#include <QSettings>
#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<MeshDecorateInterface *>(decList[ii]->parent());
DecoratePluginInterface* decPlug = qobject_cast<DecoratePluginInterface *>(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<MeshDecorateInterface *>(act->parent());
DecoratePluginInterface* decPlug = qobject_cast<DecoratePluginInterface *>(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;

View File

@ -42,7 +42,7 @@ class GLLogStream;
class MeshModel;
class RasterModel;
class MeshDocument;
class MeshDecorateInterface;
class DecoratePluginInterface;
class RichParameterListFrame;
class QGridLayout;
class QToolBar;

View File

@ -29,6 +29,7 @@
#include <GL/glew.h>
#include "../common/interfaces/mainwindow_interface.h"
#include "../common/pluginmanager.h"
#include <wrap/qt/qt_thread_safe_memory_info.h>
@ -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

View File

@ -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 <QStatusBar>
#include <QMenuBar>
#include <QWidgetAction>
#include <QMessageBox>
#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<QString, MeshFilterInterface *>::iterator msi;
QMap<QString, FilterPluginInterface *>::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) + "<br>" + 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 <defaultGlobalParams> .
// 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 =
"<center>You are using an old version of MeshLab.<br><br>"
"Please, upgrade to the new version!<br><br>";
if (checkForMonthlyAndBetasVal){
message +=
"<big> <a href=\"https://github.com/cnr-isti-vclab/meshlab/releases\">Download</a></big></center>";
}
else {
message +=
"<big> <a href=\"https://www.meshlab.net/#download\">Download</a></big></center>";
}
msgBox.setText(
"<center>You are using an old version of MeshLab.<br><br>"
"Please, upgrade to the new version!<br><br>"
@ -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<Scalarm>::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<Scalarm>::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

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,6 @@ DEPENDPATH += \
$$VCGDIR/wrap
HEADERS += \
../common/interfaces.h \
mainwindow.h \
glarea.h \
meshlab_settings/meshlabsettingsdialog.h \

View File

@ -23,6 +23,8 @@
#include "settingdialog.h"
#include <QSettings>
SettingDialog::SettingDialog(
const RichParameter& currentParam,
const RichParameter& defaultParam,

View File

@ -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());

View File

@ -26,6 +26,7 @@
#include<QDockWidget>
#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;

View File

@ -23,6 +23,7 @@
#include "multiViewer_Container.h"
#include "glarea.h"
#include <QMouseEvent>
#include <QMessageBox>
#include "mainwindow.h"
#include <common/mlapplication.h>

View File

@ -22,9 +22,17 @@
****************************************************************************/
#include "plugindialog.h"
#include <common/interfaces.h>
#include <common/interfaces/filter_plugin_interface.h>
#include <common/interfaces/io_plugin_interface.h>
#include <common/interfaces/decorate_plugin_interface.h>
#include <common/interfaces/render_plugin_interface.h>
#include <common/interfaces/edit_plugin_interface.h>
#include <QLabel>
#include <QDir>
#include <QPluginLoader>
#include <QTreeWidget>
#include <QGroupBox>
#include <QPushButton>
@ -116,40 +124,40 @@ void PluginDialog::populateTreeWidget(const QString &path,const QStringList &fil
pluginItem->setFont(0, boldFont);
if (plugin) {
MeshIOInterface *iMeshIO = qobject_cast<MeshIOInterface *>(plugin);
IOPluginInterface *iMeshIO = qobject_cast<IOPluginInterface *>(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<MeshDecorateInterface *>(plugin);
DecoratePluginInterface *iDecorate = qobject_cast<DecoratePluginInterface *>(plugin);
if (iDecorate){
QStringList Templist;
foreach(QAction *a,iDecorate->actions()){Templist.push_back(a->text());}
addItems(pluginItem,Templist);
}
MeshFilterInterface *iFilter = qobject_cast<MeshFilterInterface *>(plugin);
FilterPluginInterface *iFilter = qobject_cast<FilterPluginInterface *>(plugin);
if (iFilter){
QStringList Templist;
foreach(QAction *a,iFilter->actions()){Templist.push_back(a->text());}
addItems(pluginItem,Templist);
}
MeshRenderInterface *iRender = qobject_cast<MeshRenderInterface *>(plugin);
RenderPluginInterface *iRender = qobject_cast<RenderPluginInterface *>(plugin);
if (iRender){
QStringList Templist;
foreach(QAction *a,iRender->actions()){Templist.push_back(a->text());}
addItems(pluginItem,Templist);
}
MeshEditInterfaceFactory *iEdit = qobject_cast<MeshEditInterfaceFactory *>(plugin);
EditPluginInterfaceFactory *iEdit = qobject_cast<EditPluginInterfaceFactory *>(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<MeshIOInterface *>(plugin);
IOPluginInterface *iMeshIO = qobject_cast<IOPluginInterface *>(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<MeshDecorateInterface *>(plugin);
DecoratePluginInterface *iDecorate = qobject_cast<DecoratePluginInterface *>(plugin);
if (iDecorate)
{
foreach(QAction *a,iDecorate->actions())
if (actionName==a->text())
labelInfo->setText(iDecorate->decorationInfo(a));
}
MeshFilterInterface *iFilter = qobject_cast<MeshFilterInterface *>(plugin);
FilterPluginInterface *iFilter = qobject_cast<FilterPluginInterface *>(plugin);
if (iFilter)
{
foreach(QAction *a,iFilter->actions())
if (actionName==a->text()) labelInfo->setText(iFilter->filterInfo(iFilter->ID(a)));
}
MeshRenderInterface *iRender = qobject_cast<MeshRenderInterface *>(plugin);
RenderPluginInterface *iRender = qobject_cast<RenderPluginInterface *>(plugin);
if (iRender){
}
MeshEditInterfaceFactory *iEditFactory = qobject_cast<MeshEditInterfaceFactory *>(plugin);
EditPluginInterfaceFactory *iEditFactory = qobject_cast<EditPluginInterfaceFactory *>(plugin);
if (iEditFactory)
{
foreach(QAction *a, iEditFactory->actions())

View File

@ -24,8 +24,6 @@
#ifndef RICHPARAMETERLISTFRAME_H
#define RICHPARAMETERLISTFRAME_H
#include "../../common/interfaces.h"
#include "richparameterwidgets.h"
#include<QCheckBox>

View File

@ -26,6 +26,8 @@
#include <QColorDialog>
#include <QClipboard>
#include <QFileDialog>
#include <QApplication>
#include <common/meshmodel.h>
/******************************************/
// MeshLabWidget Implementation

View File

@ -34,8 +34,8 @@
#include <QComboBox>
#include <QSlider>
#include "common/interfaces.h"
#include "common/filter_parameter/rich_parameter_list.h"
#include "common/ml_mesh_type.h"
class RichParameterWidget : public QWidget
{

View File

@ -24,6 +24,8 @@
#ifndef __VCGLIB_SAVEMASK_EXPORT
#define __VCGLIB_SAVEMASK_EXPORT
#include <QDialog>
#include <wrap/io_trimesh/io_mask.h>
#include "rich_parameter_gui/richparameterlistframe.h"

View File

@ -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))

View File

@ -34,14 +34,15 @@ New small samples
#include <QAction>
#include <QList>
#include <common/interfaces.h>
#include <common/interfaces/decorate_plugin_interface.h>
#include <common/ml_shared_data_context.h>
#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:

View File

@ -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(), "<table>"
this->realTimeLog("Bounding Box", m.label(), "<table>"
"<tr><td>Min: </td><td width=70 align=right>%7.4f</td><td width=70 align=right> %7.4f</td><td width=70 align=right> %7.4f</td></tr>"
"<tr><td>Max: </td><td width=70 align=right>%7.4f</td><td width=70 align=right> %7.4f</td><td width=70 align=right> %7.4f</td></tr>"
"<tr><td>Size: </td><td width=70 align=right>%7.4f</td><td width=70 align=right> %7.4f</td><td width=70 align=right> %7.4f</td></tr>"
@ -290,7 +290,7 @@ void DecorateBasePlugin::decorateMesh(QAction *a, MeshModel &m, const RichParame
QGLShaderProgram *glp=this->contourShaderProgramMap[&m];
CMeshO::PerMeshAttributeHandle< pair<float,float> > mmqH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<pair<float,float> >(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,
"<table>"
"<tr><td>Viewpoint: </td><td width=70 align=right>%7.4f</td><td width=70 align=right> %7.4f</td><td width=70 align=right> %7.4f</td></tr>"
"<tr><td>axis 0: </td><td width=70 align=right>%7.4f</td><td width=70 align=right> %7.4f</td><td width=70 align=right> %7.4f</td></tr>"
@ -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))

View File

@ -24,7 +24,9 @@
#ifndef EXTRADECORATEPLUGIN_H
#define EXTRADECORATEPLUGIN_H
#include <common/interfaces.h>
#include <common/interfaces/decorate_plugin_interface.h>
#include <common/ml_shared_data_context.h>
#include <wrap/gui/coordinateframe.h>
#include "colorhistogram.h"
@ -33,11 +35,11 @@ typedef vcg::ColorHistogram<float> CHist;
typedef std::pair<Point3m,vcg::Color4b> 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" ; }

View File

@ -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) )
{

View File

@ -27,18 +27,19 @@
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/decorate_plugin_interface.h>
#include <common/ml_shared_data_context.h>
#include <common/meshmodel.h>
#include <wrap/glw/glw.h>
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<QAction*> 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;
};

View File

@ -28,7 +28,7 @@
#include <cassert>
//#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/decorate_plugin_interface.h>
//#include <meshlab/glarea.h>

View File

@ -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:

View File

@ -24,7 +24,7 @@
#define SAMPLE_DECORATE_PLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/decorate_plugin_interface.h>
#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<QAction *> 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;

View File

@ -25,7 +25,6 @@
class QCheckBox;
#include <common/interfaces.h>
#include "AlignPairWidget.h"
#include <QCheckBox>

View File

@ -37,6 +37,8 @@ $Log: meshedit.cpp,v $
#include <vcg/space/point_matching.h>
#include <vcg/complex/algorithms/point_matching_scale.h>
#include <QMessageBox>
using namespace vcg;
//todo: remove these orrible defs from here

View File

@ -24,17 +24,17 @@
#ifndef EditAlignPLUGIN_H
#define EditAlignPLUGIN_H
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
#include <vcg/complex/algorithms/align_pair.h>
#include "align/OccupancyGrid.h"
#include "meshtree.h"
#include <wrap/gui/trackball.h>
#include "alignDialog.h"
class EditAlignPlugin : public QObject, public MeshEditInterface
class EditAlignPlugin : public QObject, public EditPluginInterface
{
Q_OBJECT
Q_INTERFACES(MeshEditInterface)
Q_INTERFACES(EditPluginInterface)
enum
{

View File

@ -41,13 +41,13 @@ QList<QAction *> 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();
}

View File

@ -26,13 +26,13 @@
#define EditAlignFactoryPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
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<QAction *> 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 <QAction *> actionList;

View File

@ -26,7 +26,7 @@
#include <QObject>
#include <common/interfaces.h>
#include <common/meshmodel.h>
#include <vcg/complex/algorithms/align_pair.h>
#include "align/AlignGlobal.h"
#include "align/OccupancyGrid.h"

View File

@ -1101,7 +1101,7 @@ void EditManipulatorsPlugin::Decorate(MeshModel &model, GLArea *gla, QPainter* /
HelpString3 = "<br>press RETURN to apply, BACKSPACE to cancel";
}
this->RealTimeLog("Manipulator","",qUtf8Printable("<b>"+StatusString1+"</b>"+StatusString2+HelpString1+HelpString2+HelpString3));
this->realTimeLog("Manipulator","",qUtf8Printable("<b>"+StatusString1+"</b>"+StatusString2+HelpString1+HelpString2+HelpString3));
// render original mesh BBox
DrawMeshBox(model);

View File

@ -27,12 +27,12 @@
#include <QStringList>
#include <QList>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
class EditManipulatorsPlugin : public QObject, public MeshEditInterface
class EditManipulatorsPlugin : public QObject, public EditPluginInterface
{
Q_OBJECT
Q_INTERFACES(MeshEditInterface)
Q_INTERFACES(EditPluginInterface)
public:

View File

@ -41,7 +41,7 @@ QList<QAction *> 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();
}

View File

@ -26,13 +26,13 @@
#define EditManipulatorsFactoryPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
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<QAction *> 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 <QAction *> actionList;

View File

@ -29,6 +29,8 @@ $Log: editmeasure.cpp,v $
#include "edit_measure.h"
#include <wrap/qt/gl_label.h>
#include <QTextStream>
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; mind<measures.size(); mind++)
@ -110,11 +112,11 @@ void EditMeasurePlugin::Decorate(MeshModel & m, GLArea * gla,QPainter* p)
}
if (measures.size() == 0)
this->RealTimeLog("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; mind<measures.size(); mind++)
{
this->Log(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 -");
}
}
}

View File

@ -32,7 +32,7 @@ $Log: editmeasure.h,v $
#include <QStringList>
#include <QList>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
#include <wrap/gui/rubberband.h>
//--------------------------------------
@ -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();

View File

@ -41,7 +41,7 @@ QList<QAction *> 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();
}

View File

@ -26,13 +26,13 @@
#define EditMeasureFactoryPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
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<QAction *> 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 <QAction *> actionList;

View File

@ -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 <br> Active Point: %s",pointID[cindex].toStdString().c_str());
this->RealTimeLog("Raster Alignment", m.shortName(),
this->realTimeLog("Raster Alignment", m.shortName(),
"%s<br>"
"%s<br>"
"%s<br>"
@ -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<rounds; i++)
{
Log("Step %i of %i.", i + 1, rounds);
log("Step %i of %i.", i + 1, rounds);
solver.maxiter = 30;
@ -704,14 +704,14 @@ Point2m EditMutualCorrsPlugin::fromImageToGL(Point2m picked)
bool EditMutualCorrsPlugin::initGL()
{
Log(GLLogStream::SYSTEM, "GL Initialization");
log(GLLogStream::SYSTEM, "GL Initialization");
if (!GLExtensionsManager::initializeGLextensions_notThrowing()) {
Log(GLLogStream::SYSTEM, "GLEW initialization error!");
log(GLLogStream::SYSTEM, "GLEW initialization error!");
return false;
}
if (!glewIsSupported("GL_EXT_framebuffer_object")) {
Log(GLLogStream::SYSTEM, "Graphics hardware does not support FBOs");
log(GLLogStream::SYSTEM, "Graphics hardware does not support FBOs");
return false;
}
if (!glewIsSupported("GL_ARB_vertex_shader") || !glewIsSupported("GL_ARB_fragment_shader") ||
@ -721,11 +721,11 @@ bool EditMutualCorrsPlugin::initGL()
}
if (!glewIsSupported("GL_ARB_texture_non_power_of_two")) {
Log(GLLogStream::SYSTEM, "Graphics hardware does not support non-power-of-two textures");
log(GLLogStream::SYSTEM, "Graphics hardware does not support non-power-of-two textures");
return false;
}
if (!glewIsSupported("GL_ARB_vertex_buffer_object")) {
Log(GLLogStream::SYSTEM, "Graphics hardware does not support vertex buffer objects");
log(GLLogStream::SYSTEM, "Graphics hardware does not support vertex buffer objects");
return false;
}
@ -742,6 +742,6 @@ bool EditMutualCorrsPlugin::initGL()
align.resize(800);
//assert(glGetError() == 0);
Log(GLLogStream::SYSTEM, "GL Initialization done");
log(GLLogStream::SYSTEM, "GL Initialization done");
return true;
}

View File

@ -25,7 +25,7 @@
#define EditMutualCorrsPlugin_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
#include "edit_mutualcorrsDialog.h"
#include "alignset.h"
@ -33,10 +33,10 @@
#include <vcg/space/point_matching.h>
class EditMutualCorrsPlugin : public QObject, public MeshEditInterface
class EditMutualCorrsPlugin : public QObject, public EditPluginInterface
{
Q_OBJECT
Q_INTERFACES(MeshEditInterface)
Q_INTERFACES(EditPluginInterface)
public:
EditMutualCorrsPlugin();

View File

@ -41,7 +41,7 @@ QList<QAction *> 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();
}

View File

@ -25,13 +25,13 @@
#define EditMutualCorrsPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
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<QAction *> 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 <QAction *> actionList;

View File

@ -29,7 +29,7 @@
#include <QDockWidget>
#include <meshlab/glarea.h>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
#include <wrap/gl/pick.h>
#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();

View File

@ -41,7 +41,7 @@ QList<QAction *> 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();
}

View File

@ -26,13 +26,13 @@
#define EditPaintFactoryPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
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<QAction *> 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 <QAction *> actionList;

View File

@ -41,7 +41,7 @@ QList<QAction *> 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();
}

View File

@ -26,13 +26,13 @@
#define EditPickPointsFactoryPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
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<QAction *> 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 <QAction *> actionList;

View File

@ -30,13 +30,13 @@
#ifndef EDIT_PickPoints_PLUGIN_H
#define EDIT_PickPoints_PLUGIN_H
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
#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

View File

@ -40,6 +40,8 @@
#include <vcg/complex/algorithms/closest.h>
#include <QGLWidget>
#include <QDebug>
#include <QMessageBox>
using namespace vcg;

View File

@ -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(),
"<table>"
"<tr><td width=50> Hop Thr:</td><td width=100 align=right><b >%8.3f </b></td><td><i> (Wheel to change it)</i> </td></tr>"
"<tr><td> Radius: </td><td width=70 align=right><b> %8.3f </b></td><td><i> (Drag or Alt+Wheel to change it)</i></td></tr>"

View File

@ -25,12 +25,12 @@
#define EDITPOINTPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
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};

View File

@ -43,7 +43,7 @@ QList<QAction *> 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();
}

View File

@ -26,13 +26,13 @@
#define EditPointFactoryPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
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<QAction *> 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 <QAction *> actionList;

View File

@ -42,7 +42,7 @@ QList<QAction *> 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();
}

View File

@ -26,13 +26,13 @@
#define QualityMapperFactoryPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
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<QAction *> 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 <QAction *> actionList;

View File

@ -32,6 +32,7 @@ FIRST RELEASE
#include <meshlab/glarea.h>
#include "qualitymapper.h"
#include <vcg/space/triangle3.h> //for quality
#include <QMessageBox>
using namespace vcg;

View File

@ -34,14 +34,14 @@ FIRST RELEASE
#include <QAction>
#include <QList>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
#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;

View File

@ -27,6 +27,7 @@
#include <QBrush>
#include <QGraphicsSceneMouseEvent>
#include <QFileDialog>
#include <QMessageBox>
using namespace vcg;

View File

@ -30,6 +30,7 @@
#include "edit_referencingDialog.h"
#include <QFileDialog>
#include <QTextStream>
#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<br>"
"%s<br>"
"%s<br>"
@ -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<br>"
"%s<br>"
"%s<br><br>"
@ -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

View File

@ -25,17 +25,17 @@
#define EDITREFERENCINGPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
#include "edit_referencingDialog.h"
// function to calculate rototranslaton and rototranslaton+scale matrices from series of points
#include <vcg/space/point_matching.h>
class EditReferencingPlugin : public QObject, public MeshEditInterface
class EditReferencingPlugin : public QObject, public EditPluginInterface
{
Q_OBJECT
Q_INTERFACES(MeshEditInterface)
Q_INTERFACES(EditPluginInterface)
public:

View File

@ -41,7 +41,7 @@ QList<QAction *> 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();
}

View File

@ -25,13 +25,13 @@
#define EditReferencingFactoryPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
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<QAction *> 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 <QAction *> actionList;

View File

@ -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();
}

View File

@ -25,12 +25,12 @@
#define SAMPLEEDITPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
class SampleEditPlugin : public QObject, public MeshEditInterface
class SampleEditPlugin : public QObject, public EditPluginInterface
{
Q_OBJECT
Q_INTERFACES(MeshEditInterface)
Q_INTERFACES(EditPluginInterface)
public:
SampleEditPlugin();

View File

@ -41,7 +41,7 @@ QList<QAction *> 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();
}

View File

@ -26,13 +26,13 @@
#define SampleEditFactoryPLUGIN_H
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
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<QAction *> 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 <QAction *> actionList;

View File

@ -27,6 +27,7 @@
#include <wrap/qt/device_to_logical.h>
#include <meshlab/glarea.h>
#include <vcg/space/intersection2.h>
#include <QApplication>
using namespace std;
@ -519,7 +520,7 @@ void EditSelectPlugin::Decorate(MeshModel &m, GLArea * gla)
line4 = "<br>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<br>%s<br>%s<br>%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:<br>- CTRL to add<br>- SHIFT to subtract";
line3 = "<br>A select all, D de-select all, I invert all";
this->RealTimeLog("Interactive Selection", m.shortName(), "%s<br>%s<br>%s", line1.toStdString().c_str(), line2.toStdString().c_str(), line3.toStdString().c_str());
this->realTimeLog("Interactive Selection", m.shortName(), "%s<br>%s<br>%s", line1.toStdString().c_str(), line2.toStdString().c_str(), line3.toStdString().c_str());
}
if (isDragging)

View File

@ -23,12 +23,12 @@
#ifndef EDITPLUGIN_H
#define EDITPLUGIN_H
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
class EditSelectPlugin : public QObject, public MeshEditInterface
class EditSelectPlugin : public QObject, public EditPluginInterface
{
Q_OBJECT
Q_INTERFACES(MeshEditInterface)
Q_INTERFACES(EditPluginInterface)
public:

View File

@ -47,7 +47,7 @@ QList<QAction *> 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();
}

View File

@ -25,13 +25,13 @@
#ifndef EditSelectFactoryPLUGIN_H
#define EditSelectFactoryPLUGIN_H
#include <common/interfaces.h>
#include <common/interfaces/edit_plugin_interface.h>
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<QAction *> 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 <QAction *> actionList;

View File

@ -24,6 +24,8 @@
#include <common/GLExtensionsManager.h>
#include "filter_ao.h"
#include <QGLFramebufferObject>
#include <QElapsedTimer>
#include <QTextStream>
#include <vcg/math/gen_normal.h>
#include <wrap/qt/checkGLError.h>
@ -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<Point3f> &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);
}

View File

@ -26,14 +26,14 @@
#include <QObject>
#include <common/interfaces.h>
#include <common/interfaces/filter_plugin_interface.h>
#include <wrap/gl/gl_surface.h>
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<vcg::Point3f> &posVect);

View File

@ -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))
{

Some files were not shown because too many files have changed in this diff Show More