So I'm pretty much done with designing a script to export meshes I (or others within my group) make in Blender for use in another piece of software (VoxelStudio).
Everything has been slow going due to a serious lack of documentation/examples, but I have to say these forums have been a god send, thank you people.
The one last part that's really stopping me from actually finishing the script is working out how to get the ID number of the Texture that's applied to a given material on a given Face.
I can get the active material easily enough.... though that took trawling everywhere to work out how. How do I get the active materials active texture for the current face?
for i in context.selected_objects:
tempmesh = bmesh.new( )
tempmesh.from_mesh( i.data )
for f in tempmesh.faces:
mat = i.material_slots[f.material_index].material
writeString ( file, '%i\r\n' % ( f.material_index ) )
You can see that I've got the material index easily enough, and the material itself is held in 'mat' within the 'for f' loop. However, the method of working out what the texture index of the current face is still eludes me.
The model is set up with different Materials having multiple textures assigned, each for different purposes. Just no idea how to ask, what texture is showing on this material on that face.