1

I am trying to render a scene where I run a script with given parameters and then render the animation by passing parameters to the blender executable through the command line.

Given the following example for the command passed:

blender <file_path> -P <python_script> -- <input_parameters> --frame-start <num> --frame-end <num> -a

When executed it does not render and I presume it treats what ever is after the '--' as parameters for the python script. I am aware that I can pass these parameters and use the Blender API in the python script to render the scene with these parameters but for my case this does not suit.

Sam
  • 111
  • 1
  • 10
  • 1
    The double dash is treated as end of command options, meaning that you can only pass positional parameters afterwards. – Robert Gützkow Apr 16 '20 at 16:13
  • @batFINGER This is specifically about passing parameters to a script and rendering. The linked question does not answer this. – Ray Mairlot Apr 16 '20 at 17:28
  • 1
    If the question is about passing parameters to a python script to create commandline then it belongs on stackoverflow et al. . First dupe explains examples of a command to create. (ie pass the blender render arguments before -- ) Second dupe covers passing args to the script in the command. ie the question of what comes after -- If the OP can explain why neither of these cases suit then reopen by all means. But for now I vote to close and stand by it. – batFINGER Apr 16 '20 at 17:45
  • @batFINGER But neither addresses how to do both at the same time, which is what is stated in the question. – Ray Mairlot Apr 16 '20 at 18:01
  • @RayMairlot Would you say your first comment above is at odds with last paragraph of question?. Will wait on more info from OP. If no API methods are required then prob no script needed after -P and simply wants to create the CL from a script passing frame num etc..basically going around in circles to my prior comment. Quite possibly answer is put -- <input_parameters> last .. covered by dupe and RJG comment. – batFINGER Apr 16 '20 at 18:16
  • I am saving these python scripts in order to be able to reproduce the exact state the scene was in before rendering. I do not wish to have something that sets the start/end frame of the animation at the end of these scripts as someone may not want to render anything but observe the state of the scene and test. A work around is possible by passing a second script that will do the rendering but I was wondering if there was a way to avoid the second script being needed. – Sam Apr 16 '20 at 18:29
  • 1
    First dupe (now removed) shows how to render form command line. Does not change blender file at all. Please edit question to avoid confusion what are the states users wish to observe in background mode.? Give example of script and actual command line. Re second script being needed what is the first script? – batFINGER Apr 17 '20 at 04:13
  • 1
    See https://blender.stackexchange.com/questions/131052/how-to-render-in-command-line and https://blender.stackexchange.com/questions/6817/how-to-pass-command-line-arguments-to-a-blender-python-script The location of -- in command matters. – batFINGER Apr 17 '20 at 04:28
  • The first python script changes camera configuration, generates a node tree in the compositor, new render layers, material override, sets render settings and more. The idea is this script is generated dynamically and passed in the command line to render the images in background mode. But this saved script could be used independently to recreate the exact environment as the renders. – Sam Apr 17 '20 at 12:49

0 Answers0