To try out the light generator function, start Blender and add an object to the scene. We'll use a simple circle: Add/Mesh/Circle, with 32 vertices, and assign a name to it. The script will derive all names for generated objects, materials, etc. from this name, and you make your life easier if this name isn't just "Circle.001". What about a useful and descriptive name? Don't make it too long, though, because the script will add a few characters.
Now you should have something like this:
In case you wonder what the window on the right is. This is a rather new mode of the outliner. In this picture it was activated by splitting the 3D area (i.e. right clicking on the lower border and selecting Split Area), switching to the Outliner in the right window, and finally choosing View/Show Outliner from its menu.
All 32 vertices are selected by default and you can leave it at that. Now let the script create a (faked) light for each of the selected vertices. Call the script from the main menu: File/Export/FlightGear animation (fgfs-export.xml). (The script is in the Export menu because it writes (exports) FlightGear animation code.) You'll get a pop-up menu, from which you select Generate textured lights. This is what you get:
You see in the 3D window that the script added a square at the origin, consisting of two triangles. Actually, it's 32 squares, one over the other. You can see in the outliner window that they are named with the circle's name plus an "X" and a number. I have opened objects "fooX03", "fooX04" and "fooX05" so that you can see that all the added objects share the same mesh. This means that you can activate any of them and resize it, and all other light objects for this series will follow. They are linked.
Finally, you assign a light halo texture to one of the light objects. Just to one, because of the links. The other objects will automatically adopt the same texture and UV coordinates. You don't need to choose a material. This was already done by the script.
All the new linked objects with their texture are just one aspect. In the background the script saved an animation file ready for use in FlightGear: fgfs-export.xml. If there was another file with this name in the same directory ... well, bad luck. In real projects, you will probably not use the animation file as is, but will copy the interesting parts into your already existing animation file. The generated xml file contains everything that is necessary to (1) scale the textured light objects according to viewing distance, (2) move them to the location of the vertex that it was created for, (3) makes sure that the faces always direct to the viewer (billboard animation), and (4) blend it with other (semi)transparent objects (alpha-test). Furthermore, all light objects are unselected at daylight. Many of the parameters will, of course, have to be tweaked for the particular purpose. All animations that aren't really necessary (especially the alpha-test animation) should be removed or commented out!
Although direct use of the animation file in FlightGear was not originally a goal of the Python script, it can be used for tests. Just save the Blender file first under, let's say test.blend, then delete the circle object, because this doesn't look so nice, and export the contents to test.ac. You should either configure the ac3d-exporter to use the mirror color for the emission property (Mir2Emis), or hand edit the test.ac file and make sure that emis is set to 1 1 1, spec to 0 0 0, and shi to 0:
MATERIAL "fooXmat" rgb 1 1 1 amb 0 0 0 emis 1 1 1 spec 0 0 0 shi 0 trans 0
Now you only need to write a small FlightGear configuration file config.xml:
create a directory $FG_ROOT/Local/Test/, copy test.ac and the texture image there, and move fgfs-export.xml there and rename it to test.xml. Finally, call fgfs like so:
$ fgfs --config=config.xml --aircraft=ufo --timeofday=midnight
And if you fly the UFO in KSFO to the VOR in the middle of the four runways, you'll see something like this:
It doesn't need to be midnight, just dark enough that the lighting goes on. Here's some more detail:
And that's what is going on behind the scenes: In this picture the light objects aren't textured and the original circle is still there. You can move the UFO around this object, and the faces will always follow. No way to see their backsides! :-)
If you are placing lights with the presented Python script, you have two possibilities: (a) either you select vertices on existing objects that belong to the model, or (b) you create helper objects solely for the purpose of placing lights, and you remove them before you export the model, or remove them from the exported object. In the following example I created three such helper objects: (1) one tetragon (circle with 4 vertices), (2) one triangle (circle with 3 vertices), and (3) one object consisting of three hexagons. The three objects could actually have been merged into just one object. Keeping them separated is desirable if you have different sorts of lights, with different textures, colors, sizes, etc., but on this tower they are the same anyway.