Cannot retrieve diffuse values from material, maybe I found a BUG?

Hello there.

I’m trying to get diffuse values from a material, the problematic part of my script is:

print mat
print mat.material
print mat.specular
print mat.diffuse
print mat.shininess
print mat.drawingmode

That outputs:

[0.5, 0.5, 0.5]


It just leaves a blank line where i expected to see a list [rgb] of the material diff values.
All the other values are retrieved correctly.

Am i doing sumpin wrong, or i just found a bug?

Thanks in advance.

What steps are you taking to get KX_MeshProxy.materials (or KX_PolyProxy.getMaterial(), whichever it may be) to return KX_PolygonMaterial types instead of KX_BlenderMaterial types? The documentation says that materials can be either type, but gives no explanation of which type returns under which circumstances. I keep getting “AttributeError: ‘KX_BlenderMaterial’ object has no attribute ‘diffuse’” in the terminal.

I don’t have a lot of experience with this area, so a simplified example .blend would help tremendously.

(Also, which version of Blender are you using?)

Hello guy.

Are you using “texture face materials”? Don’t know why, but it doesn’t work with “blender multitexture materials” or GLSL. Fortunately, i don’t need any advanced material setting.

There’s a little demo attached.



demo.blend (127 KB)

Thanks Blendenzo, however, i just found a nice workaround that works for me:

getVertex( 0, 0).colour

It returns the colour of the material (if no vertex colour is set i believe)

So, my problem is solved. Thank you.

Good to hear that you found a workaround. As a bonus, that solution would probably work in Texture Face, MultiMaterial and GLSL.

I did test your demo in a recent SVN build, and the bug still exists. I have reported the bug to the tracker here: