Fix T53512: Vertices with index 0 were not being selected
authorGermano <germano.costa@ig.com.br>
Fri, 8 Dec 2017 14:42:00 +0000 (12:42 -0200)
committerGermano <germano.costa@ig.com.br>
Fri, 8 Dec 2017 14:42:00 +0000 (12:42 -0200)
Bug introduced on rB9f5bf197a0c3.
The offset for selection of vertices (`bm_vertoffs`) starts where the offset o edges ends (`bm_wireoffs`).
However, the `bm_wireoffs` depends on the offset of face selection (`bm_solidoffs`).

Before the commit that introduced the bug, the drawn of edges (in backbuff) was always computed along with the `bm_wireoffs`:
```
bm_wireoffs = bm_solidoffs + em->bm->totedge;
```

Now that the edges are not always drawn in backbuff, `bm_wireoffs` has to start from `bm_solidoffs`.

source/blender/editors/space_view3d/drawobject.c

index a1075f7efcfa203ad1ef0901c43ea306941bb5e6..a1ddec7531e6865d71cc3e9ae5af15f199a6f10a 100644 (file)
@@ -8433,8 +8433,9 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
                                bbs_mesh_solid_EM(em, scene, v3d, ob, dm, (ts->selectmode & SCE_SELECT_FACE) != 0);
                                if (ts->selectmode & SCE_SELECT_FACE)
                                        bm_solidoffs = 1 + em->bm->totface;
-                               else
+                               else {
                                        bm_solidoffs = 1;
+                               }
 
                                ED_view3d_polygon_offset(rv3d, 1.0);
 
@@ -8443,6 +8444,10 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
                                        bbs_mesh_wire(em, dm, bm_solidoffs);
                                        bm_wireoffs = bm_solidoffs + em->bm->totedge;
                                }
+                               else {
+                                       /* `bm_vertoffs` is calculated from `bm_wireoffs`. (otherwise see T53512) */
+                                       bm_wireoffs = bm_solidoffs;
+                               }
 
                                /* we draw verts if vert select mode. */
                                if (ts->selectmode & SCE_SELECT_VERTEX) {