diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-08-18 05:29:15 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-08-18 05:29:15 +0300 |
commit | 3c690aa4bc88c8c8643957a30f440a375237e87e (patch) | |
tree | f32aefaf455a682fd7096c3411bdd88f8d0e10c7 | |
parent | c65c66320fc8014a8fa5a09690666441f5c2556c (diff) | |
parent | d1057890c40b6f50d0a13215eec90ab1af03a44b (diff) |
Merge branch 'blender-v2.90-release' into master
-rw-r--r-- | source/blender/editors/curve/editcurve_paint.c | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d_ops.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 20 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 7 |
5 files changed, 19 insertions, 18 deletions
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 748bf040fbb..ebad1995717 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -666,7 +666,7 @@ static void curve_draw_exec_precalc(wmOperator *op) selem_prev = selem; } scale_px = ((len_3d > 0.0f) && (len_2d > 0.0f)) ? (len_3d / len_2d) : 0.0f; - float error_threshold = (cps->error_threshold * U.pixelsize) * scale_px; + float error_threshold = (cps->error_threshold * U.dpi_fac) * scale_px; RNA_property_float_set(op->ptr, prop, error_threshold); } @@ -685,7 +685,7 @@ static void curve_draw_exec_precalc(wmOperator *op) } if (len_squared_v2v2(selem_first->mval, selem_last->mval) <= - square_f(STROKE_CYCLIC_DIST_PX * U.pixelsize)) { + square_f(STROKE_CYCLIC_DIST_PX * U.dpi_fac)) { use_cyclic = true; } } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 455c4fd5073..359e9994662 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4845,7 +4845,7 @@ static bool ui_numedit_but_NUM(uiBut *but, if (is_float == false) { /* at minimum, moving cursor 2 pixels should change an int button. */ - CLAMP_MIN(non_linear_scale, 0.5f * U.pixelsize); + CLAMP_MIN(non_linear_scale, 0.5f * UI_DPI_FAC); } data->dragf += (((float)(mx - data->draglastx)) / deler) * non_linear_scale; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 7caa61ec91d..eb47c5c3e6d 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1157,8 +1157,8 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) const bool zoom_to_pos = use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS); /* get amount to move view by */ - dx = RNA_float_get(op->ptr, "deltax") / U.pixelsize; - dy = RNA_float_get(op->ptr, "deltay") / U.pixelsize; + dx = RNA_float_get(op->ptr, "deltax") / U.dpi_fac; + dy = RNA_float_get(op->ptr, "deltay") / U.dpi_fac; if (U.uiflag & USER_ZOOM_INVERT) { dx *= -1; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index ac9d12cdd58..b9fb8ed4fde 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -822,7 +822,7 @@ static void viewrotate_apply(ViewOpsData *vod, const int event_xy[2]) float xaxis[3]; /* Radians per-pixel. */ - const float sensitivity = U.view_rotate_sensitivity_turntable / U.pixelsize; + const float sensitivity = U.view_rotate_sensitivity_turntable / U.dpi_fac; /* Get the 3x3 matrix and its inverse from the quaternion */ quat_to_mat3(m, vod->curr.viewquat); @@ -2038,7 +2038,7 @@ static float viewzoom_scale_value(const rcti *winrct, fac = (float)(xy_init[1] - xy_curr[1]); } - fac /= U.pixelsize; + fac /= U.dpi_fac; if (zoom_invert != zoom_invert_force) { fac = -fac; @@ -2055,8 +2055,8 @@ static float viewzoom_scale_value(const rcti *winrct, BLI_rcti_cent_x(winrct), BLI_rcti_cent_y(winrct), }; - float len_new = (5 * U.pixelsize) + ((float)len_v2v2_int(ctr, xy_curr) / U.pixelsize); - float len_old = (5 * U.pixelsize) + ((float)len_v2v2_int(ctr, xy_init) / U.pixelsize); + float len_new = (5 * U.dpi_fac) + ((float)len_v2v2_int(ctr, xy_curr) / U.dpi_fac); + float len_old = (5 * U.dpi_fac) + ((float)len_v2v2_int(ctr, xy_init) / U.dpi_fac); /* intentionally ignore 'zoom_invert' for scale */ if (zoom_invert_force) { @@ -2066,16 +2066,16 @@ static float viewzoom_scale_value(const rcti *winrct, zfac = val_orig * (len_old / max_ff(len_new, 1.0f)) / val; } else { /* USER_ZOOM_DOLLY */ - float len_new = 5 * U.pixelsize; - float len_old = 5 * U.pixelsize; + float len_new = 5 * U.dpi_fac; + float len_old = 5 * U.dpi_fac; if (U.uiflag & USER_ZOOM_HORIZ) { - len_new += (winrct->xmax - (xy_curr[0])) / U.pixelsize; - len_old += (winrct->xmax - (xy_init[0])) / U.pixelsize; + len_new += (winrct->xmax - (xy_curr[0])) / U.dpi_fac; + len_old += (winrct->xmax - (xy_init[0])) / U.dpi_fac; } else { - len_new += (winrct->ymax - (xy_curr[1])) / U.pixelsize; - len_old += (winrct->ymax - (xy_init[1])) / U.pixelsize; + len_new += (winrct->ymax - (xy_curr[1])) / U.dpi_fac; + len_old += (winrct->ymax - (xy_init[1])) / U.dpi_fac; } if (zoom_invert != zoom_invert_force) { diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index c2ed6c97d3d..136fe3744ef 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -689,16 +689,17 @@ typedef struct UserDef { int audioformat; int audiochannels; - /** Setting for UI scale. */ + /** Setting for UI scale (fractional), before screen DPI has been applied. */ float ui_scale; /** Setting for UI line width. */ int ui_line_width; /** Runtime, full DPI divided by `pixelsize`. */ int dpi; - /** Runtime, multiplier to scale UI elements based on DPI. */ + /** Runtime, multiplier to scale UI elements based on DPI (fractional). */ float dpi_fac; + /** Runtime, `1.0 / dpi_fac` */ float inv_dpi_fac; - /** Runtime, line width and point size based on DPI. */ + /** Runtime, calculated from line-width and point-size based on DPI (rounded to int). */ float pixelsize; /** Deprecated, for forward compatibility. */ int virtual_pixel; |