I am trying to solve the following problem:
I have several models, each with it's own material. But all of these materials share a nodegroup. These models are on RenderLayer 1 and Renderlayer 2.
I want to render RenderLayer 1, then change a mix node in the material from 0 to 1, then render RenderLayer 2.
Currently, I can do this through the compositor by manually hitting render on one layer, then manually changing the mix node, and then manually rendering the other layer. But I'm looking for a way to automate it, as I am working with complex projects with many layers and scenes, and I want to be able to batch render via the command line.
I have looked into using a driver on the mix node as a solution, but there doesn't seem to be any value that changes when a new layer is being rendered, so there's nothing to drive it.
It should be possible to make a macro script of some sort that will render one layer, change the material, and then render the other. But this won't work with batch rendering.
So what I'm trying to find out is if there's some solution that can be implemented either by running a script or as an addon, that could let the renderer change a number that I can then use as a driver within the material. Does anything like this exist? Or can anyone propose an alternate solution?
(Note: I am aware that it's possible to use instanced models or scenes to solve this problem via a different method, but all of those require a ton of manual setup which gets really time consuming.)