I did the following steps to create a new material and link it to the object:
- Select an object.
- In Button window (at bottom) select 'Shading' (a gray ball) and then 'Material buttons' (red ball)
- In 'Link and pipeline', press 'Add new'.
- Edit material color ('Col').
I want to change the color randomly using this script:
from random import random
import Blender
from Blender import *
scn = Blender.Scene.GetCurrent()
ob = scn.objects.active
m = ob.getData(mesh=True)
if(len(m.materials) < 1):
mat = Material.New('newMat')
m.materials += [mat] m.materials[0].rgbCol = [random(), random(), random()]
Blender.Redraw()
Why doesn't the color of the object change?