From 3523741e96d0b8db338f8f05f13282f90ccbbe67 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 14 Jun 2014 13:26:25 +0200 Subject: [PATCH] + make POV-Ray renderer working on Windows --- src/Mod/Raytracing/Gui/Command.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Mod/Raytracing/Gui/Command.cpp b/src/Mod/Raytracing/Gui/Command.cpp index 56c4c3ea46..f5713ae671 100644 --- a/src/Mod/Raytracing/Gui/Command.cpp +++ b/src/Mod/Raytracing/Gui/Command.cpp @@ -34,6 +34,7 @@ # include # include # include +# include # include # include # include @@ -609,10 +610,18 @@ void CmdRaytracingRender::activated(int iMsg) if (renderType == "povray") { QStringList filter; +#ifdef FC_OS_WIN32 + filter << QObject::tr("Rendered image (*.bmp)"); +#else filter << QObject::tr("Rendered image (*.png)"); +#endif filter << QObject::tr("All Files (*.*)"); QString fn = Gui::FileDialog::getSaveFileName(Gui::getMainWindow(), QObject::tr("Rendered image"), QString(), filter.join(QLatin1String(";;"))); if (!fn.isEmpty()) { + fn = QDir::toNativeSeparators(fn); +#ifdef FC_OS_WIN32 + fn.replace(QLatin1String("\\"), QLatin1String("\\\\")); +#endif std::string fname = (const char*)fn.toUtf8(); openCommand("Render project"); int width = hGrp->GetInt("OutputWidth", 800); @@ -628,7 +637,12 @@ void CmdRaytracingRender::activated(int iMsg) doCommand(Doc,"f = open(TempFile,'wb')"); doCommand(Doc,"f.write(PageFile.read())"); 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()); +#endif doCommand(Gui,"import ImageGui"); doCommand(Gui,"ImageGui.open('%s')",fname.c_str()); doCommand(Doc,"del TempFile,PageFile");