QT version
This commit is contained in:
parent
dcdfdb1305
commit
686e2672b2
|
@ -1,7 +1,12 @@
|
|||
#ifndef __VCGLIB_EXPORTERU3D
|
||||
#define __VCGLIB_EXPORTERU3D
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <QDir.h>
|
||||
#include<QString.h>
|
||||
|
||||
#include "export_idtf.h"
|
||||
|
||||
namespace vcg {
|
||||
namespace tri {
|
||||
|
@ -13,53 +18,43 @@ class ExporterU3D
|
|||
private:
|
||||
|
||||
#ifdef WIN32
|
||||
static void CreateDir()
|
||||
static void InvokeConverter(const QString& input_idtf,const QString& output_u3d)
|
||||
{
|
||||
system("mkdir __tmp_dir");
|
||||
}
|
||||
|
||||
static void RemoveDir()
|
||||
{
|
||||
system("rmdir /S /Q __tmp_dir");
|
||||
}
|
||||
|
||||
static void InvokeConverter(const char* converter_path,const char* idtf_file,const char* u3d_file)
|
||||
{
|
||||
std::string com(converter_path);
|
||||
system(("cd " + com).c_str());
|
||||
com = std::string("IDTFConverter.exe -input ") + idtf_file + " -output " + u3d_file;
|
||||
system(com.c_str());
|
||||
system(("IDTFConverter.exe -input " + input_idtf + " -output " + output_u3d ).toAscii());
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef LINUX
|
||||
static void CreateDir()
|
||||
{
|
||||
system("echo off mkdir __tmp_dir");
|
||||
}
|
||||
|
||||
static void RemoveDir()
|
||||
{
|
||||
system("echo off rmdir -ignore-fail-on-non-empty __tmp_dir");
|
||||
}
|
||||
static void InvokeConverter(const QString& input_idtf,const QString& output_u3d)
|
||||
{
|
||||
system(("IDTFConverter.exe -input " + input_idtf + " -output " + output_u3d ).toAscii()));
|
||||
}
|
||||
|
||||
static void InvokeConverter(const char* converter_path,const char* idtf_file,const char* u3d_file)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
public:
|
||||
|
||||
static void Save(SaveMeshType& m,const char* outputfile,const int mask)
|
||||
{
|
||||
CreateDir();
|
||||
std::string tmp(outputfile);
|
||||
tmp = "tmp_dir/" + tmp + ".idtf";
|
||||
vcg::tri::io::ExporterIDTF<SaveMeshType>::Save(m,tmp.c_str(),mask);
|
||||
InvokeConverter("../../code/lib/U3D/Bin/Win32/Release",tmp.c_str() ,outputfile);
|
||||
RemoveDir();
|
||||
QDir dir;
|
||||
|
||||
if (!dir.mkdir("__tmp_dir")) return;
|
||||
else
|
||||
{
|
||||
QString curr = QDir::currentPath();
|
||||
QString tmp(outputfile);
|
||||
tmp = "__tmp_dir/" + tmp + ".idtf";
|
||||
vcg::tri::io::ExporterIDTF<SaveMeshType>::Save(m,tmp.toAscii(),mask);
|
||||
QDir::setCurrent("../../code/lib/U3D/Bin/Win32/Release");
|
||||
InvokeConverter((curr + "/" + tmp).toAscii(),(curr + "/" + outputfile).toAscii());
|
||||
QDir::setCurrent(curr);
|
||||
dir.remove(tmp.toAscii());
|
||||
dir.rmdir("__tmp_dir");
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue