To run this script open blender, add a cube object and select it.Copy and paste these codes into you text editor and run it to add a material to the cube. Here Red material(color) is added to the Cube.
-------------------------------------------------------------------------------------------------------------------------------
import bpy
mat_red=bpy.data.materials.new("red")
mat_red.diffuse_color=(0.8, 0, 0)
mesh=bpy.context.object.data
mesh.materials.clear()
mesh.materials.append(mat_red)
-------------------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment