mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-20 03:16:10 +00:00
update interface meshio : formats -> importFormats() & exportFormts
This commit is contained in:
parent
8a3029daa1
commit
8ae5507abd
@ -23,6 +23,9 @@
|
||||
/****************************************************************************
|
||||
History
|
||||
$Log$
|
||||
Revision 1.33 2006/01/17 13:47:45 fmazzant
|
||||
update interface meshio : formats -> importFormats() & exportFormts
|
||||
|
||||
Revision 1.32 2006/01/17 10:04:20 cignoni
|
||||
Slightly change MeshEditInterface
|
||||
|
||||
@ -140,7 +143,8 @@ public:
|
||||
};
|
||||
|
||||
virtual ~MeshIOInterface() {}
|
||||
virtual QList<Format> formats() const = 0;
|
||||
virtual QList<Format> importFormats() const = 0;
|
||||
virtual QList<Format> exportFormats() const = 0;
|
||||
|
||||
virtual bool open(
|
||||
const QString &format, // "OBJ"
|
||||
|
||||
@ -23,6 +23,9 @@
|
||||
/****************************************************************************
|
||||
History
|
||||
$Log$
|
||||
Revision 1.57 2006/01/17 13:47:45 fmazzant
|
||||
update interface meshio : formats -> importFormats() & exportFormts
|
||||
|
||||
Revision 1.56 2006/01/14 00:51:06 davide_portelli
|
||||
A little change
|
||||
|
||||
@ -185,7 +188,7 @@ private:
|
||||
void updateRecentFileActions();
|
||||
void setCurrentFile(const QString &fileName);
|
||||
void addToMenu(QList<QAction *>, QMenu *menu, const char *slot);
|
||||
void LoadKnownFilters(QStringList &filters, QHash<QString, int> &allKnownFormats);
|
||||
void LoadKnownFilters(QStringList &filters, QHash<QString, int> &allKnownFormats, int type);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -24,6 +24,9 @@
|
||||
History
|
||||
|
||||
$Log$
|
||||
Revision 1.70 2006/01/17 13:47:45 fmazzant
|
||||
update interface meshio : formats -> importFormats() & exportFormts
|
||||
|
||||
Revision 1.69 2006/01/16 15:30:24 fmazzant
|
||||
added rename texture dialog for exporter
|
||||
removed old maskobj
|
||||
@ -675,7 +678,8 @@ void MainWindow::toggleBackFaceCulling()
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::LoadKnownFilters(QStringList &filters, QHash<QString, int> &allKnownFormats)
|
||||
enum TypeIO{IMPORT,EXPORT};
|
||||
void MainWindow::LoadKnownFilters(QStringList &filters, QHash<QString, int> &allKnownFormats,int type)
|
||||
{
|
||||
QString allKnownFormatsFilter = tr("All known formats (");
|
||||
std::vector<MeshIOInterface*>::iterator itIOPlugin = meshIOPlugins.begin();
|
||||
@ -683,7 +687,16 @@ void MainWindow::LoadKnownFilters(QStringList &filters, QHash<QString, int> &all
|
||||
{
|
||||
MeshIOInterface* pMeshIOPlugin = *itIOPlugin;
|
||||
|
||||
QList<MeshIOInterface::Format> currentFormats = pMeshIOPlugin->formats();
|
||||
QList<MeshIOInterface::Format> currentFormats;// = pMeshIOPlugin->formats();
|
||||
|
||||
/* new */
|
||||
if(type == IMPORT)
|
||||
currentFormats = pMeshIOPlugin->importFormats();
|
||||
|
||||
if(type == EXPORT)
|
||||
currentFormats = pMeshIOPlugin->exportFormats();
|
||||
/* end new part */
|
||||
|
||||
QList<MeshIOInterface::Format>::iterator itFormat = currentFormats.begin();
|
||||
while(itFormat != currentFormats.end())
|
||||
{
|
||||
@ -723,7 +736,7 @@ void MainWindow::open(QString fileName)
|
||||
// the index of first plugin which is able to open it
|
||||
QHash<QString, int> allKnownFormats;
|
||||
|
||||
LoadKnownFilters(filters, allKnownFormats);
|
||||
LoadKnownFilters(filters, allKnownFormats,IMPORT);
|
||||
|
||||
if (fileName.isEmpty())
|
||||
fileName = QFileDialog::getOpenFileName(this,tr("Open File"),".", filters.join("\n"));
|
||||
@ -805,7 +818,7 @@ bool MainWindow::saveAs()
|
||||
|
||||
QHash<QString, int> allKnownFormats;
|
||||
|
||||
LoadKnownFilters(filters, allKnownFormats);
|
||||
LoadKnownFilters(filters, allKnownFormats,EXPORT);
|
||||
|
||||
QString fileName;
|
||||
|
||||
|
||||
@ -23,6 +23,9 @@
|
||||
/****************************************************************************
|
||||
History
|
||||
$Log$
|
||||
Revision 1.10 2006/01/17 13:47:45 fmazzant
|
||||
update interface meshio : formats -> importFormats() & exportFormts
|
||||
|
||||
Revision 1.9 2006/01/17 10:03:29 cignoni
|
||||
Removed bug: crash on white space click
|
||||
|
||||
@ -131,9 +134,14 @@ void PluginDialog::populateTreeWidget(const QString &path,const QStringList &fil
|
||||
MeshIOInterface *iMeshIO = qobject_cast<MeshIOInterface *>(plugin);
|
||||
if (iMeshIO){
|
||||
QStringList Templist;
|
||||
foreach(const MeshIOInterface::Format f,iMeshIO->formats()){
|
||||
foreach(const MeshIOInterface::Format f,iMeshIO->importFormats()){
|
||||
QString formats;
|
||||
foreach(const QString s,f.extensions) formats+=s+" ";
|
||||
foreach(const QString s,f.extensions) formats+="Importer_"+s+" ";
|
||||
Templist.push_back(formats);
|
||||
}
|
||||
foreach(const MeshIOInterface::Format f,iMeshIO->exportFormats()){
|
||||
QString formats;
|
||||
foreach(const QString s,f.extensions) formats+="Exporter_"+s+" ";
|
||||
Templist.push_back(formats);
|
||||
}
|
||||
addItems(pluginItem,Templist);
|
||||
@ -198,9 +206,14 @@ void PluginDialog::displayInfo(QTreeWidgetItem* item,int ncolumn)
|
||||
MeshIOInterface *iMeshIO = qobject_cast<MeshIOInterface *>(plugin);
|
||||
if (iMeshIO){
|
||||
if (item->parent()!=NULL)
|
||||
foreach(const MeshIOInterface::Format f,iMeshIO->formats()){
|
||||
foreach(const MeshIOInterface::Format f,iMeshIO->importFormats()){
|
||||
QString formats;
|
||||
foreach(const QString s,f.extensions) formats+=s+" ";
|
||||
foreach(const QString s,f.extensions) formats+="Importer_"+s+" ";
|
||||
if (actionName==formats) labelInfo->setText(f.description);
|
||||
}
|
||||
foreach(const MeshIOInterface::Format f,iMeshIO->exportFormats()){
|
||||
QString formats;
|
||||
foreach(const QString s,f.extensions) formats+="Importer_"+s+" ";
|
||||
if (actionName==formats) labelInfo->setText(f.description);
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,6 +24,9 @@
|
||||
History
|
||||
|
||||
$Log$
|
||||
Revision 1.51 2006/01/17 13:47:45 fmazzant
|
||||
update interface meshio : formats -> importFormats() & exportFormts
|
||||
|
||||
Revision 1.50 2006/01/16 23:53:22 fmazzant
|
||||
bux-fix MeshModel &m -> MeshModel *m
|
||||
|
||||
@ -329,9 +332,10 @@ bool ExtraMeshIOPlugin::save(const QString &formatName,QString &fileName, MeshMo
|
||||
|
||||
if(formatName.toUpper() == tr("OBJ"))
|
||||
{
|
||||
int newmask = vcg::tri::io::SaveMaskToExporter::GetMaskToExporter(&m,vcg::tri::io::SaveMaskToExporter::_OBJ);
|
||||
int newmask = vcg::tri::io::SaveMaskToExporter::GetMaskToExporter(&m,vcg::tri::io::SaveMaskToExporter::_OBJ,vcg::tri::io::ExporterOBJ<CMeshO>::GetExportMaskCapability());
|
||||
if( newmask == 0 )return false;
|
||||
int result = vcg::tri::io::ExporterOBJ<CMeshO>::Save(m.cm,filename.c_str(),false,newmask,cb);//salva escusivamente in formato ASCII
|
||||
|
||||
int result = vcg::tri::io::ExporterOBJ<CMeshO>::Save(m.cm,filename.c_str(),false,newmask,cb);//salva esclusivamente in formato ASCII
|
||||
if(result != vcg::tri::io::ExporterOBJ<CMeshO>::E_NOERROR )
|
||||
{
|
||||
QMessageBox::warning(parent, tr("OBJ Saving Error"), errorMsgFormat.arg(fileName, vcg::tri::io::ExporterOBJ<CMeshO>::ErrorMsg(result)));
|
||||
@ -342,7 +346,7 @@ bool ExtraMeshIOPlugin::save(const QString &formatName,QString &fileName, MeshMo
|
||||
|
||||
if(formatName.toUpper() == tr("PLY"))
|
||||
{
|
||||
int newmask = vcg::tri::io::SaveMaskToExporter::GetMaskToExporter(&m,vcg::tri::io::SaveMaskToExporter::_PLY);
|
||||
int newmask = vcg::tri::io::SaveMaskToExporter::GetMaskToExporter(&m,vcg::tri::io::SaveMaskToExporter::_PLY,0);//aggiungere la capability
|
||||
if( newmask == 0 )return false;
|
||||
|
||||
int result = vcg::tri::io::Exporter<CMeshO>::Save(m.cm,filename.c_str(),newmask,cb);
|
||||
@ -356,7 +360,7 @@ bool ExtraMeshIOPlugin::save(const QString &formatName,QString &fileName, MeshMo
|
||||
|
||||
if(formatName.toUpper() == tr("OFF"))
|
||||
{
|
||||
//int newmask = vcg::tri::io::SaveMaskToExporter::GetMaskToExporter(&m,vcg::tri::io::SaveMaskToExporter::_OFF);
|
||||
//int newmask = vcg::tri::io::SaveMaskToExporter::GetMaskToExporter(&m,vcg::tri::io::SaveMaskToExporter::_OFF,0);//aggiungere la capability
|
||||
//if( newmask == 0 )return false;
|
||||
|
||||
int result = vcg::tri::io::Exporter<CMeshO>::Save(m.cm,filename.c_str(),cb);
|
||||
@ -370,7 +374,7 @@ bool ExtraMeshIOPlugin::save(const QString &formatName,QString &fileName, MeshMo
|
||||
|
||||
if(formatName.toUpper() == tr("STL"))
|
||||
{
|
||||
int newmask = vcg::tri::io::SaveMaskToExporter::GetMaskToExporter(&m,vcg::tri::io::SaveMaskToExporter::_STL);
|
||||
int newmask = vcg::tri::io::SaveMaskToExporter::GetMaskToExporter(&m,vcg::tri::io::SaveMaskToExporter::_STL,0);//aggiungere la capability
|
||||
if( newmask == 0 )return false;
|
||||
|
||||
int result = vcg::tri::io::Exporter<CMeshO>::Save(m.cm,filename.c_str(),newmask,cb);
|
||||
@ -385,7 +389,7 @@ bool ExtraMeshIOPlugin::save(const QString &formatName,QString &fileName, MeshMo
|
||||
|
||||
if(formatName.toUpper() == tr("3DS"))
|
||||
{
|
||||
int newmask = vcg::tri::io::SaveMaskToExporter::GetMaskToExporter(&m,vcg::tri::io::SaveMaskToExporter::_3DS);
|
||||
int newmask = vcg::tri::io::SaveMaskToExporter::GetMaskToExporter(&m,vcg::tri::io::SaveMaskToExporter::_3DS,vcg::tri::io::Exporter3DS<CMeshO>::GetExportMaskCapability());
|
||||
if( newmask == 0 )return false;
|
||||
|
||||
int result = vcg::tri::io::Exporter3DS<CMeshO>::Save(m.cm,filename.c_str(),true,newmask,cb);//salva esclusivamente in formato binario
|
||||
@ -402,7 +406,7 @@ bool ExtraMeshIOPlugin::save(const QString &formatName,QString &fileName, MeshMo
|
||||
return false;
|
||||
}
|
||||
|
||||
QList<MeshIOInterface::Format> ExtraMeshIOPlugin::formats() const
|
||||
QList<MeshIOInterface::Format> ExtraMeshIOPlugin::importFormats() const
|
||||
{
|
||||
QList<Format> formatList;
|
||||
|
||||
@ -432,8 +436,41 @@ QList<MeshIOInterface::Format> ExtraMeshIOPlugin::formats() const
|
||||
formatList << stl;
|
||||
formatList << _3ds;
|
||||
|
||||
return formatList;
|
||||
};
|
||||
|
||||
return formatList;
|
||||
}
|
||||
|
||||
QList<MeshIOInterface::Format> ExtraMeshIOPlugin::exportFormats() const
|
||||
{
|
||||
QList<Format> formatList;
|
||||
|
||||
Format ply;
|
||||
ply.description = "Stanford Polygon File Format";
|
||||
ply.extensions << tr("PLY");
|
||||
|
||||
Format obj;
|
||||
obj.description = "Alias Wavefront Object";
|
||||
obj.extensions << tr("OBJ");
|
||||
|
||||
Format off;
|
||||
off.description = "Object File Format";
|
||||
off.extensions << tr("OFF");
|
||||
|
||||
Format stl;
|
||||
stl.description = "STL File Format";
|
||||
stl.extensions << tr("STL");
|
||||
|
||||
Format _3ds;
|
||||
_3ds.description = "3D-Studio File Format";
|
||||
_3ds.extensions << tr("3DS");
|
||||
|
||||
formatList << ply;
|
||||
formatList << obj;
|
||||
formatList << off;
|
||||
formatList << stl;
|
||||
formatList << _3ds;
|
||||
|
||||
return formatList;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(ExtraMeshIOPlugin)
|
||||
@ -24,6 +24,9 @@
|
||||
History
|
||||
|
||||
$Log$
|
||||
Revision 1.16 2006/01/17 13:47:45 fmazzant
|
||||
update interface meshio : formats -> importFormats() & exportFormts
|
||||
|
||||
Revision 1.15 2005/12/15 01:20:28 buzzelli
|
||||
formats method adapted in order to fit with recent changes in MeshIOInterface
|
||||
|
||||
@ -76,7 +79,8 @@ class ExtraMeshIOPlugin : public QObject, public MeshIOInterface
|
||||
|
||||
|
||||
public:
|
||||
QList<Format> formats() const;
|
||||
QList<Format> importFormats() const;
|
||||
QList<Format> exportFormats() const;
|
||||
|
||||
bool open(const QString &formatName, QString &fileName, MeshModel &m, int& mask, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, QString &fileName, MeshModel &m, int& mask, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user