Script for render many different material on one object

    I am new in Blender and i have only small experiences in scripting.  But I would like to ask somebody for one thing. I have one object a  would like to render it with many different external pictures like a  surface of the object and every render save separately. I have no idea  how can the sript look like. Some idea?

Thanks
Honza

Moved from “General Forums > Latest News” to “Coding > Python Support”


import bpy

folder = bpy.data.render.filepath

bpy.context.scene.start_frame = 1
bpy.context.scene.end_frame = 1

for a in bpy.data.materials:
    bpy.data.objects['Cube'].material_slots[0].material = a
    bpy.context.scene.render.filepath = folder + '/' + a.name +'.jpg'
    bpy.ops.render.render(animation=True)

Something along those lines. Havent tested it but