[Bf-python] mesh.faces[n], mesh.materials[n] ... putting them together

Lone Wolf lone_wolf at ureach.com
Fri Apr 16 00:00:01 CEST 2004


Please forgive me for asking such a simple questions ... but
I've looked all through the python API documention for 2.32,
looked in the bf archives, looked on elysiun, googled ... you
name it ...

All I am trying to do is assign a specific material (color) to a
specific face in a multiface mesh. I know that I can get a list
of faces from   mesh.faces[n]  , and I can get a list of
materials from   mesh.materials[n],   but I can't assign a
material to a specific face.

I'm working with a simple cube. Here is the code:

import Blender
from Blender import NMesh, Material

me=NMesh.GetRaw('Cube')

mat1=Material.New('red')
mat1.setRGBCol(1,0,0)
me.addMaterial(mat1)
print len(me.materials)

# I think that material assignment for a face should go here

me.update()

Blender.Redraw()

I'm sure the assignment would only take a few lines in python,
but I can't make it work. Could someone PLEASE spare a minute to
help?

Thanks :)


________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag



More information about the Bf-python mailing list