Merge pull request #1084 from alemuntoni/new_filter_dialog

New filter dialog
This commit is contained in:
Alessandro Muntoni 2021-09-15 10:27:43 +02:00 committed by GitHub
commit 1e3334ae3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 1664 additions and 1193 deletions

View File

@ -46,7 +46,6 @@ template <class T> class CurvaturemOcf: public CurvatureOcf<Scalarm, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturemOcf"));T::Name(name);}
};
template <class T> class CurvatureDirmOcf: public CurvatureDirOcf<CurvatureDirTypeOcf<Scalarm>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirmOcf"));T::Name(name);}
};

View File

@ -324,9 +324,9 @@ bool RichMatrix44f::operator==( const RichParameter& rb )
return (rb.value().isMatrix44f() &&(pName == rb.name()) && (value().getMatrix44f() == rb.value().getMatrix44f()));
}
/**** RichPoint3f Class ****/
/**** RichPosition Class ****/
RichPoint3f::RichPoint3f(
RichPosition::RichPosition(
const QString& nm,
const Point3m& defval,
const QString& desc,
@ -337,21 +337,53 @@ RichPoint3f::RichPoint3f(
{
}
RichPoint3f::~RichPoint3f()
RichPosition::~RichPosition()
{
}
QString RichPoint3f::stringType() const
QString RichPosition::stringType() const
{
return "RichPoint3f";
return "RichPosition";
}
RichPoint3f* RichPoint3f::clone() const
RichPosition* RichPosition::clone() const
{
return new RichPoint3f(*this);
return new RichPosition(*this);
}
bool RichPoint3f::operator==( const RichParameter& rb )
bool RichPosition::operator==( const RichParameter& rb )
{
return (rb.value().isPoint3f() &&(pName == rb.name()) && (value().getPoint3f() == rb.value().getPoint3f()));
}
/**** RichDirection Class ****/
RichDirection::RichDirection(
const QString& nm,
const Point3m& defval,
const QString& desc,
const QString& tltip,
bool hidden,
const QString& category) :
RichParameter(nm, Point3fValue(defval), desc, tltip, hidden, category)
{
}
RichDirection::~RichDirection()
{
}
QString RichDirection::stringType() const
{
return "RichDirection";
}
RichDirection* RichDirection::clone() const
{
return new RichDirection(*this);
}
bool RichDirection::operator==(const RichParameter& rb)
{
return (rb.value().isPoint3f() &&(pName == rb.name()) && (value().getPoint3f() == rb.value().getPoint3f()));
}
@ -823,7 +855,7 @@ bool RichParameterAdapter::create( const QDomElement& np,RichParameter** par )
return true;
}
if(type=="RichPoint3f") {
if(type=="RichPoint3f") { // for backward compatibility
vcg::Point3f val;
val[0]=np.attribute("x").toFloat(&corrconv);
if (!corrconv)
@ -835,7 +867,37 @@ bool RichParameterAdapter::create( const QDomElement& np,RichParameter** par )
if (!corrconv)
return false;
*par = new RichPoint3f(name, val,desc,tooltip);
*par = new RichPosition(name, val,desc,tooltip);
return true;
}
if(type=="RichPosition") { // for backward compatibility
vcg::Point3f val;
val[0]=np.attribute("x").toFloat(&corrconv);
if (!corrconv)
return false;
val[1]=np.attribute("y").toFloat(&corrconv);
if (!corrconv)
return false;
val[2]=np.attribute("z").toFloat(&corrconv);
if (!corrconv)
return false;
*par = new RichPosition(name, val,desc,tooltip);
return true;
}
if(type=="RichDirection") { // for backward compatibility
vcg::Point3f val;
val[0]=np.attribute("x").toFloat(&corrconv);
if (!corrconv)
return false;
val[1]=np.attribute("y").toFloat(&corrconv);
if (!corrconv)
return false;
val[2]=np.attribute("z").toFloat(&corrconv);
if (!corrconv)
return false;
*par = new RichDirection(name, val,desc,tooltip);
return true;
}
if(type=="RichShotf") {

View File

@ -188,21 +188,39 @@ public:
bool operator==(const RichParameter& rb);
};
class RichPoint3f : public RichParameter
class RichPosition : public RichParameter
{
public:
RichPoint3f(
RichPosition(
const QString& nm,
const Point3m& defval,
const QString& desc = QString(),
const QString& tltip = QString(),
bool hidden = false,
const QString& category = QString());
~RichPoint3f();
~RichPosition();
QString stringType() const;
RichPoint3f* clone() const;
RichPosition* clone() const;
bool operator==(const RichParameter& rb);
};
class RichDirection : public RichParameter
{
public:
RichDirection(
const QString& nm,
const Point3m& defval,
const QString& desc = QString(),
const QString& tltip = QString(),
bool hidden = false,
const QString& category = QString());
~RichDirection();
QString stringType() const;
RichDirection* clone() const;
bool operator==(const RichParameter& rb);
};

View File

@ -141,7 +141,7 @@ void pymeshlab::FunctionParameter::printDefaultValue(std::ostream& o) const
<< "[" << v[12] << ", " << v[13] << ", " << v[14] << ", " << v[15] << "]]";
return;
}
if (parameter->isOfType<RichPoint3f>()) {
if (parameter->isOfType<RichPosition>() || parameter->isOfType<RichDirection>()) {
o << "[" << parameter->value().getPoint3f().X() << ", "
<< parameter->value().getPoint3f().Y() << ", "
<< parameter->value().getPoint3f().Z() << "]";

View File

@ -44,7 +44,9 @@ QString pymeshlab::computePythonTypeString(const RichParameter& par)
return PYTHON_TYPE_STRING;
if (par.isOfType<RichMatrix44f>())
return PYTHON_TYPE_MATRIX44F;
if (par.isOfType<RichPoint3f>())
if (par.isOfType<RichPosition>())
return PYTHON_TYPE_POINT3F;
if (par.isOfType<RichDirection>())
return PYTHON_TYPE_POINT3F;
if (par.isOfType<RichShotf>())
return PYTHON_TYPE_SHOTF;

View File

@ -12,16 +12,17 @@ set(SOURCES
ml_default_decorators.cpp
ml_render_gui.cpp
ml_rendering_actions.cpp
ml_std_par_dialog.cpp
multiViewer_Container.cpp
dialogs/about_dialog.cpp
dialogs/congrats_dialog.cpp
dialogs/filter_dock_dialog.cpp
dialogs/filter_script_dialog.cpp
dialogs/options_dialog.cpp
dialogs/plugin_info_dialog.cpp
dialogs/save_mesh_attributes_dialog.cpp
dialogs/save_snapshot_dialog.cpp
dialogs/setting_dialog.cpp
gui_utils/vertical_scroll_area.cpp
rich_parameter_gui/richparameterlistdialog.cpp
rich_parameter_gui/richparameterlistframe.cpp
rich_parameter_gui/richparameterwidgets.cpp
@ -38,17 +39,18 @@ set(HEADERS
ml_default_decorators.h
ml_render_gui.h
ml_rendering_actions.h
ml_std_par_dialog.h
multiViewer_Container.h
snapshotsetting.h
dialogs/about_dialog.h
dialogs/congrats_dialog.h
dialogs/filter_dock_dialog.h
dialogs/filter_script_dialog.h
dialogs/options_dialog.h
dialogs/plugin_info_dialog.h
dialogs/save_mesh_attributes_dialog.h
dialogs/save_snapshot_dialog.h
dialogs/setting_dialog.h
gui_utils/vertical_scroll_area.h
rich_parameter_gui/richparameterlistdialog.h
rich_parameter_gui/richparameterlistframe.h
rich_parameter_gui/richparameterwidgets.h
@ -61,6 +63,7 @@ set(RESOURCES meshlab.qrc)
set(UI
dialogs/about_dialog.ui
dialogs/congrats_dialog.ui
dialogs/filter_dock_dialog.ui
dialogs/filter_script_dialog.ui
dialogs/plugin_info_dialog.ui
dialogs/save_mesh_attributes_dialog.ui

View File

@ -0,0 +1,239 @@
/****************************************************************************
* VCGLib o o *
* Visual and Computer Graphics Library o o *
* _ O _ *
* Copyright(C) 2004-2021 \/)\/ *
* Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | *
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
#include "filter_dock_dialog.h"
#include "ui_filter_dock_dialog.h"
#include "../mainwindow.h"
FilterDockDialog::FilterDockDialog(
const RichParameterList& rpl,
FilterPlugin* plugin,
const QAction* filter,
QWidget* parent,
GLArea* glArea) :
QDockWidget(parent),
ui(new Ui::FilterDockDialog),
plugin(plugin),
filter(filter),
parameters(rpl),
mask(plugin->postCondition(filter)),
currentGLArea(glArea),
isPreviewMeshStateValid(false),
prevParams(rpl),
mw(nullptr),
md(nullptr),
mesh(nullptr)
{
ui->setupUi(this);
this->setWindowTitle(plugin->filterName(filter));
ui->filterInfoLabel->setText(plugin->filterInfo(filter));
ui->parameterFrame->initParams(rpl, rpl, (QWidget*) glArea);
// by default, the previewCheckBox is visible when the dialog is constructed.
// now, we check if the filter is previewable:
// - if it is previewable, we set all data structures necessary to make the preview available
// - if it is not previewable, we set the previewCheckBox non visible
if (!isFilterPreviewable(plugin, filter)) {
ui->previewCheckBox->setVisible(false);
}
else {
// parent should always be the mainwindow
// if not, the filter won't be previewable
mw = static_cast<MainWindow*>(parent);
if (mw) {
md = mw->meshDoc();
mesh = mw->meshDoc()->mm();
if (md == nullptr || mesh == nullptr) {
ui->previewCheckBox->setVisible(false);
mw = nullptr;
md = nullptr;
mesh = nullptr;
}
else {
noPreviewMeshState.create(mask, mesh);
connect(ui->parameterFrame, SIGNAL(parameterChanged()), this, SLOT(applyDynamic()));
connect(md, SIGNAL(currentMeshChanged(int)), this, SLOT(changeCurrentMesh(int)));
}
}
else {
ui->previewCheckBox->setVisible(false);
}
}
//horrible hack to make the window of almost the right size...
ui->filterInfoLabel->adjustSize();
ui->parameterFrame->adjustSize();
resize(
width(),
ui->filterInfoLabel->height() + ui->parameterFrame->height() +
ui->previewCheckBox->height() + ui->applyPushButton->height() * 2 + 10);
}
FilterDockDialog::~FilterDockDialog()
{
delete ui;
}
void FilterDockDialog::on_previewCheckBox_stateChanged(int state)
{
if (state == Qt::Checked) { // enable preview
ui->parameterFrame->writeValuesOnParameterList(parameters);
// if the preview mesh state is valid and parameters are not changed, we do not need to
// apply again the filter
if (isPreviewMeshStateValid && parameters == prevParams) {
previewMeshState.apply(mesh); // apply the preview state to the mesh
updateRenderingData(mw, mesh);
if (currentGLArea != nullptr)
currentGLArea->updateAllDecorators();
}
else { // we need to apply the filter
applyDynamic();
if (currentGLArea != nullptr)
currentGLArea->updateAllDecorators();
}
}
// not checked - disable preview
else {
noPreviewMeshState.apply(mesh); // re-apply old state of the mesh
updateRenderingData(mw, mesh);
if (currentGLArea != nullptr)
currentGLArea->updateAllDecorators();
}
}
void FilterDockDialog::on_applyPushButton_clicked()
{
ui->parameterFrame->writeValuesOnParameterList(parameters);
if (isPreviewable()) {
if (mesh) {
// first, restore the mesh to the no-preview state
noPreviewMeshState.apply(mesh);
updateRenderingData(mw, mesh);
}
}
if (isPreviewable() && isPreviewMeshStateValid && parameters == prevParams) {
previewMeshState.apply(mesh);
updateRenderingData(mw, mesh);
}
else
emit applyButtonClicked(filter, parameters, false, true);
if (isPreviewable()) {
// save the no-preview state, after the filter was applied
noPreviewMeshState.create(mask, mesh);
}
if (currentGLArea)
currentGLArea->update();
}
void FilterDockDialog::on_helpPushButton_clicked()
{
ui->parameterFrame->toggleHelp();
ui->parameterFrame->updateGeometry();
ui->parameterFrame->adjustSize();
updateGeometry();
}
void FilterDockDialog::on_closePushButton_clicked()
{
close();
}
void FilterDockDialog::on_defaultPushButton_clicked()
{
ui->parameterFrame->resetValues();
}
void FilterDockDialog::applyDynamic()
{
if (ui->previewCheckBox->isChecked()) {
prevParams = parameters;
ui->parameterFrame->writeValuesOnParameterList(parameters);
ui->parameterFrame->writeValuesOnParameterList(prevParams);
// first, restore the mesh to the no-preview state
noPreviewMeshState.apply(mesh);
// then, apply dynamically with the new parameters
mw->executeFilter(filter, parameters, true);
// save the preview state
previewMeshState.create(mask, mesh);
isPreviewMeshStateValid = true;
if (currentGLArea)
currentGLArea->update();
}
}
void FilterDockDialog::changeCurrentMesh(int meshId)
{
if (isPreviewable()) {
noPreviewMeshState.apply(mesh);
mesh = md->getMesh(meshId);
noPreviewMeshState.create(mask, mesh);
applyDynamic();
}
}
bool FilterDockDialog::isPreviewable() const
{
// the actual check whether the filter is previewable or not is made in the consturctor, calling
// the function isFilterPreviewable().
// when a filter is previewable, the previewCheckBox is visible.
return ui->previewCheckBox->isVisible();
}
bool FilterDockDialog::isFilterPreviewable(FilterPlugin* plugin, const QAction* filter)
{
unsigned int mask = plugin->postCondition(filter);
if ((filter == nullptr) || (plugin == nullptr) ||
(plugin->filterArity(filter) != FilterPlugin::SINGLE_MESH))
return false;
if ((mask == MeshModel::MM_UNKNOWN) || (mask == MeshModel::MM_NONE))
return false;
if ((mask & MeshModel::MM_VERTNUMBER) || (mask & MeshModel::MM_FACENUMBER))
return false;
return true;
}
void FilterDockDialog::updateRenderingData(MainWindow* mw, MeshModel* mesh)
{
if (mw != nullptr && mesh != nullptr) {
MultiViewer_Container* mvcont = mw->currentViewContainer();
if (mvcont != nullptr) {
MLSceneGLSharedDataContext* shar = mvcont->sharedDataContext();
if (shar != nullptr) {
shar->meshAttributesUpdated(mesh->id(), true, MLRenderingData::RendAtts(true));
shar->manageBuffers(mesh->id());
}
}
}
}

View File

@ -0,0 +1,89 @@
/****************************************************************************
* VCGLib o o *
* Visual and Computer Graphics Library o o *
* _ O _ *
* Copyright(C) 2004-2021 \/)\/ *
* 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 FILTER_DOCK_DIALOG_H
#define FILTER_DOCK_DIALOG_H
#include <QDockWidget>
#include <common/ml_document/mesh_model_state.h>
#include <common/plugins/interfaces/filter_plugin.h>
class GLArea;
class MainWindow;
namespace Ui {
class FilterDockDialog;
}
class FilterDockDialog : public QDockWidget
{
Q_OBJECT
public:
explicit FilterDockDialog(
const RichParameterList& rpl,
FilterPlugin* plugin,
const QAction* filter,
QWidget* parent = nullptr,
GLArea* glArea = nullptr);
~FilterDockDialog();
signals:
void applyButtonClicked(const QAction*, RichParameterList, bool, bool);
private slots:
void on_previewCheckBox_stateChanged(int state);
void on_applyPushButton_clicked();
void on_helpPushButton_clicked();
void on_closePushButton_clicked();
void on_defaultPushButton_clicked();
// preview slots
void applyDynamic();
void changeCurrentMesh(int meshId);
private:
bool isPreviewable() const;
static bool isFilterPreviewable(FilterPlugin* plugin, const QAction* filter);
static void updateRenderingData(MainWindow* mw, MeshModel* mesh);
Ui::FilterDockDialog* ui;
FilterPlugin* plugin;
const QAction* filter;
RichParameterList parameters;
unsigned int mask;
GLArea* currentGLArea;
// preview
bool isPreviewMeshStateValid;
MeshModelState noPreviewMeshState;
MeshModelState previewMeshState;
RichParameterList prevParams;
MainWindow* mw;
MeshDocument* md;
MeshModel* mesh;
};
#endif // FILTER_DOCK_DIALOG_H

View File

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FilterDockDialog</class>
<widget class="QDockWidget" name="FilterDockDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>539</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Filter Title</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="1">
<widget class="QPushButton" name="closePushButton">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="applyPushButton">
<property name="text">
<string>Apply</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="VerticalScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>382</width>
<height>388</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="RichParameterListFrame" name="parameterFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLabel" name="filterInfoLabel">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Filter Description</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="defaultPushButton">
<property name="text">
<string>Default</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="previewCheckBox">
<property name="text">
<string>Preview</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="helpPushButton">
<property name="text">
<string>Help</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>RichParameterListFrame</class>
<extends>QFrame</extends>
<header>rich_parameter_gui/richparameterlistframe.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>VerticalScrollArea</class>
<extends>QScrollArea</extends>
<header>gui_utils/vertical_scroll_area.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -139,7 +139,7 @@ QTableWidgetItem* MeshLabOptionsDialog::createQTableWidgetItemFromRichParameter(
assert(0);
return nullptr;
}
else if (pd.isOfType<RichPoint3f>()){
else if (pd.isOfType<RichPosition>() || pd.isOfType<RichDirection>()){
vcg::Point3f pp = pd.value().getPoint3f();
QString pst = "P3(" + QString::number(pp.X()) + "," + QString::number(pp.Y()) + "," + QString::number(pp.Z()) + ")";
return new QTableWidgetItem(pst);

View File

@ -53,16 +53,20 @@ SaveMeshAttributesDialog::SaveMeshAttributesDialog(
QFileInfo fi(m->fullName());
this->setWindowTitle("Choose Saving Options for: '"+ fi.baseName() +"'");
// Show the additional parameters only for formats that have some.
if(additionalSaveParametrs.isEmpty())
if(additionalSaveParametrs.isEmpty()) {
ui->saveParBox->hide();
else
}
else {
ui->saveParBox->show();
ui->scrollArea->setMinimumSize(ui->scrollArea->width(), ui->saveParBox->sizeHint().height());
ui->scrollArea->adjustSize();
updateGeometry();
}
//all - none
ui->AllButton->setChecked(true);
//ui->NoneButton->setChecked(true);
if( m->cm.textures.size() == 0 )
{
if( m->cm.textures.size() == 0 ) {
ui->check_iom_wedgtexcoord->setDisabled(true);
ui->check_iom_wedgtexcoord->setChecked(false);
ui->saveTextureCheckBox->setDisabled(true);
@ -71,8 +75,7 @@ SaveMeshAttributesDialog::SaveMeshAttributesDialog(
}
textureNames.reserve(m->cm.textures.size());
for(const std::string& tname : m->cm.textures)
{
for(const std::string& tname : m->cm.textures) {
textureNames.push_back(tname);
QString item(tname.c_str());
ui->listTextureName->addItem(item);

View File

@ -299,15 +299,58 @@
</layout>
</item>
<item>
<widget class="QGroupBox" name="saveParBox">
<property name="title">
<string>Additional Parameters</string>
<widget class="VerticalScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>669</width>
<height>68</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="saveParBox">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Additional Parameters</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QWidget" name="layoutWidget" native="true"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@ -405,6 +448,14 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>VerticalScrollArea</class>
<extends>QScrollArea</extends>
<header>gui_utils/vertical_scroll_area.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>

View File

@ -0,0 +1,45 @@
/****************************************************************************
* VCGLib o o *
* Visual and Computer Graphics Library o o *
* _ O _ *
* Copyright(C) 2004-2021 \/)\/ *
* Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | *
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
#include "vertical_scroll_area.h"
#include <QEvent>
#include <QScrollBar>
#include <QVBoxLayout>
#include "vertical_scroll_area.h"
VerticalScrollArea::VerticalScrollArea(QWidget* parent) : QScrollArea(parent)
{
setWidgetResizable(true);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
}
bool VerticalScrollArea::eventFilter(QObject* o, QEvent* e)
{
// This works because QScrollArea::setWidget installs an eventFilter on the widget
if (o && o == widget() && e->type() == QEvent::Resize)
setMinimumWidth(widget()->minimumSizeHint().width() + verticalScrollBar()->width());
return QScrollArea::eventFilter(o, e);
}

View File

@ -0,0 +1,48 @@
/****************************************************************************
* VCGLib o o *
* Visual and Computer Graphics Library o o *
* _ O _ *
* Copyright(C) 2004-2021 \/)\/ *
* 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 VERTICAL_SCROLL_AREA_H
#define VERTICAL_SCROLL_AREA_H
#include <QScrollArea>
/**
* @brief The VerticalScrollArea class
*
* This class is necessary because Qt does not provide a pure Vertical Scroll Area,
* that behaves as a normal qwidget horizontally.
*
* @see https://forum.qt.io/topic/13374/solved-qscrollarea-vertical-scroll-only
*/
class VerticalScrollArea : public QScrollArea
{
Q_OBJECT
public:
explicit VerticalScrollArea(QWidget* parent = 0);
virtual bool eventFilter(QObject* o, QEvent* e);
private:
QWidget* m_scrollAreaWidgetContents;
};
#endif // VERTICAL_SCROLL_AREA_H

View File

@ -37,11 +37,12 @@ $Log: stdpardialog.cpp,v $
#include "mainwindow.h"
#include "ui_layerDialog.h"
#include "layerDialog.h"
#include "rich_parameter_gui/richparameterlistframe.h"
#include "../common/mlexception.h"
using namespace std;
LayerDialog::LayerDialog(QWidget *parent )
LayerDialog::LayerDialog(QWidget *parent )
: QDockWidget(parent)
{
ui = new Ui::layerDialog();

View File

@ -35,7 +35,7 @@
#include "glarea.h"
#include "layerDialog.h"
#include "ml_std_par_dialog.h"
#include "dialogs/filter_dock_dialog.h"
#include "multiViewer_Container.h"
#include "ml_render_gui.h"
@ -93,15 +93,15 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
// callback function to execute a filter
void executeFilter(const QAction *action, RichParameterList &srcpar, bool isPreview = false);
MainWindow();
~MainWindow();
static bool QCallBack(const int pos, const char * str);
//const QString appName() const {return tr("MeshLab v")+appVer(); }
//const QString appVer() const {return tr("1.3.2"); }
MainWindowSetting mwsettings;
public slots:
// callback function to execute a filter
void executeFilter(const QAction *action, const RichParameterList& srcpar, bool isPreview = false, bool saveOnHistory = false);
signals:
void dispatchCustomSettings(const RichParameterList& rps);
void filterExecuted();
@ -201,7 +201,7 @@ private slots:
void updateMenus();
void updateSubFiltersMenu(const bool createmenuenabled,const bool validmeshdoc);
void updateMenuItems(QMenu* menu,const bool enabled);
void updateStdDialog();
void closeFilterDockDialog();
void enableDocumentSensibleActionsContainer(const bool enable);
void setSplit(QAction *qa);
void setUnsplit();
@ -246,7 +246,6 @@ private:
int longestActionWidthInMenu(QMenu* m,const int longestwidth);
int longestActionWidthInMenu( QMenu* m);
int longestActionWidthInAllMenus();
void createStdPluginWnd(); // this one is
void initGlobalParameters();
void createActions();
void createMenus();
@ -277,7 +276,7 @@ private:
int idGet;
bool verboseCheckingFlag;
MeshlabStdDialog *stddialog;
FilterDockDialog* filterDockDialog;
static QProgressBar *qb;
QMdiArea *mdiarea;

View File

@ -127,7 +127,7 @@ MainWindow::MainWindow():
createToolBars();
createMenus();
gpumeminfo = new vcg::QtThreadSafeMemoryInfo(mwsettings.maxgpumem);
stddialog = 0;
filterDockDialog = nullptr;
setAcceptDrops(true);
mdiarea->setAcceptDrops(true);
setWindowTitle(MeshLabApplication::shortName());

View File

@ -100,41 +100,6 @@ void MainWindow::updateRecentProjActions()
recentProjActs[j]->setVisible(false);
}
// creates the standard plugin window
void MainWindow::createStdPluginWnd()
{
//checks if a MeshlabStdDialog is already open and closes it
if (stddialog!=0)
{
stddialog->close();
delete stddialog;
}
stddialog = new MeshlabStdDialog(this);
stddialog->setAllowedAreas ( Qt::NoDockWidgetArea);
//addDockWidget(Qt::RightDockWidgetArea,stddialog);
//stddialog->setAttribute(Qt::WA_DeleteOnClose,true);
stddialog->setFloating(true);
stddialog->hide();
connect(GLA(),SIGNAL(glareaClosed()),this,SLOT(updateStdDialog()));
connect(GLA(),SIGNAL(glareaClosed()),stddialog,SLOT(closeClick()));
}
// When we switch the current model (and we change the active window)
// we have to close the stddialog.
// this one is called when user switch current window.
void MainWindow::updateStdDialog()
{
if(stddialog!=0){
if(GLA()!=0){
if(stddialog->curModel != meshDoc()->mm()){
stddialog->curgla=0; // invalidate the curgla member that is no more valid.
stddialog->close();
}
}
}
}
void MainWindow::updateCustomSettings()
{
mwsettings.updateGlobalParameterList(currentGlobalParams);
@ -246,8 +211,6 @@ void MainWindow::enableDocumentSensibleActionsContainer(const bool allowed)
editToolBar->setEnabled(allowed);
}
//menu create is not enabled only in case of not valid/existing meshdocument
void MainWindow::updateSubFiltersMenu( const bool createmenuenabled,const bool validmeshdoc )
{
@ -741,8 +704,6 @@ void MainWindow::dropEvent ( QDropEvent * event )
this, "File format not supported",
extension + " file format is not supported by MeshLab.");
}
}
showLayerDlg(layervis || meshDoc()->meshNumber() > 0);
}
@ -911,8 +872,6 @@ void MainWindow::showTooltip(QAction* q)
// It is split in two part
// - startFilter that setup the dialogs and asks for parameters
// - executeFilter callback invoked when the params have been set up.
void MainWindow::startFilter(const QAction* action)
{
if(currentViewContainer() == NULL) return;
@ -920,7 +879,7 @@ void MainWindow::startFilter(const QAction* action)
// In order to avoid that a filter changes something assumed by the current editing tool,
// before actually starting the filter we close the current editing tool (if any).
if (GLA()->getCurrentEditAction() != NULL)
if (GLA()->getCurrentEditAction() != nullptr)
endEdit();
updateMenus();
@ -930,49 +889,62 @@ void MainWindow::startFilter(const QAction* action)
if (action == nullptr)
throw MLException("Invalid filter action value.");
FilterPlugin *iFilter = qobject_cast<FilterPlugin *>(action->parent());
if (meshDoc() == NULL)
if (meshDoc() == nullptr)
return;
//OLD FILTER PHILOSOPHY
if (iFilter != NULL)
{
//if(iFilter->getClass(action) == MeshFilterInterface::MeshCreation)
//{
// qDebug("MeshCreation");
// GLA()->meshDoc->addNewMesh("",iFilter->filterName(action) );
//}
//else
if (!iFilter->isFilterApplicable(action,(*meshDoc()->mm()),missingPreconditions))
{
if (iFilter != nullptr) {
if (!iFilter->isFilterApplicable(action,(*meshDoc()->mm()),missingPreconditions)) {
QString enstr = missingPreconditions.join(",");
QMessageBox::warning(this, tr("PreConditions' Failure"), QString("Warning the filter <font color=red>'" + iFilter->filterName(action) + "'</font> has not been applied.<br>"
"Current mesh does not have <i>" + enstr + "</i>."));
return;
}
if(currentViewContainer())
{
if(currentViewContainer()) {
iFilter->setLog(currentViewContainer()->LogPtr());
currentViewContainer()->LogPtr()->setBookmark();
}
// just to be sure...
createStdPluginWnd();
//checks if a filterDockDialog is already open and closes it
if (filterDockDialog != nullptr) {
filterDockDialog->close();
delete filterDockDialog;
}
// (2) Ask for filter parameters and eventually directly invoke the filter
// showAutoDialog return true if a dialog have been created (and therefore the execution is demanded to the apply event)
// if no dialog is created the filter must be executed immediately
if(! stddialog->showAutoDialog(iFilter, meshDoc()->mm(), (meshDoc()), action, this, GLA()) )
{
RichParameterList dummyParSet;
executeFilter(action, dummyParSet, false);
//Insert the filter to filterHistory
FilterNameParameterValuesPair tmp;
tmp.first = action->text(); tmp.second = dummyParSet;
meshDoc()->filterHistory.append(tmp);
RichParameterList rpl = iFilter->initParameterList(action, *meshDoc());
if (rpl.isEmpty()) {
executeFilter(action, rpl, false, true);
}
else {
filterDockDialog = new FilterDockDialog(rpl, iFilter, action, this, GLA());
filterDockDialog->setAllowedAreas(Qt::NoDockWidgetArea);
addDockWidget(Qt::RightDockWidgetArea, filterDockDialog);
filterDockDialog->setFloating(true);
connect(GLA(), SIGNAL(glareaClosed()), this, SLOT(closeFilterDockDialog()));
connect(
filterDockDialog,
SIGNAL(applyButtonClicked(const QAction*, RichParameterList, bool, bool)),
this,
SLOT(executeFilter(const QAction*, RichParameterList, bool, bool)));
filterDockDialog->show();
}
}
}//void MainWindow::startFilter()
}
// When we switch the current model (and we change the active window)
// we have to close the stddialog.
// this one is called when user switch current window.
void MainWindow::closeFilterDockDialog()
{
if(filterDockDialog != nullptr) {
filterDockDialog->close();
filterDockDialog = nullptr;
}
}
void MainWindow::updateSharedContextDataAfterFilterExecution(int postcondmask,int fclasses,bool& newmeshcreated)
@ -1126,8 +1098,8 @@ from the automatic dialog
from the user defined dialog
*/
void MainWindow::executeFilter(const QAction* action, RichParameterList &params, bool isPreview)
void MainWindow::executeFilter(
const QAction* action, const RichParameterList& params, bool isPreview, bool saveOnHistory)
{
FilterPlugin *iFilter = qobject_cast<FilterPlugin *>(action->parent());
qb->show();
@ -1287,6 +1259,14 @@ void MainWindow::executeFilter(const QAction* action, RichParameterList &params,
updateSharedContextDataAfterFilterExecution(postCondMask,fclasses,newmeshcreated);
meshDoc()->meshDocStateData().clear();
if (saveOnHistory){
//Insert the filter to filterHistory
FilterNameParameterValuesPair tmp;
tmp.first = action->text();
tmp.second = params;
meshDoc()->filterHistory.append(tmp);
}
}
catch (const std::bad_alloc& bdall) {
meshDoc()->setBusy(false);
@ -3146,7 +3126,7 @@ void MainWindow::switchCurrentContainer(QMdiSubWindow * subwin)
{
updateLayerDialog();
updateMenus();
updateStdDialog();
closeFilterDockDialog();
}
}

View File

@ -1,301 +0,0 @@
#include "ml_std_par_dialog.h"
#include "mainwindow.h"
static void updateRenderingData(MainWindow* curmwi, MeshModel* curmodel)
{
if ((curmwi != nullptr) && (curmodel != nullptr)) {
MultiViewer_Container* mvcont = curmwi->currentViewContainer();
if (mvcont != nullptr) {
MLSceneGLSharedDataContext* shar = mvcont->sharedDataContext();
if (shar != nullptr) {
shar->meshAttributesUpdated(curmodel->id(), true, MLRenderingData::RendAtts(true));
shar->manageBuffers(curmodel->id());
}
}
}
}
MeshlabStdDialog::MeshlabStdDialog(QWidget *p) :
QDockWidget(QString("Plugin"), p),
qf(nullptr),
stdParFrame(nullptr),
curAction(nullptr),
previewCB(nullptr),
curmask(MeshModel::MM_UNKNOWN),
curModel(nullptr),
curmfi(nullptr),
curmwi(nullptr)
{
}
/* manages the setup of the standard parameter window, when the execution of a plugin filter is requested */
bool MeshlabStdDialog::showAutoDialog(FilterPlugin *mfi, MeshModel *mm, MeshDocument * mdp, const QAction *action, MainWindow *mwi, QWidget *gla)
{
validcache = false;
curAction = action;
curmfi = mfi;
curmwi = mwi;
prevParSet.clear();
curModel = mm;
curMeshDoc = mdp;
curgla = gla;
curParSet = mfi->initParameterList(action, *mdp);
curmask = mfi->postCondition(action);
if (curParSet.isEmpty() && !isPreviewable()) return false;
createFrame();
loadFrameContent();
if (isPreviewable()) {
meshState.create(curmask, curModel);
connect(stdParFrame, SIGNAL(parameterChanged()), this, SLOT(applyDynamic()));
}
connect(curMeshDoc, SIGNAL(currentMeshChanged(int)), this, SLOT(changeCurrentMesh(int)));
raise();
activateWindow();
return true;
}
void MeshlabStdDialog::changeCurrentMesh(int meshInd)
{
if (isPreviewable())
{
meshState.apply(curModel);
curModel = curMeshDoc->getMesh(meshInd);
meshState.create(curmask, curModel);
applyDynamic();
}
}
bool MeshlabStdDialog::isPreviewable()
{
if ((curAction == NULL) || (curmfi == NULL) || (curmfi->filterArity(curAction) != FilterPlugin::SINGLE_MESH))
return false;
if ((curmask == MeshModel::MM_UNKNOWN) || (curmask == MeshModel::MM_NONE))
return false;
if ((curmask & MeshModel::MM_VERTNUMBER) ||
(curmask & MeshModel::MM_FACENUMBER))
return false;
return true;
}
void MeshlabStdDialog::createFrame()
{
if (qf)
delete qf;
QFrame *newqf = new QFrame(this);
setWidget(newqf);
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
qf = newqf;
}
// update the values of the widgets with the values in the paramlist;
void MeshlabStdDialog::resetValues()
{
curParSet = curmfi->initParameterList(curAction, *curMeshDoc);
assert(qf);
assert(qf->isVisible());
// assert(curParSet.paramList.count() == stdfieldwidgets.count());
stdParFrame->resetValues();
}
void MeshlabStdDialog::loadFrameContent()
{
assert(qf);
qf->hide();
QGridLayout *gridLayout = new QGridLayout(qf);
setWindowTitle(curmfi->filterName(curAction));
QLabel *ql = new QLabel("<i>" + curmfi->filterInfo(curAction) + "</i>", qf);
ql->setTextFormat(Qt::RichText);
ql->setWordWrap(true);
ql->setOpenExternalLinks(true);
gridLayout->addWidget(ql, 0, 0, 1, 2, Qt::AlignTop); // this widgets spans over two columns.
stdParFrame = new RichParameterListFrame(curParSet, this, curgla);
gridLayout->addWidget(stdParFrame, 1, 0, 1, 2);
int buttonRow = 2; // the row where the line of buttons start
QPushButton *helpButton = new QPushButton("Help", qf);
QPushButton *closeButton = new QPushButton("Close", qf);
QPushButton *applyButton = new QPushButton("Apply", qf);
QPushButton *defaultButton = new QPushButton("Default", qf);
applyButton->setFocus();
#ifdef Q_OS_MAC
// Hack needed on mac for correct sizes of button in the bottom of the dialog.
helpButton->setMinimumSize(100, 25);
closeButton->setMinimumSize(100, 25);
applyButton->setMinimumSize(100, 25);
defaultButton->setMinimumSize(100, 25);
#endif
gridLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Minimum, QSizePolicy::Expanding), buttonRow++, 0);
if (isPreviewable()) {
previewCB = new QCheckBox("Preview", qf);
previewCB->setCheckState(Qt::Unchecked);
gridLayout->addWidget(previewCB, buttonRow + 0, 0, Qt::AlignBottom);
connect(previewCB, SIGNAL(toggled(bool)), this, SLOT(togglePreview()));
buttonRow++;
}
gridLayout->addWidget(helpButton, buttonRow + 0, 1, Qt::AlignBottom);
gridLayout->addWidget(defaultButton, buttonRow + 0, 0, Qt::AlignBottom);
gridLayout->addWidget(closeButton, buttonRow + 1, 0, Qt::AlignBottom);
gridLayout->addWidget(applyButton, buttonRow + 1, 1, Qt::AlignBottom);
connect(helpButton, SIGNAL(clicked()), this, SLOT(toggleHelp()));
connect(applyButton, SIGNAL(clicked()), this, SLOT(applyClick()));
connect(closeButton, SIGNAL(clicked()), this, SLOT(closeClick()));
connect(defaultButton, SIGNAL(clicked()), this, SLOT(resetValues()));
qf->showNormal();
qf->adjustSize();
//set the minimum size so it will shrink down to the right size after the help is toggled
showNormal();
}
void MeshlabStdDialog::toggleHelp()
{
stdParFrame->toggleHelp();
qf->updateGeometry();
qf->adjustSize();
this->updateGeometry();
}
void MeshlabStdDialog::applyClick()
{
const QAction *q = curAction;
stdParFrame->writeValuesOnParameterList(curParSet);
// Note that curModel CAN BE NULL (for creation filters on empty docs...)
if (curmask && curModel) {
meshState.apply(curModel);
updateRenderingData(curmwi, curModel);
}
//PreView Caching: if the apply parameters are the same to those used in the preview mode
//we don't need to reapply the filter to the mesh
if ((q != nullptr) && (curMeshDoc != nullptr)) {
FilterNameParameterValuesPair oldpair;
oldpair.first = q->text(); oldpair.second = curParSet;
curMeshDoc->filterHistory.append(oldpair);
}
bool isEqual = (curParSet == prevParSet);
if (curModel && (isEqual) && (validcache)) {
meshCacheState.apply(curModel);
updateRenderingData(curmwi, curModel);
}
else
curmwi->executeFilter(q, curParSet, false);
if (curmask && curModel)
meshState.create(curmask, curModel);
if (this->curgla)
this->curgla->update();
}
void MeshlabStdDialog::applyDynamic()
{
if (!previewCB->isChecked())
return;
const QAction *q = curAction;
stdParFrame->writeValuesOnParameterList(curParSet);
//for cache mechanism
//needed to allocate the required memory space in prevParSet
//it called the operator=(RichParameterSet) function defined in RichParameterSet
prevParSet = curParSet;
stdParFrame->writeValuesOnParameterList(prevParSet);
// Restore the
meshState.apply(curModel);
curmwi->executeFilter(q, curParSet, true);
meshCacheState.create(curmask, curModel);
validcache = true;
if (this->curgla)
this->curgla->update();
}
void MeshlabStdDialog::togglePreview()
{
if (previewCB == NULL)
return;
GLArea* glarea = qobject_cast<GLArea*>(curgla);
if (previewCB->isChecked())
{
stdParFrame->writeValuesOnParameterList(curParSet);
if (!prevParSet.isEmpty() && (validcache) && (curParSet == prevParSet))
{
meshCacheState.apply(curModel);
updateRenderingData(curmwi, curModel);
if (glarea != NULL)
glarea->updateAllDecorators();
}
else
{
applyDynamic();
if (glarea != NULL)
glarea->updateAllDecorators();
}
}
else
{
meshState.apply(curModel);
updateRenderingData(curmwi, curModel);
if (glarea != NULL)
glarea->updateAllDecorators();
}
curgla->update();
}
/* click event for the close button of the standard plugin window */
void MeshlabStdDialog::closeClick()
{
//int mask = 0;//curParSet.getDynamicFloatMask();
if (curmask != MeshModel::MM_UNKNOWN)
{
meshState.apply(curModel);
if (isPreviewable() && (previewCB != NULL) && previewCB->isChecked())
{
updateRenderingData(curmwi, curModel);
}
}
curmask = MeshModel::MM_UNKNOWN;
// Perform the update only if there is Valid GLarea.
if (this->curgla)
{
if ((previewCB != NULL) && (previewCB->isChecked()) && (curmwi != NULL) && (curmwi->GLA() != NULL))
curmwi->GLA()->updateAllPerMeshDecorators();
this->curgla->update();
}
close();
}
// click event for the standard red crossed close button in the upper right widget's corner
void MeshlabStdDialog::closeEvent(QCloseEvent * /*event*/)
{
closeClick();
}
MeshlabStdDialog::~MeshlabStdDialog()
{
delete stdParFrame;
delete previewCB;
}

View File

@ -1,80 +0,0 @@
/****************************************************************************
* MeshLab o o *
* A versatile mesh processing toolbox o o *
* _ O _ *
* Copyright(C) 2005 \/)\/ *
* 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 ML_STD_PAR_DIALOG
#define ML_STD_PAR_DIALOG
#include<QDockWidget>
#include <common/plugins/interfaces/filter_plugin.h>
#include <common/ml_document/mesh_model_state.h>
#include "rich_parameter_gui/richparameterlistframe.h"
class MainWindow;
class MeshlabStdDialog : public QDockWidget
{
Q_OBJECT
public:
MeshlabStdDialog(QWidget *p = NULL);
~MeshlabStdDialog();
void createFrame();
void loadFrameContent();
bool showAutoDialog(FilterPlugin *mfi, MeshModel *mm, MeshDocument * md, const QAction* q, MainWindow *mwi, QWidget *gla=0);
bool isPreviewable();
public slots:
void closeClick();
private slots:
void applyClick();
void resetValues();
void toggleHelp();
void togglePreview();
void applyDynamic();
void changeCurrentMesh(int meshInd);
public:
QFrame *qf;
RichParameterListFrame *stdParFrame;
const QAction *curAction;
MeshModelState meshState;
MeshModelState meshCacheState;
QCheckBox *previewCB;
void closeEvent ( QCloseEvent * event );
uint curmask;
MeshModel *curModel;
MeshDocument * curMeshDoc;
FilterPlugin *curmfi;
MainWindow *curmwi;
QWidget * curgla;
RichParameterList curParSet;
RichParameterList prevParSet;
bool validcache;
};
#endif

View File

@ -1,25 +1,25 @@
/****************************************************************************
* VCGLib o o *
* Visual and Computer Graphics Library o o *
* _ O _ *
* Copyright(C) 2004-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. *
* *
****************************************************************************/
* VCGLib o o *
* Visual and Computer Graphics Library o o *
* _ O _ *
* Copyright(C) 2004-2021 \/)\/ *
* 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 RICHPARAMETERLISTDIALOG_H
#define RICHPARAMETERLISTDIALOG_H

View File

@ -35,12 +35,17 @@
using namespace vcg;
RichParameterListFrame::RichParameterListFrame(QWidget* parent) :
QFrame(parent), isHelpVisible(false), gla(nullptr), hiddenFrame(nullptr)
{
}
RichParameterListFrame::RichParameterListFrame(
const RichParameterList& curParSet,
const RichParameterList& defParSet,
QWidget* p,
QWidget* gla) :
QFrame(p), gla(gla), hiddenFrame(nullptr)
QFrame(p), isHelpVisible(false), gla(gla), hiddenFrame(nullptr)
{
loadFrameContent(curParSet, defParSet);
}
@ -49,7 +54,7 @@ RichParameterListFrame::RichParameterListFrame(
const RichParameterList& curParSet,
QWidget* p,
QWidget* gla) :
QFrame(p), gla(gla)
QFrame(p), isHelpVisible(false), gla(gla), hiddenFrame(nullptr)
{
loadFrameContent(curParSet);
}
@ -59,7 +64,7 @@ RichParameterListFrame::RichParameterListFrame(
const RichParameter& defPar,
QWidget* p,
QWidget* gla) :
QFrame(p), gla(gla)
QFrame(p), isHelpVisible(false), gla(gla), hiddenFrame(nullptr)
{
loadFrameContent(curPar, defPar);
}
@ -68,6 +73,16 @@ RichParameterListFrame::~RichParameterListFrame()
{
}
void RichParameterListFrame::initParams(
const RichParameterList& curParSet,
const RichParameterList& defParSet,
QWidget* gla)
{
if (gla != nullptr)
this->gla = gla;
loadFrameContent(curParSet, defParSet);
}
/**
* @brief RichParameterListFrame::readValues
* From GUI to RichParameterList
@ -90,8 +105,12 @@ void RichParameterListFrame::resetValues()
void RichParameterListFrame::toggleHelp()
{
for(int i = 0; i < helpList.count(); i++)
helpList.at(i)->setVisible(!helpList.at(i)->isVisible()) ;
isHelpVisible = !isHelpVisible;
for(auto& p : stdfieldwidgets) {
p.second->setHelpVisible(isHelpVisible);
}
setMinimumSize(sizeHint());
adjustSize();
updateGeometry();
}
@ -116,16 +135,15 @@ void RichParameterListFrame::toggleAdvancedParameters()
if (hiddenFrame->isVisible()){
hiddenFrame->setVisible(false);
showHiddenFramePushButton->setText("");
showHiddenFramePushButton->setToolTip("Show advanced parameters");
}
else {
hiddenFrame->setVisible(true);
showHiddenFramePushButton->setText("");
}
QFrame* p = dynamic_cast<QFrame*>(parent());
if (p){
p->setMinimumSize(p->sizeHint());
showHiddenFramePushButton->setToolTip("Hide advanced parameters");
}
}
setMinimumSize(sizeHint());
}
void RichParameterListFrame::loadFrameContent(
@ -165,7 +183,6 @@ void RichParameterListFrame::loadFrameContent(
const RichParameter& defrp = defParSet.getParameterByName(fpi->name());
RichParameterWidget* wd = createWidgetFromRichParameter(this, *fpi, defrp);
stdfieldwidgets[fpi->name()] = wd;
helpList.push_back(wd->helpLab);
wd->addWidgetToGridLayout(glay,i++);
}
}
@ -186,19 +203,21 @@ void RichParameterListFrame::loadFrameContent(
const RichParameter& defrp = defParSet.getParameterByName(fpi->name());
RichParameterWidget* wd = createWidgetFromRichParameter(this, *fpi, defrp);
stdfieldwidgets[fpi->name()] = wd;
helpList.push_back(wd->helpLab);
wd->addWidgetToGridLayout(flay,j++);
}
}
//hiddenFrame->setMinimumSize(hiddenFrame->sizeHint());
glay->addWidget(hiddenFrame, i++, 0, 1, 3);
hiddenFrame->setVisible(false);
showHiddenFramePushButton = new QPushButton("", this);
showHiddenFramePushButton->setFlat(true);
showHiddenFramePushButton->setText("");
showHiddenFramePushButton->setToolTip("Show advanced parameters");
glay->addWidget(showHiddenFramePushButton, i++, 0, 1, 3);
connect(showHiddenFramePushButton, SIGNAL(clicked()), this, SLOT(toggleAdvancedParameters()));
}
QSpacerItem* spacer = new QSpacerItem(40, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
glay->addItem(spacer, i++, 0);
setLayout(glay);
}
@ -246,8 +265,11 @@ RichParameterWidget* RichParameterListFrame::createWidgetFromRichParameter(
else if (pd.isOfType<RichMatrix44f>()){
return new Matrix44fWidget(parent, (const RichMatrix44f&)pd, (const RichMatrix44f&)def, reinterpret_cast<RichParameterListFrame*>(parent)->gla);
}
else if (pd.isOfType<RichPoint3f>()){
return new Point3fWidget(parent, (const RichPoint3f&)pd, (const RichPoint3f&)def, reinterpret_cast<RichParameterListFrame*>(parent)->gla);
else if (pd.isOfType<RichPosition>()){
return new PositionWidget(parent, (const RichPosition&)pd, (const RichPosition&)def, reinterpret_cast<RichParameterListFrame*>(parent)->gla);
}
else if (pd.isOfType<RichDirection>()){
return new DirectionWidget(parent, (const RichDirection&)pd, (const RichDirection&)def, reinterpret_cast<RichParameterListFrame*>(parent)->gla);
}
else if (pd.isOfType<RichShotf>()){
return new ShotfWidget(parent, (const RichShotf&)pd, (const RichShotf&)def, reinterpret_cast<RichParameterListFrame*>(parent)->gla);

View File

@ -50,11 +50,14 @@ class RichParameterListFrame : public QFrame
public:
typedef std::map<QString, RichParameterWidget *>::iterator iterator;
RichParameterListFrame(QWidget *parent);
RichParameterListFrame(const RichParameterList& curParSet, const RichParameterList& defParSet, QWidget *p, QWidget *gla=0);
RichParameterListFrame(const RichParameterList& curParSet, QWidget *p, QWidget *gla=0);
RichParameterListFrame(const RichParameter& curPar, const RichParameter& defPar, QWidget *p, QWidget *gla=0);
~RichParameterListFrame();
void initParams(const RichParameterList& curParSet, const RichParameterList& defParSet, QWidget *gla=nullptr);
// The curParSet that is passed must be 'compatible' with the RichParameterSet that have been used to create the frame.
// This function updates the RichParameterSet used to create the frame AND fill also the passed <curParSet>
void writeValuesOnParameterList(RichParameterList &curParSet);
@ -85,7 +88,7 @@ private:
const RichParameter& def);
std::map<QString, RichParameterWidget *> stdfieldwidgets;
QVector<QLabel *> helpList;
bool isHelpVisible;
QWidget *gla; // used for having a link to the glarea that spawned the parameter asking.
QFrame* hiddenFrame;

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +1,41 @@
/****************************************************************************
* MeshLab o o *
* Visual and Computer Graphics Library o o *
* _ O _ *
* Copyright(C) 2004-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. *
* *
****************************************************************************/
/*****************************************************************************
* MeshLab o o *
* Visual and Computer Graphics Library o o *
* _ O _ *
* Copyright(C) 2004-2021 \/)\/ *
* 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 RICHPARAMETERLISTWIDGETS_H
#define RICHPARAMETERLISTWIDGETS_H
#include <QWidget>
#include <QCheckBox>
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QGridLayout>
#include <QLabel>
#include <QCheckBox>
#include <QLineEdit>
#include <QPushButton>
#include <QDoubleSpinBox>
#include <QComboBox>
#include <QSlider>
#include <QWidget>
#include <common/parameters/rich_parameter_list.h>
#include <common/ml_document/cmesh.h>
#include <common/parameters/rich_parameter_list.h>
class RichParameterWidget : public QWidget
{
@ -45,91 +45,97 @@ public:
// this one is called by resetValue to reset the values inside the widgets.
virtual void resetWidgetValue() = 0;
// bring the values from the Qt widgets to the parameter (e.g. from the checkBox to the parameter).
virtual void collectWidgetValue() = 0;
// bring the values from the Qt widgets to the parameter (e.g. from the checkBox to the
// parameter).
virtual void collectWidgetValue() = 0;
virtual void setWidgetValue(const Value& nv) = 0;
virtual ~RichParameterWidget();
virtual void addWidgetToGridLayout(QGridLayout* lay,const int r) = 0;
virtual void addWidgetToGridLayout(QGridLayout* lay, const int r) = 0;
// called when the user press the 'default' button to reset the parameter values to its default.
// It just set the parameter value and then it calls the specialized resetWidgetValue() to update also the widget.
// It just set the parameter value and then it calls the specialized resetWidgetValue() to
// update also the widget.
void resetValue();
void setValue(const Value& v);
void setHelpVisible(bool b);
// update the parameter with the current widget values and return it.
const Value& widgetValue();
const Value& widgetValue();
const RichParameter& richParameter() const;
QString parameterName() const;
QLabel* helpLab;
signals:
void parameterChanged();
protected:
RichParameter* rp;
RichParameter* defp;
QLabel* descriptionLabel;
QLabel* helpLabel;
RichParameter* parameter;
RichParameter* defaultParameter;
};
class BoolWidget : public RichParameterWidget
{
public:
BoolWidget(QWidget* p, const RichBool& rb, const RichBool&rdef);
BoolWidget(QWidget* p, const RichBool& rb, const RichBool& rdef);
~BoolWidget();
void addWidgetToGridLayout(QGridLayout* lay,const int r);
void addWidgetToGridLayout(QGridLayout* lay, const int r);
void collectWidgetValue();
void resetWidgetValue();
void setWidgetValue(const Value& nv);
private:
QCheckBox* cb;
};
class LineEditWidget : public RichParameterWidget
{
Q_OBJECT
Q_OBJECT
protected:
QLabel* lab;
QLineEdit* lned;
QString lastVal;
QString lastVal;
private slots:
void changeChecker();
signals:
void lineEditChanged();
private slots:
void changeChecker();
signals:
void lineEditChanged();
public:
LineEditWidget(QWidget* p, const RichParameter& rpar, const RichParameter&rdef);
LineEditWidget(QWidget* p, const RichParameter& rpar, const RichParameter& rdef);
~LineEditWidget();
void addWidgetToGridLayout(QGridLayout* lay,const int r);
virtual void collectWidgetValue() = 0;
virtual void resetWidgetValue() = 0;
void addWidgetToGridLayout(QGridLayout* lay, const int r);
virtual void collectWidgetValue() = 0;
virtual void resetWidgetValue() = 0;
virtual void setWidgetValue(const Value& nv) = 0;
};
class IntWidget : public LineEditWidget
{
public:
IntWidget(QWidget* p, const RichInt& rpar, const RichInt&rdef);
~IntWidget(){}
IntWidget(QWidget* p, const RichInt& rpar, const RichInt& rdef);
~IntWidget() {}
void collectWidgetValue();
void resetWidgetValue();
void setWidgetValue(const Value& nv);
};
class FloatWidget : public LineEditWidget
class FloatWidget : public LineEditWidget
{
public:
FloatWidget(QWidget* p, const RichFloat& rpar, const RichFloat& rdef);
~FloatWidget(){}
~FloatWidget() {}
void collectWidgetValue();
void resetWidgetValue();
void setWidgetValue(const Value& nv);
};
class StringWidget : public LineEditWidget
class StringWidget : public LineEditWidget
{
public:
StringWidget(QWidget* p, const RichString& rpar, const RichString& rdef);
~StringWidget(){}
~StringWidget() {}
void collectWidgetValue();
void resetWidgetValue();
void setWidgetValue(const Value& nv);
@ -139,17 +145,17 @@ class ColorWidget : public RichParameterWidget
{
Q_OBJECT
public:
ColorWidget(QWidget *p, const RichColor& newColor, const RichColor& rdef);
ColorWidget(QWidget* p, const RichColor& newColor, const RichColor& rdef);
~ColorWidget();
void addWidgetToGridLayout(QGridLayout* lay,const int r);
void addWidgetToGridLayout(QGridLayout* lay, const int r);
void collectWidgetValue();
void resetWidgetValue();
void setWidgetValue(const Value& nv);
void initWidgetValue();
private:
void updateColorInfo(const ColorValue& newColor);
void updateColorInfo(const ColorValue& newColor);
private slots:
void pickColor();
signals:
@ -160,16 +166,15 @@ protected:
private:
QPushButton* colorButton;
QLabel* colorLabel;
QLabel* descLabel;
QColor pickcol;
QLabel* colorLabel;
QColor pickcol;
};
class AbsPercWidget : public RichParameterWidget
{
Q_OBJECT
public:
AbsPercWidget(QWidget *p, const RichAbsPerc& rabs, const RichAbsPerc& rdef);
AbsPercWidget(QWidget* p, const RichAbsPerc& rabs, const RichAbsPerc& rdef);
~AbsPercWidget();
void addWidgetToGridLayout(QGridLayout* lay, const int r);
@ -178,7 +183,7 @@ public:
void setWidgetValue(const Value& nv);
private:
void setValue(float val, float minV, float maxV);
void setValue(float val, float minV, float maxV);
public slots:
@ -188,44 +193,70 @@ signals:
void dialogParamChanged();
protected:
QDoubleSpinBox *absSB;
QDoubleSpinBox *percSB;
QLabel* fieldDesc;
float m_min;
float m_max;
QGridLayout* vlay;
QDoubleSpinBox* absSB;
QDoubleSpinBox* percSB;
float m_min;
float m_max;
QGridLayout* vlay;
};
class Point3fWidget : public RichParameterWidget
class PositionWidget : public RichParameterWidget
{
Q_OBJECT
public:
Point3fWidget(QWidget *p, const RichPoint3f& rpf, const RichPoint3f& rdef, QWidget *gla);
~Point3fWidget();
QString paramName;
PositionWidget(QWidget* p, const RichPosition& rpf, const RichPosition& rdef, QWidget* gla);
~PositionWidget();
QString paramName;
vcg::Point3f getValue();
void addWidgetToGridLayout(QGridLayout* lay,const int r);
void addWidgetToGridLayout(QGridLayout* lay, const int r);
void collectWidgetValue();
void resetWidgetValue();
void setWidgetValue(const Value& nv);
public slots:
void getPoint();
void setValue(QString name, Point3m val);
void setShotValue(QString name, Shotm val);
signals:
void askViewDir(QString);
public slots:
void getPoint();
void setValue(QString name, Point3m val);
void setShotValue(QString name, Shotm val);
signals:
void askViewPos(QString);
void askSurfacePos(QString);
void askCameraPos(QString);
void askTrackballPos(QString);
protected:
QLineEdit * coordSB[3];
QComboBox *getPoint3Combo;
QPushButton *getPoint3Button;
QLabel* descLab;
QLineEdit* coordSB[3];
QComboBox* getPoint3Combo;
QPushButton* getPoint3Button;
QHBoxLayout* vlay;
};
class DirectionWidget : public RichParameterWidget
{
Q_OBJECT
public:
DirectionWidget(QWidget* p, const RichDirection& rpf, const RichDirection& rdef, QWidget* gla);
~DirectionWidget();
QString paramName;
vcg::Point3f getValue();
void addWidgetToGridLayout(QGridLayout* lay, const int r);
void collectWidgetValue();
void resetWidgetValue();
void setWidgetValue(const Value& nv);
public slots:
void getPoint();
void setValue(QString name, Point3m val);
void setShotValue(QString name, Shotm val);
signals:
void askViewDir(QString);
void askCameraDir(QString);
protected:
QLineEdit* coordSB[3];
QComboBox* getPoint3Combo;
QPushButton* getPoint3Button;
QHBoxLayout* vlay;
};
@ -234,12 +265,16 @@ class Matrix44fWidget : public RichParameterWidget
Q_OBJECT
public:
Matrix44fWidget(QWidget *p, const RichMatrix44f& rpf, const RichMatrix44f& rdef, QWidget *gla_curr);
Matrix44fWidget(
QWidget* p,
const RichMatrix44f& rpf,
const RichMatrix44f& rdef,
QWidget* gla_curr);
~Matrix44fWidget();
QString paramName;
QString paramName;
Matrix44m getValue();
void addWidgetToGridLayout(QGridLayout* lay,const int r);
void addWidgetToGridLayout(QGridLayout* lay, const int r);
void collectWidgetValue();
void resetWidgetValue();
void setWidgetValue(const Value& nv);
@ -253,13 +288,12 @@ signals:
void askMeshMatrix(QString);
protected:
QLineEdit * coordSB[16];
QPushButton *getPoint3Button;
QLabel* descLab;
QLineEdit* coordSB[16];
QPushButton* getPoint3Button;
QGridLayout* lay44;
QVBoxLayout* vlay;
Matrix44m m;
bool valid;
Matrix44m m;
bool valid;
};
class ShotfWidget : public RichParameterWidget
@ -267,30 +301,29 @@ class ShotfWidget : public RichParameterWidget
Q_OBJECT
public:
ShotfWidget(QWidget *p, const RichShotf& rpf, const RichShotf& rdef, QWidget *gla);
ShotfWidget(QWidget* p, const RichShotf& rpf, const RichShotf& rdef, QWidget* gla);
~ShotfWidget();
QString paramName;
Shotm getValue();
Shotm getValue();
void addWidgetToGridLayout(QGridLayout* lay,const int r);
void addWidgetToGridLayout(QGridLayout* lay, const int r);
void collectWidgetValue();
void resetWidgetValue();
void setWidgetValue(const Value& nv);
public slots:
void getShot();
void setShotValue(QString name, Shotm val);
void getShot();
void setShotValue(QString name, Shotm val);
signals:
void askRasterShot(QString);
void askMeshShot(QString);
void askViewerShot(QString);
protected:
Shotm curShot;
QLineEdit * shotLE;
QPushButton *getShotButton;
QComboBox *getShotCombo;
QLabel* descLab;
Shotm curShot;
QLineEdit* shotLE;
QPushButton* getShotButton;
QComboBox* getShotCombo;
QHBoxLayout* hlay;
};
@ -299,13 +332,13 @@ class DynamicFloatWidget : public RichParameterWidget
Q_OBJECT
public:
DynamicFloatWidget(QWidget *p, const RichDynamicFloat& rdf, const RichDynamicFloat& rdef);
DynamicFloatWidget(QWidget* p, const RichDynamicFloat& rdf, const RichDynamicFloat& rdef);
~DynamicFloatWidget();
float getValue();
void setValue(float val, float minV, float maxV);
void addWidgetToGridLayout(QGridLayout* lay,const int r);
void addWidgetToGridLayout(QGridLayout* lay, const int r);
void collectWidgetValue();
void resetWidgetValue();
void setWidgetValue(const Value& nv);
@ -316,38 +349,38 @@ public slots:
void setValue(float newValue);
signals:
//void valueChanged(int mask);
// void valueChanged(int mask);
void dialogParamChanged();
protected:
QLineEdit *valueLE;
QSlider *valueSlider;
QLabel* fieldDesc;
float minVal;
float maxVal;
QLineEdit* valueLE;
QSlider* valueSlider;
float minVal;
float maxVal;
QHBoxLayout* hlay;
private :
private:
float intToFloat(int val);
int floatToInt(float val);
int floatToInt(float val);
};
class ComboWidget : public RichParameterWidget
{
Q_OBJECT
protected:
QComboBox *enumCombo;
QLabel *enumLabel;
QComboBox* enumCombo;
public:
ComboWidget(QWidget *p, const RichParameter& rpar, const RichParameter& rdef);
ComboWidget(QWidget* p, const RichParameter& rpar, const RichParameter& rdef);
~ComboWidget();
void Init(QWidget *p,int newEnum, QStringList values);
void addWidgetToGridLayout(QGridLayout* lay,const int r);
virtual void collectWidgetValue() = 0;
virtual void resetWidgetValue() = 0;
void init(QWidget* p, int newEnum, QStringList values);
void addWidgetToGridLayout(QGridLayout* lay, const int r);
virtual void collectWidgetValue() = 0;
virtual void resetWidgetValue() = 0;
virtual void setWidgetValue(const Value& nv) = 0;
int getIndex();
void setIndex(int newEnum);
int getIndex();
void setIndex(int newEnum);
signals:
void dialogParamChanged();
@ -358,24 +391,25 @@ class EnumWidget : public ComboWidget
Q_OBJECT
public:
EnumWidget(QWidget *p, const RichEnum& rpar, const RichEnum& rdef);
~EnumWidget(){};
EnumWidget(QWidget* p, const RichEnum& rpar, const RichEnum& rdef);
~EnumWidget() {};
void collectWidgetValue();
void resetWidgetValue();
void setWidgetValue(const Value& nv);
//returns the number of items in the list
// returns the number of items in the list
int getSize();
};
class MeshWidget : public ComboWidget
{
private:
const MeshDocument *md;
const MeshDocument* md;
public:
MeshWidget(QWidget *p, const RichMesh& defaultMesh, const RichMesh& rdef);
~MeshWidget(){};
MeshWidget(QWidget* p, const RichMesh& defaultMesh, const RichMesh& rdef);
~MeshWidget() {};
void collectWidgetValue();
void resetWidgetValue();
@ -390,10 +424,10 @@ protected:
IOFileWidget(QWidget* p, const RichParameter& rpar, const RichParameter& rdef);
~IOFileWidget();
void updateFileName(const StringValue& file);
void updateFileName(const StringValue& file);
public:
void addWidgetToGridLayout(QGridLayout* lay,const int r);
void addWidgetToGridLayout(QGridLayout* lay, const int r);
void collectWidgetValue();
void resetWidgetValue();
void setWidgetValue(const Value& nv);
@ -404,11 +438,9 @@ protected slots:
signals:
void dialogParamChanged();
protected:
QLineEdit* filename;
QLineEdit* filename;
QPushButton* browse;
QLabel* descLab;
QHBoxLayout* hlay;
};
@ -421,14 +453,13 @@ public:
protected slots:
void selectFile();
};
class OpenFileWidget : public IOFileWidget
{
Q_OBJECT
public:
OpenFileWidget(QWidget *p, const RichOpenFile& rdf, const RichOpenFile& rdef);
OpenFileWidget(QWidget* p, const RichOpenFile& rdf, const RichOpenFile& rdef);
~OpenFileWidget();
/*void collectWidgetValue();

View File

@ -135,7 +135,7 @@ RichParameterList AmbientOcclusionPlugin::initParameterList(const QAction *actio
" - 1 means that all the light cames from the specified cone of directions <br>"
" - other values mix the two set of lighting directions "));
parlst.addParam(RichInt ("reqViews",AMBOCC_DEFAULT_NUM_VIEWS,"Requested views", "Number of different views uniformly placed around the mesh. More views means better accuracy at the cost of increased calculation time"));
parlst.addParam(RichPoint3f("coneDir",Point3m(0,1,0),"Lighting Direction", "Number of different views placed around the mesh. More views means better accuracy at the cost of increased calculation time"));
parlst.addParam(RichDirection("coneDir",Point3m(0,1,0),"Lighting Direction", "Number of different views placed around the mesh. More views means better accuracy at the cost of increased calculation time"));
parlst.addParam(RichFloat("coneAngle",30,"Cone amplitude", "Number of different views uniformly placed around the mesh. More views means better accuracy at the cost of increased calculation time"));
parlst.addParam(RichBool("useGPU",AMBOCC_USEGPU_BY_DEFAULT,"Use GPU acceleration","Only works for per-vertex AO. In order to use GPU-Mode, your hardware must support FBOs, FP32 Textures and Shaders. Normally increases the performance by a factor of 4x-5x"));
//parlst.addParam(RichBool("useVBO",AMBOCC_USEVBO_BY_DEFAULT,"Use VBO if supported","By using VBO, Meshlab loads all the vertex structure in the VRam, greatly increasing rendering speed (for both CPU and GPU mode). Disable it if problem occurs"));

View File

@ -112,8 +112,8 @@ RichParameterList FilterCameraPlugin::initParameterList(const QAction *action, c
rotCenter.push_back("custom point");
parlst.addParam(RichEnum("rotCenter", 0, rotCenter, tr("Center of rotation:"), tr("Choose a method")));
parlst.addParam(RichDynamicFloat("angle",0,-360,360,"Rotation Angle","Angle of rotation (in <b>degree</b>). If snapping is enabled this value is rounded according to the snap value"));
parlst.addParam(RichPoint3f("customAxis",Point3m(0,0,0),"Custom axis","This rotation axis is used only if the 'custom axis' option is chosen."));
parlst.addParam(RichPoint3f("customCenter",Point3m(0,0,0),"Custom center","This rotation center is used only if the 'custom point' option is chosen."));
parlst.addParam(RichDirection("customAxis",Point3m(0,0,0),"Custom axis","This rotation axis is used only if the 'custom axis' option is chosen."));
parlst.addParam(RichPosition("customCenter",Point3m(0,0,0),"Custom center","This rotation center is used only if the 'custom point' option is chosen."));
parlst.addParam(RichBool ("toallRaster", false, "Apply to all active Raster layers", "Apply the same scaling to all the active Raster layers: it is taken into account only if 'Raster Camera' is selected"));
parlst.addParam(RichBool ("toall", false, "Apply to all active Raster and visible Mesh layers", "Apply the same scaling to all the layers, including any visible 3D layer"));
}
@ -129,7 +129,7 @@ RichParameterList FilterCameraPlugin::initParameterList(const QAction *action, c
scaleCenter.push_back("camera viewpoint");
scaleCenter.push_back("custom point");
parlst.addParam(RichEnum("scaleCenter", 0, scaleCenter, tr("Center of scaling:"), tr("Choose a method")));
parlst.addParam(RichPoint3f("customCenter",Point3m(0,0,0),"Custom center","This scaling center is used only if the 'custom point' option is chosen."));
parlst.addParam(RichPosition("customCenter",Point3m(0,0,0),"Custom center","This scaling center is used only if the 'custom point' option is chosen."));
parlst.addParam(RichFloat("scale", 1.0, "Scale factor", "The scale factor that has to be applied to the camera"));
parlst.addParam(RichBool ("toallRaster", false, "Apply to all active Raster layers", "Apply the same scaling to all the active Raster layers: it is taken into account only if 'Raster Camera' is selected"));
parlst.addParam(RichBool ("toall", false, "Apply to all active Raster and visible Mesh layers", "Apply the same scaling to all the layers, including any visible 3D layer"));

View File

@ -281,7 +281,7 @@ RichParameterList FilterColorProc::initParameterList(const QAction *a, const Mes
par.addParam(RichColor("color1", color1, "Color 1:", "Sets the first color to mix with Perlin Noise function."));
par.addParam(RichColor("color2", color2, "Color 2:", "Sets the second color to mix with Perlin Noise function."));
par.addParam(RichDynamicFloat("freq", 10.0f, 0.1f, 100.0f,"Frequency:","Frequency of the Perlin Noise function, expressed as multiples of mesh bbox (frequency 10 means a noise period of bbox diagonal / 10). High frequencies produces many small splashes of colours, while low frequencies produces few big splashes."));
par.addParam(RichPoint3f("offset", Point3f(0.0f, 0.0f, 0.0f), "Offset", "This values is the XYZ frequency offset of the Noise function (offset 1 means 1 period shift)."));
par.addParam(RichPosition("offset", Point3f(0.0f, 0.0f, 0.0f), "Offset", "This values is the XYZ frequency offset of the Noise function (offset 1 means 1 period shift)."));
par.addParam(RichBool("onSelected", false, "Only on selection", "If checked, only affects selected vertices"));
break;
}

View File

@ -105,7 +105,7 @@ RichParameterList FilterDirt::initParameterList(const QAction* filter, const Mes
switch(ID(filter)){
case FP_DIRT:{
par.addParam(RichPoint3f("dust_dir", Point3m(0, 1, 0), "Direction", "Direction of the dust source"));
par.addParam(RichDirection("dust_dir", Point3m(0, 1, 0), "Direction", "Direction of the dust source"));
par.addParam(RichInt("nparticles", 3, "max particles x face", "Max Number of Dust Particles to Generate Per Face"));
par.addParam(RichFloat("slippiness", 1.0f, "s", "The surface slippines(large s means less sticky)"));
par.addParam(RichFloat("adhesion", 0.2f, "k", "Factor to model the general adhesion"));
@ -114,8 +114,8 @@ RichParameterList FilterDirt::initParameterList(const QAction* filter, const Mes
break;
}
case FP_CLOUD_MOVEMENT:{
par.addParam(RichPoint3f("gravity_dir", Point3m(0, -1, 0), "g", "Direction of gravity"));
par.addParam(RichPoint3f("force_dir", Point3m(0, 0, 0), "force", "Direction of the force acting on the points cloud"));
par.addParam(RichDirection("gravity_dir", Point3m(0, -1, 0), "g", "Direction of gravity"));
par.addParam(RichDirection("force_dir", Point3m(0, 0, 0), "force", "Direction of the force acting on the points cloud"));
par.addParam(RichInt("steps", 1, "s", "Simulation Steps"));
par.addParam(RichDynamicFloat("adhesion", 1.0f, 0.0f, 1.0f, "adhesion", "Factor to model the general adhesion."));
par.addParam(RichFloat("velocity", 0, "v", "Initial velocity of the particle"));

View File

@ -238,7 +238,7 @@ RichParameterList FilterGeodesic::initParameterList(const QAction *action, const
switch(ID(action))
{
case FP_QUALITY_POINT_GEODESIC :
parlst.addParam(RichPoint3f("startPoint",m.cm.bbox.min,"Starting point","The starting point from which geodesic distance has to be computed. If it is not a surface vertex, the closest vertex to the specified point is used as starting seed point."));
parlst.addParam(RichPosition("startPoint",m.cm.bbox.min,"Starting point","The starting point from which geodesic distance has to be computed. If it is not a surface vertex, the closest vertex to the specified point is used as starting seed point."));
parlst.addParam(RichAbsPerc("maxDistance",m.cm.bbox.Diag(),0,m.cm.bbox.Diag()*2,"Max Distance","If not zero it indicates a cut off value to be used during geodesic distance computation."));
break;
case FP_QUALITY_SELECTED_GEODESIC :

View File

@ -259,7 +259,7 @@ RichParameterList FilterIONXSPlugin::nxsParameters() const
params.addParam(RichInt("skiplevels", 0, "Skip levels",
"Decimation skipped for n levels. Use for meshes with large textures "
"and very few vertices."));
params.addParam(RichPoint3f("origin", Point3m(0,0,0), "Origin", "new origin for the model"));
params.addParam(RichPosition("origin", Point3m(0,0,0), "Origin", "new origin for the model"));
params.addParam(RichBool("center", false, "Center", "Set origin in the bounding box center", true));
params.addParam(RichBool("pow_2_textures", false, "Pow 2 textures", "Create textures to be power of 2", true));
params.addParam(RichBool("deepzoom", false, "Deepzoom",

View File

@ -534,8 +534,8 @@ RichParameterList ExtraMeshFilterPlugin::initParameterList(const QAction * actio
rotCenter.push_back("custom point");
parlst.addParam(RichEnum("rotCenter", 0, rotCenter, tr("Center of rotation:"), tr("Choose a method")));
parlst.addParam(RichDynamicFloat("angle",0,-360,360,"Rotation Angle","Angle of rotation (in <b>degree</b>). If snapping is enabled this value is rounded according to the snap value"));
parlst.addParam(RichPoint3f("customAxis",Point3f(0,0,0),"Custom axis","This rotation axis is used only if the 'custom axis' option is chosen."));
parlst.addParam(RichPoint3f("customCenter",Point3f(0,0,0),"Custom center","This rotation center is used only if the 'custom point' option is chosen."));
parlst.addParam(RichDirection("customAxis",Point3f(0,0,0),"Custom axis","This rotation axis is used only if the 'custom axis' option is chosen."));
parlst.addParam(RichPosition("customCenter",Point3f(0,0,0),"Custom center","This rotation center is used only if the 'custom point' option is chosen."));
parlst.addParam(RichBool("snapFlag", false, "Snap angle", "If selected, before starting the filter will remove any unreferenced vertex (for which curvature values are not defined)"));
parlst.addParam(RichFloat("snapAngle",30,"Snapping Value","This value is used to snap the rotation angle (i.e. if the snapping value is 30, 227 becomes 210)."));
parlst.addParam(RichBool ("Freeze",true,"Freeze Matrix","The transformation is explicitly applied, and the vertex coordinates are actually changed"));
@ -561,7 +561,7 @@ RichParameterList ExtraMeshFilterPlugin::initParameterList(const QAction * actio
parlst.addParam(RichDynamicFloat("axisX",0,-5.0*bb.Diag(),5.0*bb.Diag(),"X Axis","when using [XYZ translation], amount of translation along the X axis (in model units)"));
parlst.addParam(RichDynamicFloat("axisY",0,-5.0*bb.Diag(),5.0*bb.Diag(),"Y Axis","when using [XYZ translation], amount of translation along the Y axis (in model units)"));
parlst.addParam(RichDynamicFloat("axisZ",0,-5.0*bb.Diag(),5.0*bb.Diag(),"Z Axis","when using [XYZ translation], amount of translation along the Z axis (in model units)"));
parlst.addParam(RichPoint3f("newOrigin", Point3f(0, 0, 0), "New Origin:", "when using [Set new Origin], this is the location of the new Origin."));
parlst.addParam(RichPosition("newOrigin", Point3f(0, 0, 0), "New Origin:", "when using [Set new Origin], this is the location of the new Origin."));
parlst.addParam(RichBool ("Freeze",true,"Freeze Matrix","The transformation is explicitly applied, and the vertex coordinates are actually changed"));
parlst.addParam(RichBool ("allLayers",false,"Apply to all visible Layers","If selected the filter will be applied to all visible mesh layers"));
}
@ -578,7 +578,7 @@ RichParameterList ExtraMeshFilterPlugin::initParameterList(const QAction * actio
scaleCenter.push_back("barycenter");
scaleCenter.push_back("custom point");
parlst.addParam(RichEnum("scaleCenter", 0, scaleCenter, tr("Center of scaling:"), tr("Choose a method")));
parlst.addParam(RichPoint3f("customCenter",Point3f(0,0,0),"Custom center","This scaling center is used only if the 'custom point' option is chosen."));
parlst.addParam(RichPosition("customCenter",Point3f(0,0,0),"Custom center","This scaling center is used only if the 'custom point' option is chosen."));
parlst.addParam(RichBool("unitFlag",false,"Scale to Unit bbox","If selected, the object is scaled to a box whose sides are at most 1 unit length"));
parlst.addParam(RichBool ("Freeze",true,"Freeze Matrix","The transformation is explicitly applied, and the vertex coordinates are actually changed"));
parlst.addParam(RichBool ("allLayers",false,"Apply to all visible Layers","If selected the filter will be applied to all visible mesh layers"));
@ -599,7 +599,7 @@ RichParameterList ExtraMeshFilterPlugin::initParameterList(const QAction * actio
parlst.addParam(RichInt ("K",(int)10,"Neighbour num","The number of neighbors used to estimate normals."));
parlst.addParam(RichInt ("smoothIter",0,"Smooth Iteration","The number of smoothing iteration done on the p used to estimate and propagate normals."));
parlst.addParam(RichBool("flipFlag",false,"Flip normals w.r.t. viewpoint","If the 'viewpoint' (i.e. scanner position) is known, it can be used to disambiguate normals orientation, so that all the normals will be oriented in the same direction."));
parlst.addParam(RichPoint3f("viewPos",m.cm.shot.Extrinsics.Tra(),"Viewpoint Pos.","The viewpoint position can be set by hand (i.e. getting the current viewpoint) or it can be retrieved from mesh camera, if the viewpoint position is stored there."));
parlst.addParam(RichDirection("viewPos",m.cm.shot.Extrinsics.Tra(),"Viewpoint Pos.","The viewpoint position can be set by hand (i.e. getting the current viewpoint) or it can be retrieved from mesh camera, if the viewpoint position is stored there."));
break;
case FP_NORMAL_SMOOTH_POINTCLOUD:
@ -625,7 +625,7 @@ RichParameterList ExtraMeshFilterPlugin::initParameterList(const QAction * actio
{
QStringList axis = QStringList() <<"X Axis"<<"Y Axis"<<"Z Axis"<<"Custom Axis";
parlst.addParam(RichEnum ("planeAxis", 0, axis, tr("Plane perpendicular to"), tr("The Slicing plane will be done perpendicular to the axis")));
parlst.addParam(RichPoint3f("customAxis",Point3f(0,1,0),"Custom axis","Specify a custom axis, this is only valid if the above parameter is set to Custom"));
parlst.addParam(RichDirection("customAxis",Point3f(0,1,0),"Custom axis","Specify a custom axis, this is only valid if the above parameter is set to Custom"));
parlst.addParam(RichFloat ("planeOffset", 0.0, "Cross plane offset", "Specify an offset of the cross-plane. The offset corresponds to the distance from the point specified in the plane reference parameter. By default (Cross plane offset == 0)"));
parlst.addParam(RichEnum ("relativeTo",2,QStringList()<<"Bounding box center"<<"Bounding box min"<<"Origin","plane reference","Specify the reference from which the planes are shifted"));
parlst.addParam(RichBool("createSectionSurface",false,"Create also section surface","If selected, in addition to a layer with the section polyline, it will be created also a layer with a triangulated version of the section polyline. This only works if the section polyline is closed"));

View File

@ -182,7 +182,7 @@ RichParameterList QhullPlugin::initParameterList(const QAction *action,const Mes
false,
"Use ViewPoint from Mesh Camera",
"Uses the ViewPoint from the camera associated to the current mesh\n if there is no camera, an error occurs"));
parlst.addParam(RichPoint3f("viewpoint",
parlst.addParam(RichDirection("viewpoint",
Point3f(0.0f, 0.0f, 0.0f),
"ViewPoint",
"if UseCamera is true, this value is ignored"));

View File

@ -210,7 +210,7 @@ RichParameterList SelectionFilterPlugin::initParameterList(const QAction *action
{
parlst.addParam(RichDynamicFloat("anglelimit", 75.0f, 0.0f, 180.0f, "angle threshold (deg)", "faces with normal at higher angle w.r.t. the view direction are selected"));
parlst.addParam(RichBool ("usecamera", false, "Use ViewPoint from Mesh Camera", "Uses the ViewPoint from the camera associated to the current mesh\n if there is no camera, an error occurs"));
parlst.addParam(RichPoint3f("viewpoint", Point3f(0.0f, 0.0f, 0.0f), "ViewPoint", "if UseCamera is true, this value is ignored"));
parlst.addParam(RichDirection("viewpoint", Point3f(0.0f, 0.0f, 0.0f), "ViewPoint", "if UseCamera is true, this value is ignored"));
} break;
case FP_SELECT_UGLY :

View File

@ -359,7 +359,7 @@ RichParameterList FilterUnsharp::initParameterList(const QAction *action, const
break;
case FP_DEPTH_SMOOTH:
parlst.addParam(RichInt ("stepSmoothNum", (int) 3,"Smoothing steps", "The number of times that the whole algorithm (normal smoothing + vertex fitting) is iterated."));
parlst.addParam(RichPoint3f ("viewPoint", Point3f(0,0,0),"Viewpoint", "The position of the view point that is used to get the constraint direction."));
parlst.addParam(RichDirection ("viewPoint", Point3f(0,0,0),"Viewpoint", "The position of the view point that is used to get the constraint direction."));
parlst.addParam(RichAbsPerc ("delta", 1.0, 0, 1.0, "Strength", "How much smoothing is applied: 0 (no smooth) e 1 (full smooth)"));
parlst.addParam(RichBool ("Selected",md.mm()->cm.sfn>0,"Affect only selection","If checked the filter is performed only on the selected area"));
break;
@ -369,7 +369,7 @@ RichParameterList FilterUnsharp::initParameterList(const QAction *action, const
tr("Step:"),
tr("The purpose of this filter is to <b>constrain</b> any smoothing algorithm to moving vertices only along a give line of sight.<br> First you should store current vertex position, than after applying one of the many smoothing algorithms you should re start this filter and blend the original positions with the smoothed results.<br>"
"Given a view point <i>vp</i> , the smoothed vertex position <i>vs</i> and the original position <i>v</i>, The new vertex position is computed as the projection of <i>vs</i> on the line connecting <i>v</i> and <i>vp</i>.")));
parlst.addParam(RichPoint3f ("viewPoint", Point3f(0,0,0),"Viewpoint", "The position of the view point that is used to get the constraint direction."));
parlst.addParam(RichDirection ("viewPoint", Point3f(0,0,0),"Viewpoint", "The position of the view point that is used to get the constraint direction."));
parlst.addParam(RichBool ("Selected",md.mm()->cm.sfn>0,"Affect only selected faces","If checked the filter is performed only on the selected faces"));
break;
case FP_TAUBIN_SMOOTH:
@ -397,8 +397,8 @@ RichParameterList FilterUnsharp::initParameterList(const QAction *action, const
}
break;
case FP_SCALAR_HARMONIC_FIELD:
parlst.addParam(RichPoint3f("point1", md.mm()->cm.bbox.min, "Point 1", "A vertex on the mesh that represent one harmonic field boundary condition."));
parlst.addParam(RichPoint3f("point2", md.mm()->cm.bbox.max, "Point 2", "A vertex on the mesh that represent one harmonic field boundary condition."));
parlst.addParam(RichPosition("point1", md.mm()->cm.bbox.min, "Point 1", "A vertex on the mesh that represent one harmonic field boundary condition."));
parlst.addParam(RichPosition("point2", md.mm()->cm.bbox.max, "Point 2", "A vertex on the mesh that represent one harmonic field boundary condition."));
parlst.addParam(RichDynamicFloat("value1", 0.0f, 0.0f, 1.0f, "value for the 1st point", "Harmonic field value for the vertex."));
parlst.addParam(RichDynamicFloat("value2", 1.0f, 0.0f, 1.0f, "value for the 2nd point", "Harmonic field value for the vertex."));
parlst.addParam(RichBool("colorize", true, "Colorize", "Colorize the mesh to provide an indication of the obtained harmonic field."));

View File

@ -189,9 +189,9 @@ RichParameterList U3DIOPlugin::initSaveParameter(const QString &, const MeshMode
m.cm.bbox.Center(),m.cm.bbox.Diag());
Point3m pos = _param._campar->_obj_pos;
Point3m dir(0.0f,0.0f,-1.0f * _param._campar->_obj_bbox_diag);
par.addParam(RichPoint3f("position_val",dir, "Camera Position",
par.addParam(RichPosition("position_val",dir, "Camera Position",
"The position in which the camera is set. The default value is derived by the 3d mesh's bounding box."));
par.addParam(RichPoint3f("target_val",pos, "Camera target point",
par.addParam(RichDirection("target_val",pos, "Camera target point",
"The point towards the camera is seeing. The default value is derived by the 3d mesh's bounding box."));
par.addParam(RichFloat("fov_val",60.0f,
"Camera's FOV Angle 0..180","Camera's FOV Angle. The values' range is between 0-180 degree. The default value is 60."));