Trying to set mesh object colour with a script not working

I make a script in which an object changes colour, but when I hit P, the object does not change colour. If I use lamp.color = [‘1,0,0,0’], the lamp will change its light colour to red. If I write the same code to apply to the object however (with full alpha opacity), it will just stay the same as the colour was in the viewport as if nothing happened. The script clearly works, but why is this happening? I feel its a bug.

Has anyone else had this bug? I am using Blender 2.79b for Mac.

@WhiteRoses54

The reason your scrip works on lamps but not objects is because lamps don’t have meshes.

So make sure to click the Object Color Option in materials.

This is a common mistake btw :wink:

[ EDIT ]
If you need a blend file to help you understand I would be more then happy to help :slight_smile:

lamps use only three values (r,g,b) for the color.

btw, the fourth is alpha which 1 is fully present, 0 is transparent.

1 Like