Revamped logging iterface, changed function names in automatic parameters, better selection handling

This commit is contained in:
Paolo Cignoni cignoni 2007-03-27 12:20:18 +00:00
parent bbc432a319
commit e65b7b8704
14 changed files with 210 additions and 101 deletions

View File

@ -1,11 +1,30 @@
25/3/2007
x check selezione automatico, init numero selected in quadric.
23/3/2007
o bug dialogo troppo piccolo per quando ci sono troppi parametri
o meccanismo piu' furbo per memorizzare i param da una volta alla successiva
x meno polimofrismo nelle fun di passaggio di parametri
x icona processing
x bug open su command line su mac. FATTO
o merge gllogstream e logstream
15/3/2007
x corrected bug simplification mac
x More parameter in pasodoble
x Added first step for layer management
x Changed log stream
1/2/2007
o bounding box non viene aggiornato dopo varie operazioni..
x Added Select border face
x added more parameters to hole filling dialog
19/01/2007
o Numero vertici facce selezionate deve essere mostrato
o refine distrugge la selezione
x Numero vertici facce selezionate deve essere mostrato
x refine se distrugge la selezione
o refine e colore dda controllare.
o mesh senza facce pianta??
o unify vertex deve smarcare i border e obbligarli a rifare??
@ -141,7 +160,7 @@ x progress bar load obj do not work // DONE 6/7
x bug normali subdiv. non vengono ricalcolate // DONE 18/6
o bug border. non viene MAI ricalcolato
x open/save recorded nella history // DONE 18/6
o cursor icon selection
x cursor icon selection Done v100
15/6/06
o merge to a single surface
@ -168,7 +187,7 @@ o install cleaning.
25/5/06
x clustering nel filtro in input epoch // DONE 6/6
o install doc e attempt. // DONE 26/5
x install doc e attempt. // DONE 26/5
o Last Dir
x selections plus/minus
x Esc Pianta // DONE 26/5
@ -178,7 +197,7 @@ x save 3ds pianta // DONE 18/6
o Uniformare i nomi degli slot nel main window
o Measuring Tool
o risistemare Recent file stuff...(bug in apertura cambio dir?)
x risistemare Recent file stuff...(bug in apertura cambio dir?)
o snapshot con fbo invece che con il rendering nel backbuffer.
o Ambient Occlusion
x Clustering dialog diag percentage <1 non va // DONE 7/6
@ -212,6 +231,6 @@ o Ripulire glarea
- Log
- Paint
X ScriptDialog // DONE 15/6
o Generic dialog option
x Generic dialog option DONE 1.000
o Clustering con bound e selezione.
o Dialogo shaders che galleggia un po' troppo
x Dialogo shaders che galleggia un po' troppo

View File

@ -23,6 +23,9 @@
/****************************************************************************
History
$Log$
Revision 1.14 2007/03/27 12:20:15 cignoni
Revamped logging iterface, changed function names in automatic parameters, better selection handling
Revision 1.13 2007/03/03 02:03:25 cignoni
Reformatted lower bar, added number of selected faces. Updated about dialog
@ -49,7 +52,9 @@ Fixed starting position
****************************************************************************/
#include <qfont.h>
#include <QFont>
#include <QGLWidget>
#include <stdio.h>
#include "GLLogStream.h"
@ -64,7 +69,8 @@ void GLLogStream::print(QStringList &l)
l << (*li).second.c_str();
}
void GLLogStream::Log(int Level, const char * f, ... )
void GLLogStream::Logf(int Level, const char * f, ... )
{
char buf[4096];
va_list marker;
@ -72,8 +78,7 @@ void GLLogStream::Log(int Level, const char * f, ... )
vsprintf(buf,f,marker);
va_end( marker );
S.push_back(make_pair<int,string>(Level,buf));
Log(Level,buf);
}
void GLLogStream::Save(int Level, const char * filename )

View File

