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