I use simple python snippets to replicate the light pass manager (LPM) script's behaviour for 3dsmax link.
LPM in 3dsmax basically just runs a pre_render script that applies overrides and then renders.
Blender can do the same thing with
It works alright, but there is one essential thing that doesnt work as I expected it:
-in 3dsmax, the pre_render_script is only run on the data that is sent to the renderer. The scene in front of the user is unchanged.
-in Blender, the pre_render_script is run on the scene before it is sent to the renderer. Therefore, after rendering, the scene in the viewport has all changes applied and the original state of the scene is lost.
I dont want to write scripts that record the whole state of the scene so it can be rebuilt post render. It is error-prone, needs to be maintained, I am a python noob and besides that, Blender has all the data already stored in the file.
My workaround right now
start the render as a subprocess and run the python script that sets the overrides:
render_cmd = '''\ gnome-terminal -- /usr/bin/blender -b %s --python %s -S Scene -s 1 -e 1 -a ''' % (fname, render_prep_script_name) subprocess.call(render_cmd.split())
This is not bad, I can work with that. But I have to wait for the renderer to save the output image before I can see it. So I am wondering, should the behaviour of the render_pre handler not be different?