From 8994f09a4a79d1ed7365bb3e96f07674a9d84353 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 29 Mar 2021 16:04:17 +1100 Subject: Knife: scale points & snapping threshold by the DPI factor The points were too small on hi-dpi displays. --- source/blender/editors/mesh/editmesh_knife.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source/blender/editors/mesh') diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index f0b77f59a5c..05b069b2d7f 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -74,7 +74,7 @@ /* detect isolated holes and fill them */ #define USE_NET_ISLAND_CONNECT -#define KMAXDIST 10 /* max mouse distance from edge before not detecting it */ +#define KMAXDIST (10 * U.dpi_fac) /* max mouse distance from edge before not detecting it */ /* WARNING: knife float precision is fragile: * be careful before making changes here see: (T43229, T42864, T42459, T41164). @@ -1083,7 +1083,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v if (kcd->prev.vert) { immUniformColor3ubv(kcd->colors.point); - GPU_point_size(11); + GPU_point_size(11 * UI_DPI_FAC); immBegin(GPU_PRIM_POINTS, 1); immVertex3fv(pos, kcd->prev.cage); @@ -1092,7 +1092,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v if (kcd->prev.bmface) { immUniformColor3ubv(kcd->colors.curpoint); - GPU_point_size(9); + GPU_point_size(9 * UI_DPI_FAC); immBegin(GPU_PRIM_POINTS, 1); immVertex3fv(pos, kcd->prev.cage); @@ -1110,7 +1110,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v } else if (kcd->curr.vert) { immUniformColor3ubv(kcd->colors.point); - GPU_point_size(11); + GPU_point_size(11 * UI_DPI_FAC); immBegin(GPU_PRIM_POINTS, 1); immVertex3fv(pos, kcd->curr.cage); @@ -1119,7 +1119,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v if (kcd->curr.bmface) { immUniformColor3ubv(kcd->colors.curpoint); - GPU_point_size(9); + GPU_point_size(9 * UI_DPI_FAC); immBegin(GPU_PRIM_POINTS, 1); immVertex3fv(pos, kcd->curr.cage); @@ -1152,7 +1152,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v /* draw any snapped verts first */ rgba_uchar_to_float(fcol, kcd->colors.point_a); GPU_batch_uniform_4fv(batch, "color", fcol); - GPU_point_size(11); + GPU_point_size(11 * UI_DPI_FAC); if (snapped_verts_count > 0) { GPU_batch_draw_range(batch, 0, snapped_verts_count); } @@ -1160,7 +1160,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v /* 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_point_size(7 * UI_DPI_FAC); if (other_verts_count > 0) { GPU_batch_draw_range(batch, snapped_verts_count, other_verts_count); } @@ -1200,7 +1200,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v KnifeVert *kfv; immUniformColor3ubv(kcd->colors.point); - GPU_point_size(5.0); + GPU_point_size(5.0 * UI_DPI_FAC); GPUBatch *batch = immBeginBatchAtMost(GPU_PRIM_POINTS, BLI_mempool_len(kcd->kverts)); -- cgit v1.2.3