@ -24,6 +24,9 @@
/****************************************************************************
History
$Log$
Revision 1.6 2007/03/27 12:20:09 cignoni
Revamped logging iterface, changed function names in automatic parameters, better selection handling
Revision 1.5 2006/05/25 09:46:37 cignoni
missing std and and all the other gcc detected syntax errors
@ -75,8 +78,12 @@ public:
void glDraw(QGLWidget *qgl, int Level, int nlines,float vSpacing,QFont font);
void Save(int Level, const char *filename);
void Clear() {S.clear();}
void Log(int Level, const char * f, ... );
void Logf(int Level, const char * f, ... );
void Log(int Level, const char * buf )
{
S.push_back(std::make_pair<int,std::string>(Level,buf));
}
private:
std::list<std::pair<int,std::string> > S;
};

View File

@ -23,6 +23,9 @@
/****************************************************************************
History
$Log$
Revision 1.7 2007/03/27 12:20:14 cignoni
Revamped logging iterface, changed function names in automatic parameters, better selection handling
Revision 1.6 2007/02/28 00:02:11 cignoni
Added missing virtual destructors
@ -45,15 +48,14 @@ Initial Draft release; still to be adapted to our needs.
#ifndef LOGSTREAM_H
#define LOGSTREAM_H
#include <QGLWidget>
#include <QFont>
class QGLWidget;
class LogStream
{
public:
typedef enum {Error=0, Warning=1, Info=2, Debug=3, Direct=4, OnlyFileLog=5, OnlyConsole=6} Level ;
virtual void Log(int Level, const char * f, ... ) = 0;
virtual void Logf(int Level, const char * f, ... ) = 0;
virtual void glDraw(QGLWidget *qgl, int Level, int nlines,float vSpacing,QFont font) = 0;
virtual ~LogStream(){}
};

View File

@ -23,6 +23,9 @@
/****************************************************************************
History
$Log$
Revision 1.7 2007/03/27 12:20:13 cignoni
Revamped logging iterface, changed function names in automatic parameters, better selection handling
Revision 1.6 2007/02/09 09:09:39 pirosu
Added ToolTip support for standard parameters
@ -164,28 +167,7 @@ public:
this->clear();
}
void addField(char *name, char* desc, bool val)
{
addField(name,desc,val,(char *)NULL);
}
void addField(char *name, char* desc, float val)
{
addField(name,desc,val,(char *)NULL);
}
void addField(char *name, char* desc, float val, float minv, float maxv)
{
addField(name,desc,val,minv,maxv,(char *)NULL);
}
void addField(char *name, char* desc, int val)
{
addField(name,desc,val,(char *)NULL);
}
void addField(char *name, char* desc, char *val)
{
addField(name,desc,val,(char *)NULL);
}
void addField(char *name, char* desc, bool val,char *ttex)
void addFieldBool(char *name, char* desc, bool val,char *ttex=0)
{
MESHLAB_STDFIELD std;
@ -197,7 +179,8 @@ public:
v.push_back(std);
}
void addField(char *name, char* desc, float val,char *ttex)
void addFieldFloat(char *name, char* desc, float val,char *ttex=0)
{
MESHLAB_STDFIELD std;
@ -209,7 +192,8 @@ public:
v.push_back(std);
}
void addField(char *name, char* desc, float val, float minv, float maxv,char *ttex)
void addFieldAbsPerc(char *name, char* desc, float val, float minv, float maxv,char *ttex=0)
{
MESHLAB_STDFIELD std;
@ -223,7 +207,8 @@ public:
v.push_back(std);
}
void addField(char *name, char* desc, int val,char *ttex)
void addFieldInt(char *name, char* desc, int val,char *ttex=0)
{
MESHLAB_STDFIELD std;
@ -235,7 +220,8 @@ public:
v.push_back(std);
}
void addField(char *name, char* desc, char *val,char *ttex)
void addFieldString(char *name, char* desc, char *val,char *ttex=0)
{
MESHLAB_STDFIELD std;

View File

@ -24,6 +24,9 @@
History
$Log$
Revision 1.120 2007/03/27 12:20:17 cignoni
Revamped logging iterface, changed function names in automatic parameters, better selection handling
Revision 1.119 2007/03/26 08:24:10 zifnab1974
When a user minimizes the window using a shortcut that uses modifiers (alt, ctrl, shift), the state of the button remained "pressed" after the window was reraised. Added a hideevent which resets the button state.
@ -238,11 +241,11 @@ void GLArea::pasteTile()
ss.counter++;
if (ss.counter>999)
ss.counter=0;
log.Log(GLLogStream::Info,"Snapshot saved to %s",outfile.toLocal8Bit().constData());
log.Logf(GLLogStream::Info,"Snapshot saved to %s",outfile.toLocal8Bit().constData());
}
else
{
log.Log(GLLogStream::Error,"Error saving %s",outfile.toLocal8Bit().constData());
log.Logf(GLLogStream::Error,"Error saving %s",outfile.toLocal8Bit().constData());
}
takeSnapTile=false;

View File

@ -23,6 +23,9 @@
/****************************************************************************
History
$Log$
Revision 1.55 2007/03/27 12:20:16 cignoni
Revamped logging iterface, changed function names in automatic parameters, better selection handling
Revision 1.54 2007/02/28 00:02:12 cignoni
Added missing virtual destructors
@ -64,6 +67,7 @@ added Filter History Dialogs
#include <QtCore>
#include <QAction>
#include "filterparameter.h"
#include "GLLogStream.h"
@ -75,7 +79,6 @@ class QMouseEvent;
class MeshModel;
class RenderMode;
class GLArea;
class GLLogStream;
class PluginInfo
{
@ -177,6 +180,20 @@ public:
protected:
QList <QAction *> actionList;
QList <FilterType> typeList;
void Log(int Level, const char * f, ... )
{
if(log)
{
char buf[4096];
va_list marker;
va_start( marker, f );
vsprintf(buf,f,marker);
va_end( marker );
log->Log(Level,buf);
}
}
private:
GLLogStream *log;
};

View File

@ -23,6 +23,9 @@
/****************************************************************************
History
$Log$
Revision 1.6 2007/03/27 12:20:09 cignoni
Revamped logging iterface, changed function names in automatic parameters, better selection handling
Revision 1.5 2006/11/08 01:04:48 cignoni
First version with http communications
@ -38,6 +41,7 @@ Added copyright info
****************************************************************************/
#include <QApplication>
#include <QMessageBox>
#include "mainwindow.h"
int main(int argc, char *argv[])
@ -48,9 +52,13 @@ int main(int argc, char *argv[])
MainWindow window;
window.showMaximized();
// This filter is installed to intercept the open events sent directly by the Operative System.
FileOpenEater *filterObj=new FileOpenEater();
filterObj->mainWindow=&window;
app.installEventFilter(filterObj);
app.processEvents();
if(argc>1) window.open(argv[1]);
else window.open();
else if(filterObj->noEvent) window.open();
return app.exec();
}

