[Bf-committers] Python materials from objects

Martijn Houtman bf-committers@blender.org
Wed, 22 Oct 2003 00:04:38 +0200

On Wednesday 22 October 2003 21:24, Stephen Swaney wrote:
> Materials can be linked to either the Object or the ObData.
> There is a setting for this in the User Preferences window.
> I believe the default is to link to the ObData.

Ok, thanks. That helped. For those wondering:

mesh = object.getData()
if len(mesh.materials) > 0:
    materials = mesh.materials
    materials = object.getMaterials()

this will get the materials, either linked to objects or to object-data.

With kind regards,