I asked in the Animation Support Forum how to animate ambient light color using python, but I received no replies. I don’t know if this is the appropriate forum to ask this question, but since it is the only forum pertaining to python, I am posting my question here.
Blender does not appear to have built-in animation for ambient light. I noticed that the other world settings can be animated, but not ambient light. I am not familiar with Python. I’ve done some programming in Visual Basic, Pascal, and such, so I think I can pick up Python with some assistance. Is there a way to animate ambient light using Python?
You should be able to do it with a script link. You can even create a dummy IPO block and read values off of it if you want that (i.e. you have more than a couple of colors/want smooth transitions/etc.).
See the world module here, and look at the setAmb() function.
Thank you - I will give that a shot! I’ve never touched Python before - a couple questions. I keep seeing this “import Blender” command - is this a must for Python programming in Blender? Does this import Blender functions? I guess I’m a little ignorant with this style of programming.
Grogyan: Are you saying use the lamps instead of the ambient light? If so - I’m considering that. However, I do like the lighting I’ve got set with the Ambient, and for future use I’d like to be able to animate ambient.
Yes, because the colour of them are animateable, where as world colour maynotbe what you want, and you can set different colours for different areas of the same world.
There is also some World IPO blocks that may be helpful if you are wanting to only do the entire world.
Just read the API section about IPO’s, that is the section i’m working on for something else unrelated to lamp colours
Grogyan: Are you saying use the lamps instead of the ambient light? If so - I’m considering that. However, I do like the lighting I’ve got set with the Ambient, and for future use I’d like to be able to animate ambient.
Yes, and more including #!bpy at the very top of your script, otherwise it won’t work, you can open any script that comes with Blender to see what they do.
and if your like me and never used python before, just use the text editor in Blender to do simple stuff like Hello world and build up from there and get user input from the API’s
I am using the Game Engine and I am trying to turn on and off a lamp (spotlight).
Setting it to invisible in the Logic Bricks doesn’t do anything.
I’ve tried using Parenting - end up messing the orientations and some light can be found
I’ve tried Ending the Object “End Object” which is not working.
Now, my question is, what is the property or class in python that controls the Lamps?
I would like to change the Energy Level, Density and Color.