33

I am try to do something based on the ID of a vertices. I want blender to show me the vertices ID. How can I have blender show me the ID in the viewport? I do not see an option in the Mesh Display tab.

I want to see the numbers next to the verts

enter image description here

gandalf3
  • 157,169
  • 58
  • 601
  • 1,133
  • there is a script that did this in older version but its now broken. http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/3D_interaction/Index_Visualiser –  Oct 08 '13 at 17:46

3 Answers3

49

There's a built-in feature to show mesh element indices, but the option isn't shown in the user interface by default.

Blender 2.7 and older:

The option only shows if the debug mode is enabled.

  1. Start Blender in debug mode, or simply go to Python Console (Shift-F4) and type bpy.app.debug = True
  2. Go to N-panel > Mesh Display
  3. A checkbox Indices will now show
  4. The colors are controlled by the interface theme

There's also an updated version of the Index Visulizer script:
space_view3d_index_visualiser_bmesh.py

Blender 2.8:

It only shows if the developer UI option is turned on.

  1. Run Blender normally
  2. Click Edit > Preferences...
  3. In the Display panel of the Interface tab, tick Developer Extras
    or type bpy.context.preferences.view.show_developer_ui = True into the Python console.
  4. Open the Overlays popover in the 3D View Overlays popover
  5. Look for the label Developer and tick the checkbox Indices

    Developer Overlay Indices

CodeManX
  • 29,298
  • 3
  • 89
  • 128
  • CoDEmanX steps work for Blender Version 2.73.a on OS X. enter image description here –  Mar 28 '15 at 23:46
  • @CoDEmanX I can't download the visualizer script.... do you know if the address is ok??? thanks – yhoyo Mar 29 '15 at 04:28
  • It was probably removed from the repository / old tracker, but I updated the link to point to a phabricator file. – CodeManX Mar 30 '15 at 08:36
  • It seems this has been moved to another place in Blender 2.8. Any ideas where I could find it? – Bauxite Apr 09 '20 at 12:26
  • 2
    @Bauxite It moved into the Overlays popover and depends on a different option now (Developer Extras, bpy.context.preferences.view.show_developer_ui). I updated my answer. – CodeManX Apr 09 '20 at 15:46
  • 1
    And since, by default, the dark blue indices are so horrible to read on the dark gray background, you may wanna change "Theme > 3D Viewport > Face Angle Text" to a brighter color aswell. – Ray Jan 27 '21 at 13:29
  • Any update for Blender 3.2? I followed the steps, but I cannot see the "Developer" label in the Overlays popover – Alex Mekx Jul 28 '22 at 08:30
  • 2
    @AlexMekx You need to be in Edit Mode of a Mesh to see the option. After enabling it, you need to select something. The selection mode determines whether it displays vertex, edge, face indices, or a combination of them. – CodeManX Aug 18 '22 at 18:36
10

I made a usability modification to the script offered by @CoDEmanX, a while back, because it can be a pain to get the theme colours to play nice enough to let me read the indices. Hence I added a polygon background.

enter image description here

script available from: https://gist.github.com/zeffii/9451340

ideally the bpy.app.debug = True would also include some background for the numbers, as is the case with Ruler/Protractor feature.

zeffii
  • 39,634
  • 9
  • 103
  • 186
  • 3
    Any plans to port this 2.8? The immediate mode is gone, bgl.Color etc. are no longer supported and don't know how to use the new way, using bind buffers and stuff. Also, coloring the text will probably require support in blf, because without immediate you can't set a color just like that before the blf draw call to affect it. – CodeManX May 24 '18 at 12:28
1

On printing one vertex the index comes as a property. So you can utilize that to refer a vertex as well. You can record their indexes while making the vertices.

m=bmesh.from_edit_mesh(bpy.context.object.data)
vertices=[] #include vertices here
m.verts.new(vertices)
indexes=[]   
indexes.append( (int)((str)(m.verts[i])[( (str)(m.verts[i]).find('index=') )+2:-1]) for i in range(len(vertices)))

Hope that solves the problem!

Rohinb97
  • 111
  • 1