Solution: assign face.material_index for each face too.
I’m writing a 3d format importer and the model file contains the texture data. I generate a Texture object from the data and assign it to a Material I created, but I can’t see the texture in the 3d view (if I enable “Textured” mode), only when I render a frame.
What am I doing wrong?
relevant parts of the code (simplified):
texture = bpy.data.textures.new('name', type = 'IMAGE') texture.image = image texture.use_alpha = True material = bpy.data.materials.new('name') mtex = material.texture_slots.add() mtex.texture = texture mtex.texture_coords = 'UV'