Fix #106849: Sculpt Edit Voxel Size text too big (applies UI scale)

Followup/correction to a0c0eefd5d.

Since the aim ist to have the text displayed in "constant viewport
size", it should actually not increase with Resoltion scale at all.

So as mentioned in a0c0eefd5d, the scale should be accounted for in
`VoxelSizeEditCustomData` > `text_mat`, and to fix the remaining (false)
influence of Resolution Scale on the size of displayed text, use
`ED_view3d_pixel_size_no_ui_scale`
instead of `ED_view3d_pixel_size` when getting the pixel size.

Pull Request: https://projects.blender.org/blender/blender/pulls/131488
This commit is contained in:
Philipp Oeser
2024-12-18 15:41:06 +01:00
committed by Philipp Oeser
parent 6191bc4f22
commit c2909c81c8

View File

@@ -333,7 +333,7 @@ static void voxel_size_edit_draw(const bContext *C, ARegion * /*region*/, void *
GPU_matrix_push();
GPU_matrix_mul(cd->text_mat);
/* Resolution scale is already accounted for in 'text_mat'. */
/* (Constant viewport) scale is already accounted for in 'text_mat'. */
BLF_size(fontid, 10.0f * fstyle_points);
BLF_color3f(fontid, 1.0f, 1.0f, 1.0f);
BLF_width_and_height(fontid, str, strdrawlen, &strwidth, &strheight);
@@ -591,7 +591,7 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
/* Scale the text to constant viewport size. */
float text_pos_word_space[3];
mul_v3_m4v3(text_pos_word_space, active_object->object_to_world().ptr(), text_pos);
const float pixelsize = ED_view3d_pixel_size(rv3d, text_pos_word_space);
const float pixelsize = ED_view3d_pixel_size_no_ui_scale(rv3d, text_pos_word_space);
scale_m4_fl(scale_mat, pixelsize * 0.5f);
mul_m4_m4_post(cd->text_mat, scale_mat);