1

I'm trying to add a Image Texture node, so when I bake textures it is saved to a specific file:

import bpy

context = bpy.context

scn = bpy.context.scene scn.render.engine = 'CYCLES' scn.world.use_nodes = True

bpy.ops.mesh.primitive_plane_add(size=20, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) new_floor_mat = bpy.data.materials.new("Floor") bpy.ops.node.add_node(type="ShaderNodeTexImage", use_transform=True) new_floor_mat.use_nodes = True print(new_floor_mat.name) bpy.ops.object.material_slot_add() context.object.active_material = new_floor_mat bpy.context.scene.unit_settings.scale_length = 1

bpy.ops.node.add_node(type="ShaderNodeTexImage", use_transform=True)

My code is failing for some reason and I'm not sure why.

Q: How to add an Image Texture node to a certain material?

0 Answers0