If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Index Visualiser for Blender 2.5

There already was an index visualiser for Blender 2.4, but since Campbell added drawing in the 3d-view to 2.5, I ported the old code.
The script is kept up to date with the latest changes in Blender, so you need a recent build of blender to run it.

Link
You can download the script here. (This link automatically points to the most recent version, as the script is now in the contrib section of Blender)

How to install
There are two ways to get the script working in your .blend
Make it available in all blend files:

Put the .py file you downloaded in the folder: .blender/scripts/addons

Or just make it available in the blend file you're currently working on:

Open the downloaded script inside Blender text editor

Run the script once (alt+p)

How to use

Select an object and enter Editmode (tab-key)

Display the properties panel (N-key)

Go to the Mesh Display tab, it helps to fold the tabs above it

Press the 'Visualise indices button'

About the different buttons:
Visualise indices - this toggles whether the indices are shown or not (press once to activate, press again to de-activate)
Vertices / Edges / Faces - determines of which group(s) to show the indices
Selected only - If toggled, only indices of selected verts/edges/faces are shown

If you change the mesh (selection) in edit-mode, the indices won't automatically update. You'll have to tab in and out of object mode. This was done to improve the speed of the script.

Technical explanation
(outdated as of version 2.1)
At the start of this post I said I ported the old code, but that isn't true; I had to start from scratch. The main problem was getting the right view matrix. In 2.5 it is possible to draw directly in the opengl scene (POST_VIEW and PRE_VIEW), but the rotation of the text can't be influenced then. It always faces up on the world z-axis.
The solution is drawing to POST_PIXEL (text always faces out of the screen), but this requires to translate 3d-view coordinates to 2d screen coordinates. In 2.4 you could use Window.GetPerspMatrix() as part of the procedure, but in 2.5 this doesn't exist anymore. So my solution was to get 2 opengl matrices from POST_VIEW, and use them in a second callback that draws in POST_PIXEL.
All this slows down the script quite a lot, so it's recommended not to have too many indices on the screen. To slightly speed up the script I disabled automatic updating of the selected vertices. So if you change the mesh (selection) in edit-mode, you'll have to tab in and out of objectmode manually, to update the indices. If you wish to have this automatically, you can uncomment lines 36 and 37 in the script.

The reason I rewrote the script is that I need it for other scripts I want to develop, so it's indeed mainly meant for developers. Normal users of Blender really don't have a need for knowing what the index of a vertex is.

Drawing in the 3d view was only added three days ago (by Campbell in his free time, thanks a lot! ). As far as I know you should be able to draw images as well, but it'll be a bit harder than in 2.4 as you'll have to use native opengl commands (no more shortcuts like Draw.Image() in 2.4).

The script has been in Blender Contrib for some time now. This means that it is kept up to date with all changes in Blender and can even be automatically included when you build Blender yourself.
Practically this means that you can always find the most recent version of the script, at this link.

Fantastico! I have been thinking about CAD and how to possibly like show the angle between two edges selected in 3D view, or the length of an edge, etc. Seeing just the screenshot lets me know it can be done. I love how one idea spawns another.