diff options
author | mano-wii <germano.costa@ig.com.br> | 2018-12-24 04:18:07 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2018-12-25 19:36:49 +0300 |
commit | 34a538ba1b73e7a464d26dd3f5902774c7867766 (patch) | |
tree | 7bfa5a0da67f27d9c24a2e798597e1e435ee50e2 /source/blender/editors/mesh | |
parent | 94dfa6eaacac69723d5832181201b5b65c32260d (diff) |
Revert "Fix T59505: Knife tool cut preview line becomes black"
This reverts commit dafaa6f22881419ac55f2f3fe3de9ac4023aa108.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index c95755b8cb5..b89a7dd91a1 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -213,6 +213,8 @@ typedef struct KnifeTool_OpData { /* vector along view z axis (object space, normalized) */ float proj_zaxis[3]; + KnifeColors colors; + /* run by the UI or not */ bool is_interactive; @@ -1039,10 +1041,8 @@ static void knife_init_colors(KnifeColors *colors) static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg) { const KnifeTool_OpData *kcd = arg; - KnifeColors colors; - knife_init_colors(&colors); - GPU_depth_test(false); + glPolygonOffset(1.0f, 1.0f); GPU_matrix_push(); @@ -1058,7 +1058,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (kcd->mode == MODE_DRAGGING) { - immUniformColor3ubv(colors.line); + immUniformColor3ubv(kcd->colors.line); GPU_line_width(2.0); immBegin(GPU_PRIM_LINES, 2); @@ -1068,7 +1068,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void } if (kcd->prev.vert) { - immUniformColor3ubv(colors.point); + immUniformColor3ubv(kcd->colors.point); GPU_point_size(11); immBegin(GPU_PRIM_POINTS, 1); @@ -1077,7 +1077,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void } if (kcd->prev.bmface) { - immUniformColor3ubv(colors.curpoint); + immUniformColor3ubv(kcd->colors.curpoint); GPU_point_size(9); immBegin(GPU_PRIM_POINTS, 1); @@ -1086,7 +1086,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void } if (kcd->curr.edge) { - immUniformColor3ubv(colors.edge); + immUniformColor3ubv(kcd->colors.edge); GPU_line_width(2.0); immBegin(GPU_PRIM_LINES, 2); @@ -1095,7 +1095,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immEnd(); } else if (kcd->curr.vert) { - immUniformColor3ubv(colors.point); + immUniformColor3ubv(kcd->colors.point); GPU_point_size(11); immBegin(GPU_PRIM_POINTS, 1); @@ -1104,7 +1104,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void } if (kcd->curr.bmface) { - immUniformColor3ubv(colors.curpoint); + immUniformColor3ubv(kcd->colors.curpoint); GPU_point_size(9); immBegin(GPU_PRIM_POINTS, 1); @@ -1137,14 +1137,14 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); /* draw any snapped verts first */ - rgba_uchar_to_float(fcol, colors.point_a); + rgba_uchar_to_float(fcol, kcd->colors.point_a); GPU_batch_uniform_4fv(batch, "color", fcol); GPU_matrix_bind(batch->interface); GPU_point_size(11); GPU_batch_draw_range_ex(batch, 0, v - 1, false); /* now draw the rest */ - rgba_uchar_to_float(fcol, colors.curpoint_a); + rgba_uchar_to_float(fcol, kcd->colors.curpoint_a); GPU_batch_uniform_4fv(batch, "color", fcol); GPU_point_size(7); GPU_batch_draw_range_ex(batch, vs + 1, kcd->totlinehit - (vs + 1), false); @@ -1159,7 +1159,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void BLI_mempool_iter iter; KnifeEdge *kfe; - immUniformColor3ubv(colors.line); + immUniformColor3ubv(kcd->colors.line); GPU_line_width(1.0); GPUBatch *batch = immBeginBatchAtMost(GPU_PRIM_LINES, BLI_mempool_len(kcd->kedges) * 2); @@ -1183,7 +1183,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void BLI_mempool_iter iter; KnifeVert *kfv; - immUniformColor3ubv(colors.point); + immUniformColor3ubv(kcd->colors.point); GPU_point_size(5.0); GPUBatch *batch = immBeginBatchAtMost(GPU_PRIM_POINTS, BLI_mempool_len(kcd->kverts)); @@ -2682,6 +2682,8 @@ static void knifetool_init(bContext *C, KnifeTool_OpData *kcd, if (is_interactive) { kcd->draw_handle = ED_region_draw_cb_activate(kcd->ar->type, knifetool_draw, kcd, REGION_DRAW_POST_VIEW); + + knife_init_colors(&kcd->colors); } } |