+ make POV-Ray renderer working on Windows
This commit is contained in:
parent
d101c64635
commit
3523741e96
|
@ -34,6 +34,7 @@
|
||||||
# include <vector>
|
# include <vector>
|
||||||
# include <Inventor/nodes/SoPerspectiveCamera.h>
|
# include <Inventor/nodes/SoPerspectiveCamera.h>
|
||||||
# include <QApplication>
|
# include <QApplication>
|
||||||
|
# include <QDir>
|
||||||
# include <QFile>
|
# include <QFile>
|
||||||
# include <QFileInfo>
|
# include <QFileInfo>
|
||||||
# include <QMessageBox>
|
# include <QMessageBox>
|
||||||
|
@ -609,10 +610,18 @@ void CmdRaytracingRender::activated(int iMsg)
|
||||||
|
|
||||||
if (renderType == "povray") {
|
if (renderType == "povray") {
|
||||||
QStringList filter;
|
QStringList filter;
|
||||||
|
#ifdef FC_OS_WIN32
|
||||||
|
filter << QObject::tr("Rendered image (*.bmp)");
|
||||||
|
#else
|
||||||
filter << QObject::tr("Rendered image (*.png)");
|
filter << QObject::tr("Rendered image (*.png)");
|
||||||
|
#endif
|
||||||
filter << QObject::tr("All Files (*.*)");
|
filter << QObject::tr("All Files (*.*)");
|
||||||
QString fn = Gui::FileDialog::getSaveFileName(Gui::getMainWindow(), QObject::tr("Rendered image"), QString(), filter.join(QLatin1String(";;")));
|
QString fn = Gui::FileDialog::getSaveFileName(Gui::getMainWindow(), QObject::tr("Rendered image"), QString(), filter.join(QLatin1String(";;")));
|
||||||
if (!fn.isEmpty()) {
|
if (!fn.isEmpty()) {
|
||||||
|
fn = QDir::toNativeSeparators(fn);
|
||||||
|
#ifdef FC_OS_WIN32
|
||||||
|
fn.replace(QLatin1String("\\"), QLatin1String("\\\\"));
|
||||||
|
#endif
|
||||||
std::string fname = (const char*)fn.toUtf8();
|
std::string fname = (const char*)fn.toUtf8();
|
||||||
openCommand("Render project");
|
openCommand("Render project");
|
||||||
int width = hGrp->GetInt("OutputWidth", 800);
|
int width = hGrp->GetInt("OutputWidth", 800);
|
||||||
|
@ -628,7 +637,12 @@ void CmdRaytracingRender::activated(int iMsg)
|
||||||
doCommand(Doc,"f = open(TempFile,'wb')");
|
doCommand(Doc,"f = open(TempFile,'wb')");
|
||||||
doCommand(Doc,"f.write(PageFile.read())");
|
doCommand(Doc,"f.write(PageFile.read())");
|
||||||
doCommand(Doc,"f.close()");
|
doCommand(Doc,"f.close()");
|
||||||
|
#ifdef FC_OS_WIN32
|
||||||
|
// http://povray.org/documentation/view/3.6.1/603/
|
||||||
|
doCommand(Doc,"subprocess.call(\"%s %s +W%s +H%s +O%s /EXIT /RENDER \"+TempFile)",renderer.c_str(),par.c_str(),w.str().c_str(),h.str().c_str(),fname.c_str());
|
||||||
|
#else
|
||||||
doCommand(Doc,"subprocess.call('\"%s\" %s +W%s +H%s +O\"%s\" '+TempFile,shell=True)",renderer.c_str(),par.c_str(),w.str().c_str(),h.str().c_str(),fname.c_str());
|
doCommand(Doc,"subprocess.call('\"%s\" %s +W%s +H%s +O\"%s\" '+TempFile,shell=True)",renderer.c_str(),par.c_str(),w.str().c_str(),h.str().c_str(),fname.c_str());
|
||||||
|
#endif
|
||||||
doCommand(Gui,"import ImageGui");
|
doCommand(Gui,"import ImageGui");
|
||||||
doCommand(Gui,"ImageGui.open('%s')",fname.c_str());
|
doCommand(Gui,"ImageGui.open('%s')",fname.c_str());
|
||||||
doCommand(Doc,"del TempFile,PageFile");
|
doCommand(Doc,"del TempFile,PageFile");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user