Bug in Object.getMaterials() function?

Hi guys,

I think there might be a problem with the getMaterials() function of the Object class. I have a very simple scene that contains a single cube which has a single material called “material” and when I call the getMaterials() function on this particular object, most times I just get an empty list back when there should be at least 1 material object in the list.

The example blender file can be downloaded from:


When I use alt-P execute the script, I just get an empty list back which shouldn’t be right.

Could anyone tell me what I’m doing wrong?

Thanks a lot.


Try ob.getData(mesh=1).materials by default blender uses ObjectData materials, not object materials.

ah, that works, thanks so much!! :smiley: