I'm trying to get information from a Blend File, but I've just hit a wall.
We are referring to Blender Internal Render. Not Cycles Render.
I'm new to Blender basically, so I really don't have a clue of neither scripting or Python whatsoever, so I really don't have a clue of what do I have access or what can or can't do via Python scripts on Blender, so I was thinking: Is it possible to take the material information from a Blend file or from within Blender, specifically, what files they are using?
In this example, thanks to Blender, I know the files the Metal material is using are these, but is there a way to output, let's say:
Metal: - nomad_a1_diff.tga - nomad_a1_norm.tga - enviroment.png
And this, with all materials? Thank you in advance!
EDIT
What I'm basically trying to get is this
- Name of any materials of a mesh.
- Listing the textures of that single material.
Example
Material: Metal Textures of the Material Metal: nomad_a1_diff.tga, nomad_a1_norm.tga, enviroment.png
These three are the materials for that Metal material on the image.
I want to do this with every material on the model. Thanks to this script, I've got the name of all the materials, however, instead of listing all the textures per material, it lists all the textures of the model, I don't need that.
UPDATE
Thanks to atomicbezierslinger for the script, he helped me to get a step on the right direction!
I've run your script, but it gives me just the name of the textures. I've done some research and found a function called bpy.data.materials so I decided to add it to the script and now it looks like this
import bpy
import datetime
def inspect_textures():
for t in bpy.data.materials:
print(t.name)
for t in bpy.data.textures:
if isinstance(t, bpy.types.ImageTexture) and hasattr(t,'image'):
x = t.image
if hasattr(x,'filepath'):
print(t.name, type(t),t.image.filepath)
else:
print(t.name, type(t), "?")
inspect_textures()
This is the output from the code above. Now it gives the name of the material and the name of all the textures of the model, when all what I need is the texture names of the specific materials, is there something else it can be done or does it need another import? Thanks so far for the help!