[Bf-blender-cvs] [68ec4c26b93] master: Fix paint modes using edge-selection in non-selection modes

Campbell Barton noreply at git.blender.org
Fri Jul 5 11:11:10 CEST 2019


Commit: 68ec4c26b93b68c7447746540aa5b89084fb7595
Author: Campbell Barton
Date:   Fri Jul 5 19:04:37 2019 +1000
Branches: master
https://developer.blender.org/rB68ec4c26b93b68c7447746540aa5b89084fb7595

Fix paint modes using edge-selection in non-selection modes

===================================================================

M	source/blender/draw/intern/draw_cache_impl_mesh.c

===================================================================

diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 3b5959f1c59..1ebdab19375 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -3809,55 +3809,70 @@ static void mesh_create_loops_lines_paint_mask(MeshRenderData *rdata, GPUIndexBu
     BLI_assert(0);
   }
   else {
-    /* Each edge has two bits used to count selected edges as 0, 1, 2+. */
-    BLI_bitmap *edges_used = BLI_BITMAP_NEW(edge_len * 2, __func__);
+    if (rdata->me->editflag & ME_EDIT_PAINT_FACE_SEL) {
+      /* Each edge has two bits used to count selected edges as 0, 1, 2+. */
+      BLI_bitmap *edges_used = BLI_BITMAP_NEW(edge_len * 2, __func__);
 
-    /* Fill the EdgeHash tables. */
-    for (int poly = 0; poly < poly_len; poly++) {
-      const MPoly *mpoly = &rdata->mpoly[poly];
-
-      /* Do not check faces that are hidden and faces that aren't selected */
-      if (mpoly->flag & ME_HIDE || ((mpoly->flag & ME_FACE_SEL) == 0)) {
-        continue;
-      }
+      /* Fill the edge bitmap table. */
+      for (int poly = 0; poly < poly_len; poly++) {
+        const MPoly *mpoly = &rdata->mpoly[poly];
 
-      for (int loop_index = mpoly->loopstart, loop_index_end = mpoly->loopstart + mpoly->totloop;
-           loop_index < loop_index_end;
-           loop_index++) {
-        const MLoop *mloop = &rdata->mloop[loop_index];
-        const int e_a = mloop->e * 2;
-        const int e_b = e_a + 1;
-        if (!BLI_BITMAP_TEST(edges_used, e_a)) {
-          BLI_BITMAP_ENABLE(edges_used, e_a);
+        /* Do not check faces that are hidden and faces that aren't selected */
+        if (mpoly->flag & ME_HIDE || ((mpoly->flag & ME_FACE_SEL) == 0)) {
+          continue;
         }
-        else {
-          BLI_BITMAP_ENABLE(edges_used, e_b);
+
+        for (int loop_index = mpoly->loopstart, loop_index_end = mpoly->loopstart + mpoly->totloop;
+             loop_index < loop_index_end;
+             loop_index++) {
+          const MLoop *mloop = &rdata->mloop[loop_index];
+          const int e_a = mloop->e * 2;
+          const int e_b = e_a + 1;
+          if (!BLI_BITMAP_TEST(edges_used, e_a)) {
+            BLI_BITMAP_ENABLE(edges_used, e_a);
+          }
+          else {
+            BLI_BITMAP_ENABLE(edges_used, e_b);
+          }
         }
       }
-    }
 
-    for (int poly = 0; poly < poly_len; poly++) {
-      const MPoly *mpoly = &rdata->mpoly[poly];
-      if (!(mpoly->flag & ME_HIDE)) {
+      for (int poly = 0; poly < poly_len; poly++) {
+        const MPoly *mpoly = &rdata->mpoly[poly];
+        if (!(mpoly->flag & ME_HIDE)) {
+
+          for (int loop_index_next = mpoly->loopstart,
+                   loop_index_end = mpoly->loopstart + mpoly->totloop,
+                   loop_index_curr = loop_index_end - 1;
+               loop_index_next < loop_index_end;
+               loop_index_curr = loop_index_next++) {
+            const MLoop *mloop = &rdata->mloop[loop_index_curr];
+            const int e_a = mloop->e * 2;
+            const int e_b = e_a + 1;
+
+            /* Draw if a boundary or entirely unselected. */
+            if (!BLI_BITMAP_TEST(edges_used, e_b)) {
+              GPU_indexbuf_add_line_verts(&elb, loop_index_curr, loop_index_next);
+            }
+          }
+        }
+      }
 
+      MEM_freeN(edges_used);
+    }
+    else {
+      /* Add edges. */
+      for (int poly = 0; poly < poly_len; poly++) {
+        const MPoly *mpoly = &rdata->mpoly[poly];
         for (int loop_index_next = mpoly->loopstart,
                  loop_index_end = mpoly->loopstart + mpoly->totloop,
                  loop_index_curr = loop_index_end - 1;
              loop_index_next < loop_index_end;
              loop_index_curr = loop_index_next++) {
-          const MLoop *mloop = &rdata->mloop[loop_index_curr];
-          const int e_a = mloop->e * 2;
-          const int e_b = e_a + 1;
-
-          /* Draw if a boundary or entirely unselected. */
-          if (!BLI_BITMAP_TEST(edges_used, e_b)) {
-            GPU_indexbuf_add_line_verts(&elb, loop_index_curr, loop_index_next);
-          }
+          GPU_indexbuf_add_line_verts(&elb, loop_index_curr, loop_index_next);
         }
       }
     }
-
-    MEM_freeN(edges_used);
   }
 
   GPU_indexbuf_build_in_place(&elb, ibo);



More information about the Bf-blender-cvs mailing list