mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-13 00:07:24 +00:00
Added Initial Filter Script Dialog
This commit is contained in:
parent
64b81d7a7d
commit
2a2a7cc7c8
@ -1,3 +1,13 @@
|
||||
|
||||
15/6/06
|
||||
o continua a chiedere di salvare anche dopo aver salvato
|
||||
o crash on open obj se compilato con mingw
|
||||
o crash su topologia facce degeneri
|
||||
x restore color crash
|
||||
o icona delete
|
||||
x crash on cancel in opening // DONE 15/6
|
||||
o progress bar occupa tempo macchina
|
||||
|
||||
12/6/06
|
||||
o selection che genera parametri
|
||||
o progress bar integrata nella glarea.
|
||||
|
||||
@ -23,29 +23,12 @@
|
||||
/****************************************************************************
|
||||
History
|
||||
$Log$
|
||||
Revision 1.2 2006/06/16 01:26:07 cignoni
|
||||
Added Initial Filter Script Dialog
|
||||
|
||||
Revision 1.1 2006/06/15 13:05:57 cignoni
|
||||
added Filter History Dialogs
|
||||
|
||||
Revision 1.7 2006/01/16 05:34:16 cignoni
|
||||
Added backward qt4.0 compatibility for setAutoFillBackground
|
||||
|
||||
Revision 1.6 2006/01/15 15:27:59 glvertex
|
||||
Added few lines to set background even in qt 4.1
|
||||
|
||||
Revision 1.5 2006/01/02 18:54:52 glvertex
|
||||
added multilevel logging support
|
||||
|
||||
Revision 1.4 2006/01/02 17:39:18 glvertex
|
||||
Added info types in a combobox
|
||||
|
||||
Revision 1.3 2005/12/04 16:50:15 glvertex
|
||||
Removed [using namespace] directive form .h
|
||||
Renaming in QT style
|
||||
Adapted method behavior to the new ui interface
|
||||
|
||||
Revision 1.2 2005/12/03 22:49:46 cignoni
|
||||
Added copyright info
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#include "filterScriptDialog.h"
|
||||
@ -58,6 +41,9 @@ FilterScriptDialog::FilterScriptDialog(QWidget * parent)
|
||||
{
|
||||
FilterScriptDialog::ui.setupUi(this);
|
||||
scriptPtr=0;
|
||||
connect(ui.clearScriptButton,SIGNAL(clicked()), this, SLOT(clearScript()));
|
||||
connect(ui.saveScriptButton, SIGNAL(clicked()), this, SLOT(saveScript()));
|
||||
connect(ui.openScriptButton, SIGNAL(clicked()), this, SLOT(openScript()));
|
||||
}
|
||||
|
||||
void FilterScriptDialog::setScript(FilterScript *scr)
|
||||
@ -74,4 +60,17 @@ void FilterScriptDialog::clearScript()
|
||||
{
|
||||
assert(scriptPtr);
|
||||
scriptPtr->actionList.clear();
|
||||
ui.scriptListWidget->clear();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FilterScriptDialog::saveScript()
|
||||
{
|
||||
scriptPtr->save("Prova.xml");
|
||||
}
|
||||
|
||||
void FilterScriptDialog::openScript()
|
||||
{
|
||||
scriptPtr->open("Prova.xml");
|
||||
}
|
||||
|
||||
@ -23,6 +23,9 @@
|
||||
/****************************************************************************
|
||||
History
|
||||
$Log$
|
||||
Revision 1.2 2006/06/16 01:26:07 cignoni
|
||||
Added Initial Filter Script Dialog
|
||||
|
||||
Revision 1.1 2006/06/15 13:05:57 cignoni
|
||||
added Filter History Dialogs
|
||||
|
||||
@ -41,6 +44,8 @@ public:
|
||||
|
||||
private slots:
|
||||
void clearScript();
|
||||
void saveScript();
|
||||
void openScript();
|
||||
private:
|
||||
Ui::scriptDialog ui;
|
||||
FilterScript *scriptPtr;
|
||||
|
||||
@ -24,6 +24,9 @@
|
||||
History
|
||||
|
||||
$Log$
|
||||
Revision 1.2 2006/06/16 01:26:07 cignoni
|
||||
Added Initial Filter Script Dialog
|
||||
|
||||
Revision 1.1 2006/06/15 13:05:57 cignoni
|
||||
added Filter History Dialogs
|
||||
|
||||
@ -39,8 +42,94 @@ added Filter History Dialogs
|
||||
#include "meshmodel.h"
|
||||
#include "interfaces.h"
|
||||
#include "glarea.h"
|
||||
#include <QtXml/QDomDocument>
|
||||
#include <QtXml/QDomElement>
|
||||
#include <QtXml/QDomNode>
|
||||
|
||||
using namespace vcg;
|
||||
|
||||
bool FilterScript::save(QString filename)
|
||||
{
|
||||
|
||||
QDomDocument doc("FilterScript");
|
||||
QDomElement root = doc.createElement("FilterScript");
|
||||
doc.appendChild(root);
|
||||
|
||||
FilterScript::iterator ii;
|
||||
for(ii=actionList.begin();ii!= actionList.end();++ii)
|
||||
{
|
||||
QDomElement tag = doc.createElement("filter");
|
||||
tag.setAttribute(QString("name"),(*ii).first);
|
||||
FilterParameter &par=(*ii).second;
|
||||
QMap<QString,QVariant>::iterator jj;
|
||||
for(jj=par.paramMap.begin();jj!=par.paramMap.end();++jj)
|
||||
{
|
||||
QDomElement parElem = doc.createElement("Param");
|
||||
parElem.setAttribute("name",jj.key());
|
||||
if(jj.value().type()==QVariant::Bool) {
|
||||
parElem.setAttribute("type","Bool");
|
||||
if(jj.value().toBool())parElem.setAttribute("value","true");
|
||||
else parElem.setAttribute("value","true");
|
||||
}
|
||||
|
||||
if(jj.value().type()==QVariant::Int) {
|
||||
parElem.setAttribute("type","Int");
|
||||
parElem.setAttribute("value",jj.value().toInt());
|
||||
}
|
||||
if(jj.value().type()==QVariant::Double) {
|
||||
parElem.setAttribute("type","Float");
|
||||
parElem.setAttribute("value",jj.value().toString());
|
||||
}
|
||||
|
||||
if(jj.value().type()==QVariant::List) {
|
||||
parElem.setAttribute("type","Matrix44");
|
||||
QList<QVariant> matrixVals = jj.value().toList();
|
||||
for(int i=0;i<16;++i)
|
||||
parElem.setAttribute(QString("val")+QString::number(i),matrixVals[i].toString());
|
||||
}
|
||||
tag.appendChild(parElem);
|
||||
}
|
||||
root.appendChild(tag);
|
||||
}
|
||||
QFile file("Prova.xml");
|
||||
file.open(QIODevice::WriteOnly);
|
||||
doc.save(QTextStream(&file),1);
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FilterScript::open(QString filename)
|
||||
{
|
||||
QDomDocument doc;
|
||||
actionList.clear();
|
||||
//if(filename.endsWith(".mlx"))
|
||||
{
|
||||
QFile file(filename);
|
||||
if (file.open(QIODevice::ReadOnly) && doc.setContent(&file))
|
||||
{
|
||||
file.close();
|
||||
QDomElement root = doc.documentElement();
|
||||
if (root.nodeName() == "FilterScript")
|
||||
{
|
||||
qDebug("FilterScript");
|
||||
for(QDomElement n = root.firstChildElement("filter"); !n.isNull(); n = n.nextSiblingElement("filter"))
|
||||
{
|
||||
QString name=n.attribute("name");
|
||||
qDebug("Reading filter with name %s",qPrintable(name));
|
||||
// actionList.append(qMakePair(filterName(n),filterPar(n)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//
|
||||
//QString FilterScript::FilterName(QDomNode &n)
|
||||
//{
|
||||
//
|
||||
//}
|
||||
//FilterParameter FilterScript::FilterPar(QDomNode &n)
|
||||
//{
|
||||
//
|
||||
//}
|
||||
@ -11,8 +11,8 @@
|
||||
class FilterScript
|
||||
{
|
||||
public:
|
||||
bool Open(QString filename);
|
||||
bool Save(QString filename);
|
||||
bool open(QString filename);
|
||||
bool save(QString filename);
|
||||
|
||||
QList< QPair< QString , FilterParameter> > actionList;
|
||||
typedef QList< QPair<QString, FilterParameter> >::iterator iterator;
|
||||
|
||||
@ -23,6 +23,9 @@
|
||||
/****************************************************************************
|
||||
History
|
||||
$Log$
|
||||
Revision 1.66 2006/06/16 01:26:07 cignoni
|
||||
Added Initial Filter Script Dialog
|
||||
|
||||
Revision 1.65 2006/06/15 13:05:57 cignoni
|
||||
added Filter History Dialogs
|
||||
|
||||
@ -170,8 +173,9 @@ private:
|
||||
QStringList pluginFileNames;
|
||||
std::vector<MeshIOInterface*> meshIOPlugins;
|
||||
QByteArray toolbarState; //stato delle toolbar e dockwidgets
|
||||
public:
|
||||
QMap<QString, QAction *> filterMap; // a map to retrieve an action from a name. Used for playing filter scripts.
|
||||
|
||||
private:
|
||||
//////// ToolBars ///////////////
|
||||
QToolBar *mainToolBar;
|
||||
QToolBar *renderToolBar;
|
||||
|
||||
@ -24,6 +24,9 @@
|
||||
History
|
||||
|
||||
$Log$
|
||||
Revision 1.100 2006/06/16 01:26:07 cignoni
|
||||
Added Initial Filter Script Dialog
|
||||
|
||||
Revision 1.99 2006/06/15 13:05:57 cignoni
|
||||
added Filter History Dialogs
|
||||
|
||||
@ -594,9 +597,10 @@ void MainWindow::open(QString fileName)
|
||||
}
|
||||
vcg::tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFace(mm->cm);
|
||||
updateMenus();
|
||||
GLA()->mm->busy=false;
|
||||
}
|
||||
|
||||
GLA()->mm->busy=false;
|
||||
|
||||
|
||||
qb->reset();
|
||||
}
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
HEADERS = interfaces.h \
|
||||
GLLogStream.h \
|
||||
GLLogStream.h \
|
||||
mainwindow.h \
|
||||
meshmodel.h \
|
||||
glarea.h \
|
||||
filterscript.h \
|
||||
filterparameter.h \
|
||||
plugindialog.h \
|
||||
customDialog.h \
|
||||
filterScriptDialog.h \
|
||||
@ -45,7 +46,8 @@ RESOURCES = meshlab.qrc
|
||||
# to add windows icon
|
||||
RC_FILE = meshlab.rc
|
||||
|
||||
QT += opengl
|
||||
QT += opengl
|
||||
QT += xml
|
||||
|
||||
# the following line is needed to avoid mismatch between
|
||||
# the awful min/max macros of windows and the limits max
|
||||
|
||||
@ -23,6 +23,9 @@
|
||||
/****************************************************************************
|
||||
History
|
||||
$Log$
|
||||
Revision 1.24 2006/06/16 01:26:07 cignoni
|
||||
Added Initial Filter Script Dialog
|
||||
|
||||
Revision 1.23 2006/06/07 08:49:25 cignoni
|
||||
Disable rendering during processing and loading
|
||||
|
||||
@ -154,6 +157,7 @@ public:
|
||||
}
|
||||
inline void restoreVertexColor()
|
||||
{
|
||||
if(originalVertexColor.empty()) return;
|
||||
vector<Color4b>::iterator ci;
|
||||
CMeshO::VertexIterator vi;
|
||||
for(vi=cm.vert.begin(),ci=originalVertexColor.begin();vi!=cm.vert.end();++vi,++ci)
|
||||
|
||||
@ -8,75 +8,92 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>396</width>
|
||||
<width>461</width>
|
||||
<height>298</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>250</y>
|
||||
<width>351</width>
|
||||
<height>33</height>
|
||||
</rect>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearScriptButton" >
|
||||
<property name="text" >
|
||||
<string>Clear Script</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>131</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okButton" >
|
||||
<property name="text" >
|
||||
<string>Apply Script</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton" >
|
||||
<property name="text" >
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QListWidget" name="scriptListWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>10</y>
|
||||
<width>351</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="scriptListWidget" />
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="saveScriptButton" >
|
||||
<property name="text" >
|
||||
<string>Save Script</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="openScriptButton" >
|
||||
<property name="text" >
|
||||
<string>Open Script</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearScriptButton" >
|
||||
<property name="text" >
|
||||
<string>Clear Script</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>131</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okButton" >
|
||||
<property name="text" >
|
||||
<string>Apply Script</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton" >
|
||||
<property name="text" >
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<resources/>
|
||||
|
||||
@ -2,8 +2,8 @@ newmtl Texture
|
||||
Ns 100
|
||||
d 1
|
||||
illum 2
|
||||
Ka .8 .8 .8
|
||||
Kd 0.2 0.2 0.2
|
||||
Kd .8 .8 .8
|
||||
Ka 0.2 0.2 0.2
|
||||
Ks 0 0 0
|
||||
map_Kd sub_texture.jpg
|
||||
map_Ka sub_texture.jpg
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user