Question

Question: How do you assign a material with a script to an object in blender?


Info:

I have this script to import a proprietary model type of mine that is basically a star map with object consisting of a single vertex. in order to make them look like stars and be visible they are all going to have a halo material assigned to them. I'm figuring out how to make this material and give it the values just fine, but I can't seem to get it to assign. I tried the most obvious thing which was:

objectName.setMaterial(materialName)

but that did nothing. and when i would take an object that had a material and call the getMaterial function on it, it would return nothing. there is something I'm missing here, can some one shed some light on it? Thanks.

~TA

Was it helpful?

Solution

objectName.setMaterials([materials]) --- forgot that little "s".

Where the argument to setMaterials is a list of 16 items or less, all of which must be Materials or None.

http://www.zoo-logique.org/3D.Blender/scripts_python/API/Object.Object-class.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top