Setting active material with script

Hey all.

I am trying to construct a scene entirely with a python script. I created a scene, camera, some lights, a mesh, and a material. Then I linked these to the scene, the mesh to an object, and added the material to the object. (I am not sure if it would be better to add the material to the mesh though.)

Unfortunately, it doesn’t render anything. If I put a plane in the back ground, I can “see” the object, but it has no color.

Any ideas?

Thanks
Squirrel

Try adding the material to the mesh instead.

Martin

Hey , I’m facing the same problem as u r, squirrel…
I even added material to mesh directly, theeth, but alas it didn’t work… :frowning:

Though it adds material in the List but not to the mesh.I mean there is no effedt seen on the rendered image.
What to do?
Any ideas?

Hey all. I got it to work if I added the material to the mesh. If you have something like this:

aMesh = NMesh.GetRaw(“meshName”)

then add the material to aMesh, like so:

aMesh.addMaterial( theMaterial )

Hope that helps

Squirrel