Hi sprinkles, I gave you a poke on icq, just look the newcommer list.
then you’ll be able to ask me question when you need to.
Right now i can tell you:
Look in the doc. in each module you have classe, function, maybe variable.Each module has function to mainly to let you manage module data. The module data is most of the time classes. of if you prefer: object.
When you do I = Lamp.New(‘Spot’), you ask the lamp module to generate a lamp object and save it in the I variable. this variable is a pointer to data in blender: the lamp you just created. This data can be manipulated with the I variable you just wraped the data in, because this “wrap” give you tools too interact with blender data. I is a copy of the lamp class section of doc. So you can do l.setMode(‘square’, ‘shadow’) and the lamp you created will be modified.
Now the "Object.new(‘lamp’) trick is simple. You’ll notice that if you do the code as is, your lamp will not appear in the 3Dview. That because you have to understand that you are still bounded by the system you work with, here blender data manager system. Remeber the outliner, the OOPS view, the dropdown for material and object? There if you look closely, you’ll notice that first there is a lamp and this lamp is then linked to and object. Some for mesh: first you have a mesh, which is linked to an object. So the what you have to know about that is: an object is an universal container. The 3dview only show object you know
. So if you want to put you lamp in a particular scene at a given position, you’ll have to work with the object. Because the lamp module only containe data concerning lamp and the object contain all the rest of the info: position, rotation, size, scene, layer, name, etc… This system give us the power to switch data and still keep the same object, with the dropdown menu you can choose an other mesh in the list and switch. Same for material look closely in the material button window. You have the ability to link the material data to the object or the mesh data. The main difference is if you link the material to the object and then switch the mesh object to something else, the object will still has is material. And if you link against the mesh itself, it will follow the mesh you just dropped, of course.
Just take a peek in the OOPS and enable all drawing option to know what you’r working on. Object or data.
Here what you talked. This little script will generate a lamp data and link it to a new object postitionned at (10,0,0). it will then place it in the current Scene. if you look at the OOPS you’ll see that these links are all needed to get a working lamp you can see in your screen:
import Blender
from Blender import Lamp, Object, Scene
I = Lamp.New("Spot")
ob = Object.New("Lamp")
ob.link(I)
sce = Scene.GetCurrent()
sce.link(ob)
ob.setLocation(10,0,0)