Rendering with a different texture filename using the texture node without manually changing the filename each time.
I have several different texture files that i want to render out using the same node group setup and blender file. is it possible to automate the renders but use a different texture filename in the texture node group? I know about doing a render from the terminal.
Example of rendering from the terminal below:
#Render animation in EEVEE from frame 0 to 100 from terminal in Linux
/snap/bin/blender -b /home/jp/Documents/My\ Documents/blender/texture_test.blend -E BLENDER_EEVEE -o /tmp/frame_eevee_##### -s 0 -e 100 -t 1 -a; espeak 'done with eevee render animation'
An example of what I'm trying to do is
- I have a node group in a blender file that has several image files that I want to render using the same node group and blender file. I have a list of files
p1.png, p2.png, file_texture.png, block_text.png, etc...and each time it renders I want it to loop through and replace the texture image node filename and render the next file in the list. See red arrow where I want the filename to be replaced after each render is complete. Is this possible?
Added Chris's python code and attached blend file:
import bpy
import glob
import os
print ("Script start")
scn = bpy.context.scene
# here = bpy.path.abspath('//Tex_tures')
here = bpy.path.abspath('/tmp/tex_tures')
output_path = scn.render.filepath
for eachFile in glob.glob(os.path.join(here, '*.png')):
print(eachFile)
fileName = bpy.path.basename(eachFile)
print(fileName)
fileNameStart = os.path.splitext(fileName)[0]
print("start:", fileNameStart)
#bpy.data.images['0063.png'].filepath = eachFile # change this to you texture name
bpy.data.images[fileName].filepath = eachFile # change this to you texture name
directory = os.path.join(here, fileNameStart)
print("directory", directory)
if not os.path.exists(directory):
os.makedirs(directory)
scn.render.filepath = os.path.join(directory,"")
bpy.ops.render.render(animation=True)
bpy.context.area.ui_type = 'TEXT_EDITOR'
Upload tex_tures file locations:
Error it gives if Line 23 in the python code is added:
Script start
/tmp/tex_tures/2plantpic_test.png
2plantpic_test.png
start: 2plantpic_test
Traceback (most recent call last):
File "/home/rt/Downloads/0-del for questions tmp/blender q/multi_render_tetures.blend/multi_render", line 23, in <module>
KeyError: 'bpy_prop_collection[key]: key "2plantpic_test.png" not found'
Error: Python script failed, check the message in the system console



