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
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-03-04 18:47:18 +0300
committerJacques Lucke <jacques@blender.org>2020-03-04 18:48:37 +0300
commit765f2a1bcaa70e28afd73162e4d6ec1493d13ab2 (patch)
treea6f09e744440bccb05e84ef636f884e04746d014 /source/blender/editors
parenta22573e243d7eeda7c10c9afc59377d474c74e5e (diff)
Fix T71578: knife tool draws some points incorrectly
D6417 by @fbessou
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 93850abafea..705ebd324eb 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1134,7 +1134,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void
if (kcd->totlinehit > 0) {
KnifeLineHit *lh;
- int i, v, vs;
+ int i, snapped_verts_count, other_verts_count;
float fcol[4];
GPU_blend(true);
@@ -1145,12 +1145,12 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void
GPU_vertbuf_data_alloc(vert, kcd->totlinehit);
lh = kcd->linehits;
- for (i = 0, v = 0, vs = kcd->totlinehit - 1; i < kcd->totlinehit; i++, lh++) {
+ for (i = 0, snapped_verts_count = 0, other_verts_count = 0; i < kcd->totlinehit; i++, lh++) {
if (lh->v) {
- GPU_vertbuf_attr_set(vert, pos, v++, lh->cagehit);
+ GPU_vertbuf_attr_set(vert, pos, snapped_verts_count++, lh->cagehit);
}
else {
- GPU_vertbuf_attr_set(vert, pos, vs--, lh->cagehit);
+ GPU_vertbuf_attr_set(vert, pos, kcd->totlinehit - 1 - other_verts_count++, lh->cagehit);
}
}
@@ -1163,13 +1163,17 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void
GPU_batch_uniform_4fv(batch, "color", fcol);
GPU_matrix_bind(batch->interface);
GPU_point_size(11);
- GPU_batch_draw_advanced(batch, 0, v - 1, 0, 0);
+ if (snapped_verts_count > 0) {
+ GPU_batch_draw_advanced(batch, 0, snapped_verts_count, 0, 0);
+ }
/* now draw the rest */
rgba_uchar_to_float(fcol, kcd->colors.curpoint_a);
GPU_batch_uniform_4fv(batch, "color", fcol);
GPU_point_size(7);
- GPU_batch_draw_advanced(batch, vs + 1, kcd->totlinehit - (vs + 1), 0, 0);
+ if (other_verts_count > 0) {
+ GPU_batch_draw_advanced(batch, snapped_verts_count, other_verts_count, 0, 0);
+ }
GPU_batch_program_use_end(batch);
GPU_batch_discard(batch);