It seems to be easy but as a beginner, I can not configure it.
I have four blocks with different images. I add all four images using Images as Planes. Now I want to replace all four images with different images running script.
It seems to be easy but as a beginner, I can not configure it.
I have four blocks with different images. I add all four images using Images as Planes. Now I want to replace all four images with different images running script.
import bpy
mats = bpy.data.materials # all materials store in here
mat = mats["your Material"] # get a material
tree = mat.node_tree # get node tree of the material
nodes = tree.nodes # all nodes in node_tree
for node in nodes:
if node.type == "TEX_IMAGE":
print(node.name)
node = nodes["Image Texture"] # get node by name of node
imgs = bpy.data.images # all image in blend file
img = imgs["your img name"] # get a image
node.image = img # change image in node
node.image = None # change image to None
I suggest you try to use a video texture. if you encode with ffmpeg video and choose the webm encoder and setup trasnparency in the film render setting, the video can have transparency.