simple scene script - question

i’m new to python within blender, but do know the basics of python outside blender.

does anyone know how to write a script to create three lamps based on the position of the camera?

thanx

-theblenderboy

Get yourself a copy of the python documentation at blender.org
It has all the functions you need in it.

A little tip of the veil lifted… this is how you create an empty:


object = Blender.Object.New('Empty')
object.setName("myempty")
object.setLocation(0,0,0);

You can do pretty much the same with lamp objects… though you’ll want to set it’s type as well and perhaps the rotation.

Getting the camera and it’s location isn’t too hard either… then you can apply that in the setlocation when creating the new lamp.

Done forget you need to link new data to your scene.
also- object is a python keyword, so best not use it.


ob = Blender.Object.New('Empty')
ob.setName("myempty")
ob.setLocation(0,0,0);
scn= Scene.GetCurrent()
scn.link(ob)
ob.sel= 1