[Bf-blender-cvs] [c4bf936d534] blender2.8: Fix sculpt grab cursor

Dalai Felinto noreply at git.blender.org
Thu May 3 11:48:46 CEST 2018


Commit: c4bf936d53427d8e20981f8972cc0ff111f51970
Author: Dalai Felinto
Date:   Thu May 3 11:35:23 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBc4bf936d53427d8e20981f8972cc0ff111f51970

Fix sculpt grab cursor

This was broken since 33bb8b785a9 (triple-buffer changes).
We need to account to the area limits when drawing the cursor.

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

M	source/blender/editors/sculpt_paint/paint_cursor.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 6229b91a518..8d941078c5f 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -630,7 +630,10 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
 			}
 
 			if (ups->draw_anchored) {
-				const float *aim = ups->anchored_initial_mouse;
+				float aim[2] = {
+				    ups->anchored_initial_mouse[0] + vc->ar->winrct.xmin,
+				    ups->anchored_initial_mouse[1] + vc->ar->winrct.ymin,
+				};
 				quad.xmin = aim[0] - ups->anchored_size;
 				quad.ymin = aim[1] - ups->anchored_size;
 				quad.xmax = aim[0] + ups->anchored_size;
@@ -730,7 +733,10 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush,
 		glDepthFunc(GL_ALWAYS);
 
 		if (ups->draw_anchored) {
-			const float *aim = ups->anchored_initial_mouse;
+			float aim[2] = {
+			    ups->anchored_initial_mouse[0] + vc->ar->winrct.xmin,
+			    ups->anchored_initial_mouse[1] + vc->ar->winrct.ymin,
+			};
 			copy_v2_v2(center, aim);
 			quad.xmin = aim[0] - ups->anchored_size;
 			quad.ymin = aim[1] - ups->anchored_size;
@@ -1023,6 +1029,7 @@ static bool ommit_cursor_drawing(Paint *paint, ePaintMode mode, Brush *brush)
 static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
 {
 	Scene *scene = CTX_data_scene(C);
+	ARegion *ar = CTX_wm_region(C);
 	UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
 	Paint *paint = BKE_paint_get_active_from_context(C);
 	Brush *brush = BKE_paint_brush(paint);
@@ -1094,8 +1101,9 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
 
 	if (ups->draw_anchored) {
 		final_radius = ups->anchored_size;
-		translation[0] = ups->anchored_initial_mouse[0];
-		translation[1] = ups->anchored_initial_mouse[1];
+		copy_v2_fl2(translation,
+		            ups->anchored_initial_mouse[0] + ar->winrct.xmin,
+		            ups->anchored_initial_mouse[1] + ar->winrct.ymin);
 	}
 
 	/* make lines pretty */



More information about the Bf-blender-cvs mailing list