I am trying to assign an image texture to an Image Texture node in 2.80. Very simple script - I'm just starting to learn how this stuff works.
This is what I have. It creates an image and and IT node, but it doesn't assign the one to other. Can anybody help? I've searched around, but can't find it in another question.
import bpy #create blank image bpy.ops.image.new(name="TestImg", width=1024, height=1024) #add image texture to object, to hold baked lighting mat = bpy.context.view_layer.objects.active.active_material image_node = mat.node_tree.nodes.new('ShaderNodeTexImage') #assign image to image texture node image_node.image = "TestImg"
Thanks in advance.