Materials question.

What do I do if I want to get the name of the Material (a string) assigned to given object?

I have tried to use getMaterials() but that seems to output a list holding no elements.

Can anyone please help me?


In 2.32 You can try this:

Mesh = Object.getData()
MatList = Mesh.materials

Hope that helps. :smiley:

Thanks! :smiley: :smiley:

mesh.materials will be a list- if you want the name as a string youll need to pick a material and then get the name

mesh = Object.getData() 
for mat in mesh.amterials:
  print mat.getName()