22
$\begingroup$

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

$\endgroup$
26
$\begingroup$

There's a built-in feature to show mesh element indices, but the option is only shown in debug mode.

  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

$\endgroup$
  • $\begingroup$ CoDEmanX steps work for Blender Version 2.73.a on OS X. !enter image description here $\endgroup$ – user13466 Mar 28 '15 at 23:46
  • $\begingroup$ @CoDEmanX I can't download the visualizer script.... do you know if the address is ok??? thanks $\endgroup$ – yhoyo Mar 29 '15 at 4:28
  • $\begingroup$ It was probably removed from the repository / old tracker, but I updated the link to point to a phabricator file. $\endgroup$ – CoDEmanX Mar 30 '15 at 8:36
9
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ 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. $\endgroup$ – CoDEmanX May 24 '18 at 12:28
0
$\begingroup$

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!

$\endgroup$
  • $\begingroup$ The OP wanted to show the index in the viewport. $\endgroup$ – jdk1.0 May 8 '18 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy