Can someone teach me how to load a videoclip and set it to a image texture node using python?
My script loads a video and make a material; then it tries to put that video in an image texture node, also created by python.
My code fragment is below. This is the error that I get:
TypeError: bpy_struct: item.attr = val: ShaderNodeTexImage.image expected a Image type, not MovieClip
Error: Python script failed, check the message in the system console
I understand that image texture nodes can't handle a movieclip; but then what node do I have to use?
texcord = nodes.new('ShaderNodeTexCoord')
mapping = nodes.new('ShaderNodeMapping')
teximg = nodes.new('ShaderNodeTexImage')
bsdf = nodes.new('ShaderNodeBsdfPrincipled')
out = nodes.new('ShaderNodeOutputMaterial')
global nombre_vid
#nodes['Movie Clip'].clip = nombre_vid
tree.links.new(texcord.outputs[2], mapping.inputs[0])
tree.links.new(mapping.outputs[0], teximg.inputs[0])
tree.links.new(teximg.outputs[0], bsdf.inputs[0])
tree.links.new(bsdf.outputs[0], out.inputs[0])
bsdf.inputs[7].default_value = mat_roughness
bsdf.inputs[4].default_value = mat_metallic
global vid
teximg.image = vid # vid is the video saved as a global var , not just the name