View File

@ -23,6 +23,9 @@
/****************************************************************************
History
$Log$
Revision 1.82 2007/03/27 12:20:16 cignoni
Revamped logging iterface, changed function names in automatic parameters, better selection handling
Revision 1.81 2007/03/05 12:23:01 cignoni
v.1.0.0 string
@ -132,8 +135,6 @@ class QHttp;
class MeshlabStdDialog;
class MeshlabStdDialogFrame;
class MainWindow : public QMainWindow,MainWindowInterface
{
Q_OBJECT
@ -151,7 +152,6 @@ public:
public slots:
void open(QString fileName=QString());
private slots:
@ -340,4 +340,31 @@ private:
QList<QAction *> TotalDecoratorsList;
////////////////////////////////////////////////////
};
class FileOpenEater : public QObject
{
Q_OBJECT
public:
FileOpenEater() {noEvent=true;}
MainWindow *mainWindow;
bool noEvent;
protected:
bool eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::FileOpen) {
noEvent=false;
QFileOpenEvent *fileEvent = static_cast<QFileOpenEvent*>(event);
mainWindow->open(fileEvent->file());
// QMessageBox::information(0,"Meshlab",fileEvent->file());
return true;
} else {
// standard event processing
return QObject::eventFilter(obj, event);
}
}
};
#endif

View File

@ -24,6 +24,9 @@
History
$Log$
Revision 1.74 2007/03/27 12:20:16 cignoni
Revamped logging iterface, changed function names in automatic parameters, better selection handling
Revision 1.73 2007/03/20 16:22:34 cignoni
Big small change in accessing mesh interface. First step toward layers
@ -123,6 +126,8 @@ Added short key lastFilter
#include <QToolBar>
#include <QProgressBar>
#include <QHttp>
#include <QFileOpenEvent>
#include "meshmodel.h"
#include "interfaces.h"
@ -170,7 +175,6 @@ MainWindow::MainWindow()
//qb->reset();
}
// creates the standard plugin window
void MainWindow::createStdPluginWnd()
{
@ -178,7 +182,7 @@ void MainWindow::createStdPluginWnd()
stddialog->setAllowedAreas ( Qt::NoDockWidgetArea );
//addDockWidget(Qt::RightDockWidgetArea,stddialog);
stddialog->setFloating(true);
stddialog->move(0,120);
//stddialog->move(0,120);
}

View File

@ -24,6 +24,9 @@
History
$Log$
Revision 1.125 2007/03/27 12:20:17 cignoni
Revamped logging iterface, changed function names in automatic parameters, better selection handling
Revision 1.124 2007/03/26 08:25:09 zifnab1974
added eol at the end of the files
@ -287,7 +290,7 @@ void MainWindow::runFilterScript()
int req=iFilter->getRequirements(action);
GLA()->mm->updateDataMask(req);
iFilter->applyFilter( action, *(GLA()->mm), (*ii).second, QCallBack );
GLA()->log.Log(GLLogStream::Info,"Re-Applied filter %s",qPrintable((*ii).first));
GLA()->log.Logf(GLLogStream::Info,"Re-Applied filter %s",qPrintable((*ii).first));
}
}
@ -323,7 +326,9 @@ void MainWindow::executeFilter(QAction *action,FilterParameter *par)
// (1) Ask for filter requirements (eg a filter can need topology, border flags etc)
// and statisfy them
int req=iFilter->getRequirements(action);
GLA()->mm->updateDataMask(req);
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
GLA()->mm->updateDataMask(req);
qApp->restoreOverrideCursor();
// (2) Ask for filter parameters (e.g. user defined threshold that could require a widget)
@ -340,15 +345,18 @@ void MainWindow::executeFilter(QAction *action,FilterParameter *par)
qb->show();
iFilter->setLog(&(GLA()->log));
// (4) Apply the Filter
GLA()->mm->busy=true;
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
GLA()->mm->busy=true;
ret=iFilter->applyFilter(action, *(GLA()->mm), *par, QCallBack);
GLA()->mm->busy=false;
qApp->restoreOverrideCursor();
// (5) Apply post filter actions (e.g. recompute non updated stuff if needed)
if(ret)
{
GLA()->log.Log(GLLogStream::Info,"Applied filter %s",qPrintable(action->text()));
GLA()->log.Logf(GLLogStream::Info,"Applied filter %s",qPrintable(action->text()));
GLA()->setWindowModified(true);
GLA()->setLastAppliedFilter(action);
lastFilterAct->setText(QString("Apply filter ") + action->text());
@ -391,7 +399,7 @@ void MainWindow::endEditMode()
MeshEditInterface *iEdit = qobject_cast<MeshEditInterface *>(action->parent());
GLA()->setEdit(iEdit,action);
iEdit->StartEdit(action,*(GLA()->mm),GLA());
GLA()->log.Log(GLLogStream::Info,"Started Mode %s",qPrintable (action->text()));
GLA()->log.Logf(GLLogStream::Info,"Started Mode %s",qPrintable (action->text()));
GLA()->setSelectionRendering(true);
}
updateMenus();
@ -412,7 +420,7 @@ void MainWindow::applyEditMode()
GLA()->setLastAppliedEdit(action);
iEdit->StartEdit(action,*(GLA()->mm),GLA());
GLA()->log.Log(GLLogStream::Info,"Started Mode %s",qPrintable (action->text()));
GLA()->log.Logf(GLLogStream::Info,"Started Mode %s",qPrintable (action->text()));
GLA()->setSelectionRendering(true);
updateMenus();
}
@ -427,18 +435,18 @@ void MainWindow::applyRenderMode()
if(action->text() == tr("None"))
{
GLA()->log.Log(GLLogStream::Info,"No Shader");
GLA()->log.Logf(GLLogStream::Info,"No Shader");
GLA()->setRenderer(0,0); //vertex and fragment programs not supported
} else {
if(iRenderTemp->isSupported())
{
GLA()->setRenderer(iRenderTemp,action);
GLA()->log.Log(GLLogStream::Info,"%s",qPrintable(action->text())); // Prints out action name
GLA()->log.Logf(GLLogStream::Info,"%s",qPrintable(action->text())); // Prints out action name
}
else
{
GLA()->setRenderer(0,0); //vertex and fragment programs not supported
GLA()->log.Log(GLLogStream::Warning,"Shader not supported!");
GLA()->log.Logf(GLLogStream::Warning,"Shader not supported!");
}
}
}
@ -450,7 +458,7 @@ void MainWindow::applyColorMode()
MeshFilterInterface *iColorTemp = qobject_cast<MeshFilterInterface *>(action->parent());
iColorTemp->setLog(&(GLA()->log));
//iColorTemp->Compute(action,*(GLA()->mm ),GLA()->getCurrentRenderMode(), GLA());
GLA()->log.Log(GLLogStream::Info,"Applied colorize %s",action->text().toLocal8Bit().constData());
GLA()->log.Logf(GLLogStream::Info,"Applied colorize %s",action->text().toLocal8Bit().constData());
updateMenus();
}
@ -462,20 +470,20 @@ void MainWindow::applyDecorateMode()
if(GLA()->iDecoratorsList==0){
GLA()->iDecoratorsList= new list<pair<QAction *,MeshDecorateInterface *> >;
GLA()->iDecoratorsList->push_back(make_pair(action,iDecorateTemp));
GLA()->log.Log(GLLogStream::Info,"Enable Decorate mode %s",action->text().toLocal8Bit().constData());
GLA()->log.Logf(GLLogStream::Info,"Enable Decorate mode %s",action->text().toLocal8Bit().constData());
}else{
bool found=false;
pair<QAction *,MeshDecorateInterface *> p;
foreach(p,*GLA()->iDecoratorsList){
if(iDecorateTemp==p.second && p.first->text()==action->text()){
GLA()->iDecoratorsList->remove(p);
GLA()->log.Log(0,"Disabled Decorate mode %s",action->text().toLocal8Bit().constData());
GLA()->log.Logf(0,"Disabled Decorate mode %s",action->text().toLocal8Bit().constData());
found=true;
}
}
if(!found){
GLA()->iDecoratorsList->push_back(make_pair(action,iDecorateTemp));
GLA()->log.Log(GLLogStream::Info,"Enable Decorate mode %s",action->text().toLocal8Bit().constData());
GLA()->log.Logf(GLLogStream::Info,"Enable Decorate mode %s",action->text().toLocal8Bit().constData());
}
}
}
@ -489,6 +497,7 @@ bool MainWindow::QCallBack(const int pos, const char * str)
qb->setValue(pos);
// qb->update();
MainWindow::globalStatusBar()->update();
qApp->processEvents();
//qb->repaint();
//if(qb==0) return true;
//qb->setWindowTitle (str);

View File

@ -68,7 +68,6 @@ DEFINES += GLEW_STATIC
INCLUDEPATH += . ../../../sf ../../../code/lib/glew/include
CONFIG += stl
#win32:LIBS += ../../../code/lib/glew/lib/glew32.lib
win32-g++{
#LIBS += glew32
#LIBPATH += ../../../code/lib/glew/lib/
@ -80,4 +79,8 @@ CONFIG(debug, debug|release) {
win32-g++:release:DEFINES -= NDEBUG
}
macx{
message( "We are on a mac: build universal binaries" )
#CONFIG += ppc
}

View File

@ -22,6 +22,9 @@
/****************************************************************************
History
$Log$
Revision 1.93 2007/03/27 12:20:18 cignoni
Revamped logging iterface, changed function names in automatic parameters, better selection handling
Revision 1.92 2007/03/20 16:23:10 cignoni
Big small change in accessing mesh interface. First step toward layers
@ -321,7 +324,7 @@ const QString ExtraMeshFilterPlugin::Info(QAction *action)
case FP_REMOVE_FACES_BY_EDGE : return tr("Remove from the mesh all triangles whose have an edge with lenght greater or equal than a threshold");
case FP_LAPLACIAN_SMOOTH : return tr("Laplacian smooth of the mesh: for each vertex it calculates the average position with nearest vertex");
case FP_HC_LAPLACIAN_SMOOTH : return tr("HC Laplacian Smoothing, extended version of Laplacian Smoothing, based on the paper of Vollmer, Mencl, and Müller");
case FP_TWO_STEP_SMOOTH : return tr("Two Step Smoothing, Normal Smoothing and vertex fitting smoothing, based on the paper of ...");
case FP_TWO_STEP_SMOOTH : return tr("Two Step Smoothing, a feature preserving/enhancing fairing filter. It is based on a Normal Smoothing and vertex fitting smoothing, based on the paper of ...");
case FP_CLUSTERING : return tr("Collapse vertices by creating a three dimensional grid enveloping the mesh and discretizes them based on the cells of this grid");
case FP_QUADRIC_SIMPLIFICATION: return tr("Simplify a mesh using a Quadric based Edge Collapse Strategy, better than clustering but slower");
case FP_QUADRIC_TEXCOORD_SIMPLIFICATION:return tr("Simplify a textured mesh using a Quadric based Edge Collapse Strategy, better than clustering but slower");
@ -384,23 +387,23 @@ bool ExtraMeshFilterPlugin::getStdFields(QAction *action, MeshModel &m, StdParLi
switch(ID(action))
{
case FP_QUADRIC_SIMPLIFICATION:
parlst.addField("TargetFaceNum","Target number of faces",(int)(m.cm().fn/2));
parlst.addField("QualityThr","Quality threshold",lastq_QualityThr,"Quality threshold for penalizing bad shaped faces.\nThe value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5 penalize faces with quality < 0.5, proportionally to their shape\n");
parlst.addField("PreserveBoundary","Preserve Boundary of the mesh",lastq_PreserveBoundary,"The simplification process tries not to destroy mesh boundaries");
parlst.addField("PreserveNormal","Preserve Normal",lastq_PreserveNormal,"Try to avoid face flipping effects and try to preserve the original orientation of the surface");
parlst.addField("OptimalPlacement","Optimal position of simplified vertices",lastq_OptimalPlacement,"Each collapsed vertex is placed in the position minimizing the quadric error.\n It can fail (creating bad spikes) in case of very flat areas. \nIf disabled edges are collapsed onto one of the two original vertices. ");
parlst.addField("Selected","Simplify only selected faces",lastq_Selected,"The simplification is applied only to the selected set of faces.\n Take care of the target number of faces!");
parlst.addFieldInt ("TargetFaceNum","Target number of faces", (m.cm().sfn>0) ? m.cm().sfn/2 : m.cm().fn/2);
parlst.addFieldFloat("QualityThr","Quality threshold",lastq_QualityThr,"Quality threshold for penalizing bad shaped faces.\nThe value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5 penalize faces with quality < 0.5, proportionally to their shape\n");
parlst.addFieldBool ("PreserveBoundary","Preserve Boundary of the mesh",lastq_PreserveBoundary,"The simplification process tries not to destroy mesh boundaries");
parlst.addFieldBool ("PreserveNormal","Preserve Normal",lastq_PreserveNormal,"Try to avoid face flipping effects and try to preserve the original orientation of the surface");
parlst.addFieldBool ("OptimalPlacement","Optimal position of simplified vertices",lastq_OptimalPlacement,"Each collapsed vertex is placed in the position minimizing the quadric error.\n It can fail (creating bad spikes) in case of very flat areas. \nIf disabled edges are collapsed onto one of the two original vertices. ");
parlst.addFieldBool ("Selected","Simplify only selected faces",m.cm().sfn>0,"The simplification is applied only to the selected set of faces.\n Take care of the target number of faces!");
break;
case FP_QUADRIC_TEXCOORD_SIMPLIFICATION:
parlst.addField("TargetFaceNum","Target number of faces",(int)(m.cm().fn/2));
parlst.addField("QualityThr","Quality threshold",lastqtex_QualityThr,"Quality threshold for penalizing bad shaped faces");
parlst.addField("Extratcoordw","Texture discontinuity extra weight",lastqtex_extratw,"Additional weight for each extra Texture Coordinates for every (selected) vertex");
parlst.addFieldInt ("TargetFaceNum","Target number of faces",(int)(m.cm().fn/2));
parlst.addFieldFloat("QualityThr","Quality threshold",lastqtex_QualityThr,"Quality threshold for penalizing bad shaped faces");
parlst.addFieldFloat("Extratcoordw","Texture discontinuity extra weight",lastqtex_extratw,"Additional weight for each extra Texture Coordinates for every (selected) vertex");
break;
case FP_CLOSE_HOLES:
parlst.addField("MaxHoleSize","Max size to be closed ",(int)30,"The size is expressed as number of edges composing the hole boundary");
parlst.addField("Selected","Close holes with selected faces",false);
parlst.addField("NewFaceSelected","Select the newly created faces",true);
parlst.addField("SelfIntersection","Prevent creation of selfIntersecting faces",true);
parlst.addFieldInt ("MaxHoleSize","Max size to be closed ",(int)30,"The size is expressed as number of edges composing the hole boundary");
parlst.addFieldBool("Selected","Close holes with selected faces",m.cm().sfn>0);
parlst.addFieldBool("NewFaceSelected","Select the newly created faces",true);
parlst.addFieldBool("SelfIntersection","Prevent creation of selfIntersecting faces",true);
break;
case FP_LOOP_SS:
case FP_BUTTERFLY_SS:
@ -408,9 +411,16 @@ bool ExtraMeshFilterPlugin::getStdFields(QAction *action, MeshModel &m, StdParLi
case FP_REMOVE_FACES_BY_EDGE:
case FP_CLUSTERING:
maxVal = m.cm().bbox.Diag();
parlst.addField("Threshold","Threshold",maxVal*0.01,0,maxVal);
parlst.addField("Selected","Affect only selected faces",false);
parlst.addFieldAbsPerc("Threshold","Threshold",maxVal*0.01,0,maxVal);
parlst.addFieldBool ("Selected","Affect only selected faces",m.cm().sfn>0);
break;
case FP_TWO_STEP_SMOOTH:
parlst.addFieldInt ("stepSmoothNum","Smoothing steps", (int) 3, "");
parlst.addFieldFloat("normalThr","Feature Angle Threshold (deg)", (float) 60, "Specify a threshold angle for features that you want to be preserved.\nFeatures forming angles LARGER than the specified threshold will be preserved.");
parlst.addFieldInt ("stepNormalNum","Normal Smoothing steps", (int) 20, "");
parlst.addFieldBool ("Selected","Affect only selected faces",m.cm().sfn>0);
break;
default:
return false;
}
@ -429,6 +439,7 @@ bool ExtraMeshFilterPlugin::getStdParameters(QAction *action, QWidget *parent, M
case FP_MIDPOINT :
case FP_REMOVE_FACES_BY_EDGE:
case FP_CLUSTERING:
case FP_TWO_STEP_SMOOTH:
return true;
}
@ -457,7 +468,6 @@ bool ExtraMeshFilterPlugin::getParameters(QAction *action, QWidget *parent, Mesh
case FP_INVERT_FACES:
case FP_HC_LAPLACIAN_SMOOTH:
case FP_LAPLACIAN_SMOOTH:
case FP_TWO_STEP_SMOOTH:
case FP_REMOVE_NON_MANIFOLD:
case FP_NORMAL_EXTRAPOLATION:
return true; // no parameters
@ -504,21 +514,20 @@ bool ExtraMeshFilterPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPar
if(filter->text() == ST(FP_REMOVE_FACES_BY_AREA) )
{
int nullFaces=tri::Clean<CMeshO>::RemoveFaceOutOfRangeArea(m.cm(),0);
if (log) log->Log(GLLogStream::Info, "Removed %d null faces", nullFaces);
Log(GLLogStream::Info, "Removed %d null faces", nullFaces);
m.clearDataMask(MeshModel::MM_FACETOPO | MeshModel::MM_BORDERFLAG);
}
if(filter->text() == ST(FP_REMOVE_UNREFERENCED_VERTEX) )
{
int delvert=tri::Clean<CMeshO>::RemoveUnreferencedVertex(m.cm());
if (log) log->Log(GLLogStream::Info, "Removed %d unreferenced vertices",delvert);
Log(GLLogStream::Info, "Removed %d unreferenced vertices",delvert);
}
if(filter->text() == ST(FP_REMOVE_DUPLICATED_VERTEX) )
{
int delvert=tri::Clean<CMeshO>::RemoveDuplicateVertex(m.cm());
if (log)
log->Log(GLLogStream::Info, "Removed %d duplicated vertices", delvert);
Log(GLLogStream::Info, "Removed %d duplicated vertices", delvert);
if (delvert != 0)
vcg::tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFace(m.cm());
}
@ -526,9 +535,9 @@ bool ExtraMeshFilterPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPar
if(filter->text() == ST(FP_REMOVE_NON_MANIFOLD) )
{
int nonManif=tri::Clean<CMeshO>::RemoveNonManifoldFace(m.cm());
if (log)
if(nonManif) log->Log(GLLogStream::Info, "Removed %d Non Manifold Faces", nonManif);
else log->Log(GLLogStream::Info, "Mesh is two-manifold. Nothing done.", nonManif);
if(nonManif) Log(GLLogStream::Info, "Removed %d Non Manifold Faces", nonManif);
else Log(GLLogStream::Info, "Mesh is two-manifold. Nothing done.", nonManif);
}
if(filter->text() == ST(FP_REORIENT) )
@ -541,9 +550,11 @@ bool ExtraMeshFilterPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPar
if(filter->text() == ST(FP_LAPLACIAN_SMOOTH))
{
tri::UpdateSelection<CMeshO>::ClearVertex(m.cm());
size_t cnt=tri::UpdateSelection<CMeshO>::VertexFromFaceStrict(m.cm());
if(cnt>0) LaplacianSmooth(m.cm(),1,true);
else LaplacianSmooth(m.cm(),1,false);
Log(GLLogStream::Info, "Smoothed %d vertices", cnt>0 ? cnt : m.cm().vn);
tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFace(m.cm());
}
@ -557,9 +568,14 @@ bool ExtraMeshFilterPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPar
if(filter->text() == ST(FP_TWO_STEP_SMOOTH))
{
//size_t cnt=tri::UpdateSelection<CMeshO>::VertexFromFaceStrict(m.cm);
int stepSmoothNum = par.getInt("stepSmoothNum");
float normalThr = cos(math::ToRad(par.getFloat("normalThr")));
int stepNormalNum = par.getInt("stepNormalNum");
//size_t cnt=tri::UpdateSelection<CMeshO>::VertexFromFaceStrict(m.cm());
tri::UpdateNormals<CMeshO>::PerFaceNormalized(m.cm());
PasoDobleSmoothFast(m.cm(), 2, .1, 5);
PasoDobleSmoothFast(m.cm(), stepSmoothNum, normalThr, stepNormalNum);
tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFace(m.cm());
}
@ -585,10 +601,9 @@ bool ExtraMeshFilterPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPar
if (filter->text() == ST(FP_TRANSFORM) ) {
Matrix44f matrix= par.getMatrix44("Transform");
if (log) {
log->Log(GLLogStream::Info,
Log(GLLogStream::Info,
transformDialog->getLog().toAscii().data());
}
vcg::tri::UpdatePosition<CMeshO>::Matrix(m.cm(), matrix);
vcg::tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFace(m.cm());
vcg::tri::UpdateBounding<CMeshO>::Box(m.cm());
@ -604,9 +619,9 @@ bool ExtraMeshFilterPlugin::applyFilter(QAction *filter, MeshModel &m, FilterPar
lastq_OptimalPlacement = par.getBool("OptimalPlacement");
lastq_Selected = par.getBool("Selected");
QuadricSimplification(m.cm(),TargetFaceNum,lastq_QualityThr, lastq_PreserveBoundary,lastq_PreserveNormal, lastq_OptimalPlacement,lastq_Selected, cb);
QuadricSimplification(m.cm(),TargetFaceNum,lastq_QualityThr, lastq_PreserveBoundary,lastq_PreserveNormal, lastq_OptimalPlacement,lastq_Selected, cb);
tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFace(m.cm());
tri::UpdateBounding<CMeshO>::Box(m.cm());
tri::UpdateBounding<CMeshO>::Box(m.cm());
}

View File

@ -22,6 +22,9 @@
/****************************************************************************
History
$Log$
Revision 1.8 2007/03/27 12:20:18 cignoni
Revamped logging iterface, changed function names in automatic parameters, better selection handling
Revision 1.7 2007/03/20 16:23:10 cignoni
Big small change in accessing mesh interface. First step toward layers
@ -101,8 +104,8 @@ void QuadricSimplification(CMeshO &m,int TargetFaceNum, float QualityThr,
TD.Start(QZero);
MyTriEdgeCollapse::SetDefaultParams();
MyTriEdgeCollapse::SetHint(MyTriEdgeCollapse::HNHasVFTopology);
MyTriEdgeCollapse::SetHint(MyTriEdgeCollapse::HNHasBorderFlag);
//MyTriEdgeCollapse::SetHint(MyTriEdgeCollapse::HNHasVFTopology);
//MyTriEdgeCollapse::SetHint(MyTriEdgeCollapse::HNHasBorderFlag);
MyTriEdgeCollapse::Params().QualityThr=QualityThr;
@ -124,7 +127,8 @@ void QuadricSimplification(CMeshO &m,int TargetFaceNum, float QualityThr,
if(PreserveBoundary && !Selected)
MyTriEdgeCollapse::Params().FastPreserveBoundary=true;
MyTriEdgeCollapse::Params().OptimalPlacement=OptimalPlacement;
// MyTriEdgeCollapse::Params().OptimalPlacement=OptimalPlacement;
MyTriEdgeCollapse::Params().OptimalPlacement=true;
if(PreserveNormal) {
MyTriEdgeCollapse::Params().NormalCheck= true;