More fixes for high DPI:
authorAntony Riakiotakis <kalast@gmail.com>
Thu, 5 Feb 2015 18:15:24 +0000 (19:15 +0100)
committerAntony Riakiotakis <kalast@gmail.com>
Thu, 5 Feb 2015 18:15:24 +0000 (19:15 +0100)
* Radial operators were completely wrong
* Dynamic topology detail was also using unscaled number

source/blender/editors/sculpt_paint/sculpt.c
source/blender/windowmanager/intern/wm_operators.c

index dbb2999710297d87b18cae88a9a48df44f7bac0e..122acf3c941c83bd2d32e301368405529aac8252 100644 (file)
@@ -4255,7 +4255,7 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *UNUSED(st
                BKE_pbvh_bmesh_detail_size_set(ss->pbvh,
                                               (ss->cache->radius /
                                                (float)ups->pixel_radius) *
-                                              (float)sd->detail_size / 0.4f);
+                                              (float)(sd->detail_size * U.pixelsize)/ 0.4f);
        }
 
        if (sculpt_stroke_dynamic_topology(ss, brush)) {
index aa3788bbc9014e597493cdc594452f7c45e18cac..69c70a7492d238eb28dbf9d69e1b064c364236bd 100644 (file)
@@ -3816,8 +3816,8 @@ void WM_OT_straightline_gesture(wmOperatorType *ot)
 
 /* *********************** radial control ****************** */
 
-#define WM_RADIAL_CONTROL_DISPLAY_SIZE 200
-#define WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE 35
+#define WM_RADIAL_CONTROL_DISPLAY_SIZE (200 * U.pixelsize)
+#define WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE (35 * U.pixelsize)
 #define WM_RADIAL_CONTROL_DISPLAY_WIDTH (WM_RADIAL_CONTROL_DISPLAY_SIZE - WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE)
 #define WM_RADIAL_CONTROL_HEADER_LENGTH 180
 #define WM_RADIAL_MAX_STR 6
@@ -3868,7 +3868,7 @@ static void radial_control_set_initial_mouse(RadialControl *rc, const wmEvent *e
                case PROP_DISTANCE:
                case PROP_PERCENTAGE:
                case PROP_PIXEL:
-                       d[0] = rc->initial_value;
+                       d[0] = rc->initial_value * U.pixelsize;
                        break;
                case PROP_FACTOR:
                        d[0] = (1 - rc->initial_value) * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
@@ -3977,8 +3977,8 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
                case PROP_DISTANCE:
                case PROP_PERCENTAGE:
                case PROP_PIXEL:
-                       r1 = rc->current_value;
-                       r2 = rc->initial_value;
+                       r1 = rc->current_value * U.pixelsize;
+                       r2 = rc->initial_value * U.pixelsize;
                        tex_radius = r1;
                        alpha = 0.75;
                        break;
@@ -4003,11 +4003,6 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
                        break;
        }
 
-       /* adjust for DPI, like BKE_brush_size_get */
-       r1 *= U.pixelsize;
-       r2 *= U.pixelsize;
-       tex_radius *= U.pixelsize;
-
        /* Keep cursor in the original place */
        x = rc->initial_mouse[0] - ar->winrct.xmin;
        y = rc->initial_mouse[1] - ar->winrct.ymin;
@@ -4425,6 +4420,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
                                                case PROP_PIXEL:
                                                        new_value = dist;
                                                        if (snap) new_value = ((int)new_value + 5) / 10 * 10;
+                                                       new_value /= U.pixelsize;
                                                        break;
                                                case PROP_FACTOR:
                                                        new_value = (WM_RADIAL_CONTROL_DISPLAY_SIZE - dist) / WM_RADIAL_CONTROL_DISPLAY_WIDTH;