I'd like to print all materials' and it's textures' names with this script:
for ob in bpy.data.objects:
if ob.type == "MESH":
for mat_slot in ob.material_slots:
if mat_slot.material:
if mat_slot.material.node_tree:
print("material:" + str(mat_slot.material.node_tree.name))
for x in mat_slot.material.node_tree.nodes:
if x.type=='TEX_IMAGE':
print(" texture: "+str(x.name))
But the output is just general names like this:
material:Shader Nodetree
texture: Image Texture
material:Shader Nodetree
texture: Image Texture
material:Shader Nodetree
texture: Image Texture
So, how can I get the textures' file names like 'pic.png'?