I have a scene with hundreds of objects and materials. Some are with transparent masks (like leaves) and the other's none. Now I have a new material node setup and want to replace the "color" part of all the materials with this new setup while keep their transparent masks the same. I have try the materials option in RenderLayer but that does not work since the new material should not override the transparency mask of each object. I am thinking of writing a script, but do not know how and where to start.
If it is possible, can we automate the rendering pipeline to render the scene once with the original materials and once with the new one? Bash script is more desirable.