Hi,
I need to apply material to various Meshes that I have managed to program Blender to construct.
mesh.addMaterial() would have been what I wanted, but it appears to be broken.
Can you add Textures and patterns to meshes/faces?
Can you control colour/emit parameters?
many thanks,
Rink
I just posted the same question on elysiun.
The answer is from illian Padovani Germano <wgermano@ig.com.br> (now a Major Dude in my books)
Hi, your email was forwarded to me by Michel
.addMaterial() is a Mesh function, not NMesh. With NMesh the
materials
list is in the nmesh member var .materials.
This should work:
#------------------------------------------------
import Blender
from Blender import Material, NMesh
m = material.New("newmat")
m.rgbCol = (1.0, 0.0, 0.3)
me = NMesh.GetRaw("Plane") # considering the default plane
me.materials.append(m) # here is the way to assign materials in NMesh
# now to put this mesh on a new object:
newme = NMesh.PutRaw(me, "newPlane")
# or to simply update the "Plane" mesh, comment the line
above and
# uncomment this one:
# me.update()
#-------------------------------------------------
Any problem, feel free to email me or the bf-python list (where you
need
to be a member to be able to send emails):
http://www.blender.org/mailman/listinfo/bf-python