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

Willian Padovani Germano wgermano at ig.com.br
Fri Apr 16 11:27:27 CEST 2004


Hi,

----- Original Message -----
From: "Lone Wolf" <lone_wolf at ureach.com>
To: <bf-python at blender.org>
Sent: Thursday, April 15, 2004 7:00 PM
Subject: [Bf-python] mesh.faces[n], mesh.materials[n] ... putting them
together

(...)
> All I am trying to do is assign a specific material (color) to a
> specific face in a multiface mesh.

> 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

# This will assign the last material to the first face:

mat_index = len(me.materials) - 1 # -1 since it starts on zero
f = me.faces[0]
f.mat = mat_index # f.mat is the same as f.materialIndex

# so what you do is set the material index in me.materials list to
face.mat

> me.update()

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list