1

What causes, in the script below, the error given in the title?

if mat.texture_slots[0] == None:
    tex = target_object.material.texture_slots.add()

    tex.texture = bpy.data.texture.new(target_object.name, type='IMAGE')

    tex.texture_coords = 'UV'
# target_object.texture = bpy.ops.texture.new()

    new_image = bpy.data.images.load(image_filename)
Lukasz-40sth
  • 3,062
  • 7
  • 19
  • 30
jow
  • 11
  • 1
  • 3

1 Answers1

1

Material.texture_slots is only available for blender internal render.

How to add a Texture to a Material using Python?

batFINGER
  • 84,216
  • 10
  • 108
  • 233
  • I'm getting this in the effort to create an old importing plugin for 2.8. Thank you for the pointer. I know nothing about Blender internals. This is the ultimate "just in time learning" project!! – Bob Denny May 01 '20 at 00:03