Index Visualiser for Blender 2.5

(Crouch) #1

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.

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
  • Open Blender and go to User Preferences --> Add-Ons --> Enable Add-On (Index Visualiser)

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.

(Loolarge) #2

I think that’s most useful for scripting people. Thanks alot, i did not know the 2.4x version. Certainly nice to have!

Very interesting to see you using BGL! Can it draw images in the 3d view allready, do you know about that? I was not aware the BGL is working in at all yet in 2.5, nice :wink:

(Crouch) #3

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).

(RickyBlender) #4

thanks for converting this one
very usefufll when making new object primitive with scripts

any idea if some of the old functions like you said are going to come back later on!

i mean 2.5 is supposed to have all of the old features of 2.49 and new ones too!

nice work
happy 2.5

(demohero) #5

Thank you very much Crouch. :slight_smile:

(Meta-Androcto) #6

great job!

(mandoragon) #7

thank you! this really helps =)

where is the 2.4x version though?

(Crouch) #8

mandoragon: I already linked to it in the first post. Here it is again.

I’ve also made a slight change to the script for Blender 2.5, so here is Index Visualiser 2.1.
It includes a minor speed increase. Written and tested for svn 27407 (it needs a pretty recent build).

(RickyBlender) #9

one suggeston here

can you change the header name for index show or else…

cause i had problem finding this with the word display

dipslay word reminds me more of something in otherblender’s panel!

would be easier to find this new panel in N Panel!

i used it this week to prepare some new primitives

very usefull tool and esasy to use ounce you find where the anel is located


(Crouch) #10

The buttons are actually added to an existing panel (which is called Display), so I can’t change the name of the existing panel.
I’m glad the tool was useful to you though.

(Crouch) #11

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.

(PapaSmurf) #12

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.

(Lepes) #13

Great work here, i’m just learning a lot with all your marvellous scripts !

Small Improvement: Script doesn’t keep in mind weather vertex/edge/face is hidden, so it always show index numbers although you have used “H” key to hide some vertexs.

line 68 modified: added “not v.hidden” and parenthesis.

        for v in me.verts:
            if not v.hidden and (v.selected or not bpy.context.scene.display_sel_only):
                locs.append([1.0, 1.0, 1.0, v.index,])

Is there any reason it shouldn’t be done?

Thank you very much for your work !
PS: English is not my native language, sure you noticed :evilgrin:

(Crouch) #14

The script has been updated to work correctly with Blender 2.54. It also takes into account if a vertex/edge/face is hidden.

The most recent version right now is 2.6.3. Download link can be found in the first post.

(RickyBlender) #15

sorry but the link in first post seems to be dead ?

happy 2.5

(PKHG) #16

No works perfectly! The link as well as the addon!

(zeffii) #17

ok, i’m going to debug this unless you have a more uptodate version.

(RickyBlender) #18

the link in first post is still dead !

happy 2.5

(PKHG) #19

No, link to the script is alive :wink:

(RickyBlender) #20

well when i click on that link a get a blank WEB page!

how come?