In Blender/Python 2.8, I have added an image texture to an object. The object is very wide which causes the image texture to stretch whereas I would like it to repeat.
The documentation (under "extension") seems to suggest that the default setting is for the texture to repeat rather than to stretch. I would assume that because I am using the default that the texture would repeat rather than stretch.
Any suggestions as to how to prevent stretch in my code would be appreciated. Thanks in advance!
def obj_texture(objname, filename, mat_name): materials = bpy.data.materials material = materials.get(mat_name) if not material: material = materials.new(mat_name) clear_material(material) material.use_nodes = True nodes = material.node_tree.nodes links = material.node_tree.links output = nodes.new(type = 'ShaderNodeOutputMaterial' ) diffuse = nodes.new(type = 'ShaderNodeBsdfDiffuse' ) path=TextureFolder+filename imgTex = bpy.data.images.load(path) node_texture = nodes.new(type='ShaderNodeTexImage') node_texture.image = imgTex node_texture.location = 0,200 tex_coord = nodes.new(type = 'ShaderNodeTexCoord') #NEW CODE @RJG links = material.node_tree.links link=links.new(tex_coord.outputs["Generated"], node_texture.inputs["Vector"]) #NEW CODE @RJG link = links.new(node_texture.outputs, nodes.get('Diffuse BSDF').inputs) link = links.new( diffuse.outputs['BSDF'], output.inputs['Surface'] ) obj=bpy.data.objects[objname] obj.active_material=material