[Bf-committers] Python materials from objects

Stephen Swaney bf-committers@blender.org
Wed, 22 Oct 2003 14:24:45 -0500

Martijn Houtman wrote:
> Hello list,
> I was making (actually editing) a povray export script, because mostdo not
> work with Blender 2.28 due to some Python structure changes (I guess?).
> I was trying to get the material from an object in a way similar to this:
> for object in Blender.Object.Get():
>     print len(object.getMaterials())
> Now this constantly prints 0 (zero). I might have to try older blender
> versions, but it still doesn't change the fact it doesn't work in 2.28.
> Can anyone confirm this issue, and maybe name some workaround for me to use,
> until this is fixed (maybe, very maybe, I find the time to try and fix it
> myself, but still) ?

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.

Stephen Swaney