Change visualize indices so that edit select mode chooses which elements are visualized
authorHoward Trickey <howard.trickey@gmail.com>
Tue, 27 Dec 2011 12:50:23 +0000 (12:50 +0000)
committerHoward Trickey <howard.trickey@gmail.com>
Tue, 27 Dec 2011 12:50:23 +0000 (12:50 +0000)
source/blender/editors/space_view3d/drawobject.c

index e40fe6176a390bd8f0dfc1e85fd44a710c931325..c6775873fabfc6309063fbd0e04a55ec3348329e 100644 (file)
@@ -2781,28 +2781,34 @@ static void draw_em_indices(EditMesh *em)
 
        /* For now, reuse appropriate theme colors from stats text colors */
 
-       UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
-       for (v = em->verts.first, i = 0; v; v = v->next, i++) {
-               if (v->f & SELECT) {
-                       sprintf(val, "%d", i);
-                       view3d_cached_text_draw_add(v->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
+       if (em->selectmode & SCE_SELECT_VERTEX) {
+               UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
+               for (v = em->verts.first, i = 0; v; v = v->next, i++) {
+                       if (v->f & SELECT) {
+                               sprintf(val, "%d", i);
+                               view3d_cached_text_draw_add(v->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
+                       }
                }
        }
 
-       UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
-       for (e = em->edges.first, i = 0; e; e = e->next, i++) {
-               if (e->f & SELECT) {
-                       sprintf(val, "%d", i);
-                       mid_v3_v3v3(pos, e->v1->co, e->v2->co);
-                       view3d_cached_text_draw_add(pos, val, 0, V3D_CACHE_TEXT_ASCII, col);
+       if (em->selectmode & SCE_SELECT_EDGE) {
+               UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
+               for (e = em->edges.first, i = 0; e; e = e->next, i++) {
+                       if (e->f & SELECT) {
+                               sprintf(val, "%d", i);
+                               mid_v3_v3v3(pos, e->v1->co, e->v2->co);
+                               view3d_cached_text_draw_add(pos, val, 0, V3D_CACHE_TEXT_ASCII, col);
+                       }
                }
        }
 
-       UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
-       for (f = em->faces.first, i = 0; f; f = f->next, i++) {
-               if (f->f & SELECT) {
-                       sprintf(val, "%d", i);
-                       view3d_cached_text_draw_add(f->cent, val, 0, V3D_CACHE_TEXT_ASCII, col);
+       if (em->selectmode & SCE_SELECT_FACE) {
+               UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
+               for (f = em->faces.first, i = 0; f; f = f->next, i++) {
+                       if (f->f & SELECT) {
+                               sprintf(val, "%d", i);
+                               view3d_cached_text_draw_add(f->cent, val, 0, V3D_CACHE_TEXT_ASCII, col);
+                       }
                }
        }
 }