Reputation: 99
Trying to run this code in the main function of a console app in QT but it only starts up the Blender GUI. These arguments should be starting a background render.
I tested the arguments to be correct and they work fine on CMD. This seems to be a blender specific issue but I might be wrong. It seems as though, using QProcess it doesn't allow for Blender to use the arguments. It launches the app without passing any arguments.
QProcess myProcess;
QString blender = "C:/Program Files/Blender Foundation/Blender/blender.exe";
QStringList arguments;
arguments << "blender" << "-b" << "E:/my/file.blend" << "-o" << " E:/my/output/folder/"<< "-a";
myProcess.start(blender,arguments);
Edit:
So browsing through SO, I found something that's working but this isn't using the QT functionality. I'd rather find the QT way of doing this. What it's essentially doing is running CMD and launching blender through the CMD. Is there a way I can do this using QT?
QDir::setCurrent(blender);
system("blender -b E:\\Blender\\BlendSwap\\55510_Ciclos_Town_-_10_Male_Characters\\cidade_ciclos-bonecos.blend -o E:\\Blender\\BlendSwap\\55510_Ciclos_Town_-_10_Male_Characters\\exp\\frame_### -a");
Upvotes: 0
Views: 674
Reputation: 99
Thanks for @MaxGo and @G.M. because they set me on the right path.
Two things: First off, tt's true that using the "blender" flag was one of the issues. I can't launch the .exe file and also expect blender to take in the arguments.
Second, start() will not work, you do need to use startDetached or execute() for it to work.
Below is the final code to make this launch correctly.
QDir::setCurrent(blenderDirectory);
myProcess.startDetached("blender -b " + projectPath + " -o " + projectOutput + " -a");
Upvotes: 1