[Bf-blender-cvs] [b19751bee21] master: Fix mouse coords for sculpt ignore background click, sample voxel detail

Campbell Barton noreply at git.blender.org
Thu Jun 16 07:57:55 CEST 2022


Commit: b19751bee21c6ba46b46e1286bfed56e52bfc1d2
Author: Campbell Barton
Date:   Thu Jun 16 15:54:42 2022 +1000
Branches: master
https://developer.blender.org/rBb19751bee21c6ba46b46e1286bfed56e52bfc1d2

Fix mouse coords for sculpt ignore background click, sample voxel detail

Both operations used screen-relative coordinates when region-relative
coordinates were expected.

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

M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_detail.c

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index c57813cd1e5..a5cba0cc77a 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5525,7 +5525,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, const wmEvent
   /* For tablet rotation. */
   ignore_background_click = RNA_boolean_get(op->ptr, "ignore_background_click");
 
-  if (ignore_background_click && !over_mesh(C, op, event->xy[0], event->xy[1])) {
+  if (ignore_background_click && !over_mesh(C, op, event->mval[0], event->mval[1])) {
     paint_stroke_free(C, op, op->customdata);
     return OPERATOR_PASS_THROUGH;
   }
diff --git a/source/blender/editors/sculpt_paint/sculpt_detail.c b/source/blender/editors/sculpt_paint/sculpt_detail.c
index 5275c6aac8a..0f4ef41f80e 100644
--- a/source/blender/editors/sculpt_paint/sculpt_detail.c
+++ b/source/blender/editors/sculpt_paint/sculpt_detail.c
@@ -169,7 +169,7 @@ static void sample_detail_voxel(bContext *C, ViewContext *vc, int mx, int my)
   SCULPT_vertex_random_access_ensure(ss);
 
   /* Update the active vertex. */
-  const float mouse[2] = {mx, my};
+  const float mouse[2] = {mx - vc->region->winrct.xmin, my - vc->region->winrct.ymin};
   SCULPT_cursor_geometry_info_update(C, &sgi, mouse, false);
   BKE_sculpt_update_object_for_edit(depsgraph, ob, true, false, false);



More information about the Bf-blender-cvs mailing list