From 96bdbd9608d6d021acdcbf3621efa77ebdb20d1a Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Sat, 14 Jan 2006 11:23:25 +0000 Subject: [PATCH] update savemask exporter with init a mask [base type] --- src/meshlabplugins/meshio/meshio.cpp | 10 +- .../meshio/savemaskexporter.cpp | 44 +++- src/meshlabplugins/meshio/savemaskexporter.h | 34 ++++ .../meshio/ui/savemaskexporter.ui | 191 +++++++++++++++++- 4 files changed, 267 insertions(+), 12 deletions(-) diff --git a/src/meshlabplugins/meshio/meshio.cpp b/src/meshlabplugins/meshio/meshio.cpp index f32668002..fad372f67 100644 --- a/src/meshlabplugins/meshio/meshio.cpp +++ b/src/meshlabplugins/meshio/meshio.cpp @@ -24,6 +24,9 @@ History $Log$ + Revision 1.44 2006/01/14 11:23:24 fmazzant + update savemask exporter with init a mask [base type] + Revision 1.43 2006/01/14 00:02:52 fmazzant added new include for exporter dialog @@ -352,10 +355,15 @@ bool ExtraMeshIOPlugin::save(const QString &formatName,QString &fileName, MeshMo if(formatName.toUpper() == tr("3DS")) { + //int newmask = vcg::tri::io::SaveMaskToExporter::GetMaskToExporter(mask,tr("3DS")); + //if( newmask == 0 )return false; bool result = vcg::tri::io::Exporter3DS::Save(m.cm,filename.c_str(),true,mask,cb);//salva esclusivamente in formato binario if(result!=0) + { QMessageBox::warning(parent, tr("3DS Saving Error"), errorMsgFormat.arg(fileName, vcg::tri::io::Exporter3DS::ErrorMsg(result))); - return result; + return false; + } + return true; } QMessageBox::warning(parent, "Unknow type", "file's extension not supported!!!"); diff --git a/src/meshlabplugins/meshio/savemaskexporter.cpp b/src/meshlabplugins/meshio/savemaskexporter.cpp index 5d31254ef..f01c27236 100644 --- a/src/meshlabplugins/meshio/savemaskexporter.cpp +++ b/src/meshlabplugins/meshio/savemaskexporter.cpp @@ -25,6 +25,9 @@ History $Log$ + Revision 1.2 2006/01/14 11:23:24 fmazzant + update savemask exporter with init a mask [base type] + Revision 1.1 2006/01/13 23:59:51 fmazzant first commit exporter dialog @@ -40,18 +43,57 @@ SaveMaskExporterDialog::SaveMaskExporterDialog(QWidget *parent) : QDialog(parent connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(SlotCancelButton())); } -SaveMaskExporterDialog::SaveMaskExporterDialog(QWidget *parent, int &mask) : QDialog(parent) +SaveMaskExporterDialog::SaveMaskExporterDialog(QWidget *parent, int &mask) : QDialog(parent), mask(mask) { SaveMaskExporterDialog::ui.setupUi(this); connect(ui.okButton, SIGNAL(clicked()), this, SLOT(SlotOkButton())); connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(SlotCancelButton())); } +SaveMaskExporterDialog::SaveMaskExporterDialog(QWidget *parent, int &mask, QString type) : QDialog(parent), mask(mask), type(type) +{ + SaveMaskExporterDialog::ui.setupUi(this); + connect(ui.okButton, SIGNAL(clicked()), this, SLOT(SlotOkButton())); + connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(SlotCancelButton())); +} + +void SaveMaskExporterDialog::Initialize() +{ + if( mask & vcg::tri::io::Mask::IOM_VERTFLAGS ) {} + if( mask & vcg::tri::io::Mask::IOM_VERTCOLOR ) {} + if( mask & vcg::tri::io::Mask::IOM_VERTQUALITY ) {} + if( mask & vcg::tri::io::Mask::IOM_VERTTEXCOORD ) {} + if( mask & vcg::tri::io::Mask::IOM_VERTNORMAL ) {} + + if( mask & vcg::tri::io::Mask::IOM_FACEFLAGS ) {} + if( mask & vcg::tri::io::Mask::IOM_FACECOLOR ) {} + if( mask & vcg::tri::io::Mask::IOM_FACEQUALITY ) {} + if( mask & vcg::tri::io::Mask::IOM_FACENORMAL ) {} + + if( mask & vcg::tri::io::Mask::IOM_WEDGCOLOR ) {} + if( mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD ) {} + if( mask & vcg::tri::io::Mask::IOM_WEDGNORMAL ) {} + + if( mask & vcg::tri::io::Mask::IOM_CAMERA ) {} +} + +int SaveMaskExporterDialog::GetNewMask() +{ + return this->mask; +} + //slot void SaveMaskExporterDialog::SlotOkButton() { + int newmask = 0; + + newmask |= vcg::tri::io::Mask::IOM_VERTQUALITY; + newmask |= vcg::tri::io::Mask::IOM_FACEQUALITY; + + this->mask=newmask; } void SaveMaskExporterDialog::SlotCancelButton() { + this->mask=0; } \ No newline at end of file diff --git a/src/meshlabplugins/meshio/savemaskexporter.h b/src/meshlabplugins/meshio/savemaskexporter.h index f45520dd5..0bc3e92b8 100644 --- a/src/meshlabplugins/meshio/savemaskexporter.h +++ b/src/meshlabplugins/meshio/savemaskexporter.h @@ -25,6 +25,9 @@ History $Log$ + Revision 1.2 2006/01/14 11:23:24 fmazzant + update savemask exporter with init a mask [base type] + Revision 1.1 2006/01/13 23:59:51 fmazzant first commit exporter dialog @@ -34,6 +37,8 @@ #ifndef __VCGLIB_SAVEMASK_EXPORT #define __VCGLIB_SAVEMASK_EXPORT +#include + #include "ui_savemaskexporter.h" class SaveMaskExporterDialog : public QDialog @@ -42,6 +47,10 @@ class SaveMaskExporterDialog : public QDialog public: SaveMaskExporterDialog(QWidget *parent); SaveMaskExporterDialog(QWidget *parent,int &mask); + SaveMaskExporterDialog(QWidget *parent,int &mask,QString type); + + void Initialize(); + int GetNewMask(); private slots: void SlotOkButton(); @@ -49,8 +58,33 @@ private slots: private: Ui::MaskExporterDialog ui; + int mask; + QString type; };//end class +namespace vcg { +namespace tri { +namespace io { + + class SaveMaskToExporter + { + public: + inline static int GetMaskToExporter(int &mask,QString type) + { + SaveMaskExporterDialog dialog(new QWidget(),mask,type); + dialog.Initialize(); + dialog.exec(); + int newmask = dialog.GetNewMask(); + dialog.close(); + return newmask; + + } + + }; +} // end Namespace tri +} // end Namespace io +} // end Namespace vcg + #endif \ No newline at end of file diff --git a/src/meshlabplugins/meshio/ui/savemaskexporter.ui b/src/meshlabplugins/meshio/ui/savemaskexporter.ui index 5657843da..9aa66cc5c 100644 --- a/src/meshlabplugins/meshio/ui/savemaskexporter.ui +++ b/src/meshlabplugins/meshio/ui/savemaskexporter.ui @@ -9,7 +9,7 @@ 0 0 400 - 248 + 229 @@ -25,6 +25,55 @@ + + + + 270 + 10 + 120 + 161 + + + + Wedg + + + + 8 + + + 6 + + + + + Color + + + + + + + TexCoord + + + + + + + TextMulti + + + + + + + Normal + + + + + @@ -37,6 +86,49 @@ Face + + + 8 + + + 6 + + + + + Index + + + + + + + Flags + + + + + + + Color + + + + + + + Quality + + + + + + + Normal + + + + @@ -50,25 +142,104 @@ Vert + + + 8 + + + 6 + + + + + Coord + + + + + + + Flags + + + + + + + Color + + + + + + + Quality + + + + + + + Normal + + + + + + + TextCoord + + + + - + - 270 - 10 + 10 + 180 120 - 161 + 46 - - Wedg - + + + 0 + + + 6 + + + + + All + + + + + + + Camera + + + true + + + + + + + None + + + + 240 - 220 + 200 75 23 @@ -81,7 +252,7 @@ 320 - 220 + 200 75 23