import bpy base_collection = bpy.data.scenes["Base"].view_layers["RenderLayer"].layer_collection highlight_collection = bpy.data.scenes["Toon Highlight"].view_layers["RenderLayer"].layer_collection shadows_collection = bpy.data.scenes["Toon Shadows"].view_layers["RenderLayer"].layer_collection def set_exclude(color, model, value): base_collection.children[color].exclude = value highlight_collection.children[f"Highlight {model}"].exclude = value shadows_collection.children[f"Shadows {model}"].exclude = value def render_bottle(color, model, output): set_exclude(color, model, False) bpy.data.scenes["Base"].render.filepath = output bpy.ops.render.render(write_still=True) set_exclude(color, model, True) bottles = [ ["Red", "Cone", "//src/graphics/red.png"], ["Green", "Cube", "//src/graphics/green.png"], ["Black", "Spiked", "//src/graphics/black.png"], ["Cyan", "Sphere", "//src/graphics/cyan.png"], ["Purple", "Cylinder", "//src/graphics/purple.png"], ["Yellow", "Hexagon", "//src/graphics/yellow.png"], ["White", "Tubes", "//src/graphics/white.png"], ] # Set active scene so the highlights/shadows isn't accidentally rendered bpy.context.window.scene = bpy.data.scenes["Base"] # Reset visibility of all bottles for color, model, output in bottles: set_exclude(color, model, True) # Render the bottles for color, model, output in bottles: render_bottle(color, model, output) print("Done!")