Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-07-05 12:04:37 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-07-05 12:04:37 +0300
commit68ec4c26b93b68c7447746540aa5b89084fb7595 (patch)
tree72a59c17f663b07765a726eae4d2da81533f4b34 /source
parent5d75672720ceda096b12763ce814fc4f32aa5fa5 (diff)
Fix paint modes using edge-selection in non-selection modes
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c83
1 files changed, 49 insertions, 34 deletions
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);