[英]Assigning a material in Blender with a script
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) 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.
当我获取一个具有材质的对象并在其上调用 getMaterial 函数时,它不会返回任何内容。 there is something I'm missing here, can some one shed some light on it?
我在这里遗漏了一些东西,有人可以解释一下吗? Thanks.
谢谢。
~TA ~TA
objectName.setMaterials([materials]) --- forgot that little "s". objectName.setMaterials([materials]) --- 忘记了那个小“s”。
Where the argument to setMaterials is a list of 16 items or less, all of which must be Materials or None. setMaterials 的参数是一个包含 16 个或更少的项目的列表,所有这些项目都必须是 Materials 或 None。
http://www.zoo-logique.org/3D.Blender/scripts_python/API/Object.Object-class.html http://www.zoo-logique.org/3D.Blender/scripts_python/API/Object.Object-class.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.