[Bf-blender-cvs] [d5b1dfa] master: More fixes for high DPI:

Antony Riakiotakis noreply at git.blender.org
Thu Feb 5 19:15:43 CET 2015


Commit: d5b1dfa9c6eef4365db1bc51496c71131a8ffa51
Author: Antony Riakiotakis
Date:   Thu Feb 5 19:15:24 2015 +0100
Branches: master
https://developer.blender.org/rBd5b1dfa9c6eef4365db1bc51496c71131a8ffa51

More fixes for high DPI:

* Radial operators were completely wrong
* Dynamic topology detail was also using unscaled number

===================================================================

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

===================================================================

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index dbb2999..122acf3 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -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)) {
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index aa3788b..69c70a7 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -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;




More information about the Bf-blender-cvs mailing list