Assigning a material in Blender with a script

Posted by Narcolapser on Stack Overflow See other posts from Stack Overflow or by Narcolapser
Published on 2010-06-11T21:56:12Z Indexed on 2010/06/12 5:42 UTC
Read the original article Hit count: 268

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about python

Related posts about scripting