diff --git a/src/meshlabplugins/u3d_io/u3d_gui.cpp b/src/meshlabplugins/u3d_io/u3d_gui.cpp index 5c03fdeb1..b570bdf51 100644 --- a/src/meshlabplugins/u3d_io/u3d_gui.cpp +++ b/src/meshlabplugins/u3d_io/u3d_gui.cpp @@ -3,7 +3,7 @@ float avoidExponentialNotation(const float n,const float bboxdiag) { - float val_min = std::min(1000.0f,floorf(bboxdiag * 1000.0f)); + float val_min = std::min(1000.0f,floor(bboxdiag * 1000.0f)); return floor(val_min * n ) / val_min; } diff --git a/src/meshlabplugins/u3d_io/u3d_io.cpp b/src/meshlabplugins/u3d_io/u3d_io.cpp index 48144d2b7..b78dc711a 100644 --- a/src/meshlabplugins/u3d_io/u3d_io.cpp +++ b/src/meshlabplugins/u3d_io/u3d_io.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include "u3d_gui.h" @@ -57,33 +58,40 @@ bool U3DIOPlugin::save(const QString &formatName, const QString &fileName, MeshM //std::string filename = fileName.toUtf8().data(); std::string ex = formatName.toUtf8().data(); - vcg::tri::io::u3dparametersclasses::Movie15Parameters mp; - mp._campar = new vcg::tri::io::u3dparametersclasses::Movie15Parameters::CameraParameters(m.cm.bbox.Center(),m.cm.bbox.Diag()); - U3D_GUI pw(mp,parent); - pw.exec(); - - QSettings settings; - - QString converterPath = computePluginsPath(); -#if defined(Q_OS_WIN) - converterPath += "/IDTFConverter.exe"; -#elif defined(Q_OS_MAC) - converterPath = converterPath +"/IDTFConverter.sh "+ converterPath; -#endif - - if (settings.contains("U3D/converter")) - converterPath=settings.value("U3D/converter").toString(); - //else - // settings.setValue("U3D/converter",converterPath); - - int result = tri::io::ExporterU3D::Save(m.cm,filename.c_str(),qPrintable(converterPath),mp,mask); - - if(result!=0) + if(formatName.toUpper() == tr("U3D")) { - QMessageBox::warning(parent, tr("Saving Error"), errorMsgFormat.arg(fileName, vcg::tri::io::ExporterU3D::ErrorMsg(result))); - return false; + vcg::tri::io::u3dparametersclasses::Movie15Parameters mp; + mp._campar = new vcg::tri::io::u3dparametersclasses::Movie15Parameters::CameraParameters(m.cm.bbox.Center(),m.cm.bbox.Diag()); + U3D_GUI pw(mp,parent); + pw.exec(); + + + QSettings settings; + + QString converterPath = computePluginsPath(); + #if defined(Q_OS_WIN) + converterPath += "/IDTFConverter.exe"; + #elif defined(Q_OS_MAC) + converterPath = converterPath +"/IDTFConverter.sh "+ converterPath; + #endif + + if (settings.contains("U3D/converter")) + converterPath=settings.value("U3D/converter").toString(); + //else + // settings.setValue("U3D/converter",converterPath); + + int result = tri::io::ExporterU3D::Save(m.cm,filename.c_str(),qPrintable(converterPath),mp,mask); + + if(result!=0) + { + QMessageBox::warning(parent, tr("Saving Error"), errorMsgFormat.arg(fileName, vcg::tri::io::ExporterU3D::ErrorMsg(result))); + return false; + } } + + if(formatName.toUpper() == tr("IDTF")) + int result = tri::io::ExporterIDTF::Save(m.cm,filename.c_str(),mask); return true; } @@ -103,6 +111,7 @@ QList U3DIOPlugin::exportFormats() const { QList formatList; formatList << Format("U3D File Format" ,tr("U3D")); + formatList << Format("U3D File Format" ,tr("IDTF")); return formatList; } @@ -117,6 +126,13 @@ void U3DIOPlugin::GetExportMaskCapability(QString &format, int &capability, int capability=defaultBits = vcg::tri::io::ExporterU3D::GetExportMaskCapability(); return; } + + if(format.toUpper() == tr("IDTF")) + { + capability=defaultBits = vcg::tri::io::ExporterIDTF::GetExportMaskCapability(); + return; + } + assert(0); }