jonhed
(jonhed)
1
Hi,
I have a scene where I want to evaluate different prints on an object. What I want to do is write some kind of script or just execute a command that:
- Renders and saves the first image.
- Changes the texture on the material
- Renders next image
- … and so on.
I figure this must be fairly simple and would save me a lot of time.
So the question is, how do I make this happen?
/Jonatan
import bpy
import os
scene=bpy.context.scene
dir_path,filename=os.path.split(scene.render.filepath)
slot=0
mat=bpy.data.materials['yourMaterial']
texture_strings=(
'yourTexture.000',
'yourTexture.001'
#...
)
for i,id in enumerate(texture_strings):
texture=bpy.data.textures[id]
mat.texture_slots[slot].texture=texture
scene.render.filepath=os.path.join(dir_path,filename+"%#03d"%i)
bpy.ops.render.render(write_still=True)
#restore
scene.render.filepath=os.path.join(dir_path,filename)