[Bf-blender-cvs] [07a4338b3a3] blender-v3.0-release: View3D Snap Cursor: make the pool a little more restrictive

Germano Cavalcante noreply at git.blender.org
Tue Nov 9 15:27:16 CET 2021


Commit: 07a4338b3a3d05cc5202f0d550886a6a8f299429
Author: Germano Cavalcante
Date:   Tue Nov 9 10:54:50 2021 -0300
Branches: blender-v3.0-release
https://developer.blender.org/rB07a4338b3a3d05cc5202f0d550886a6a8f299429

View3D Snap Cursor: make the pool a little more restrictive

The snap cursor tagged overlapping regions to redrawn even though the
cursor itself is not drawn.

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

M	source/blender/editors/space_view3d/view3d_cursor_snap.c

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

diff --git a/source/blender/editors/space_view3d/view3d_cursor_snap.c b/source/blender/editors/space_view3d/view3d_cursor_snap.c
index fbdab71ec1d..a4d7c60d906 100644
--- a/source/blender/editors/space_view3d/view3d_cursor_snap.c
+++ b/source/blender/editors/space_view3d/view3d_cursor_snap.c
@@ -770,7 +770,22 @@ static bool v3d_cursor_snap_pool_fn(bContext *C)
     return false;
   }
 
-  ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
+  ARegion *region = CTX_wm_region(C);
+  if (region->regiontype != RGN_TYPE_WINDOW) {
+    if (!region->overlap) {
+      return false;
+    }
+    /* Sometimes the cursor may be on an invisible part of an overlapping region. */
+    const wmWindowManager *wm = CTX_wm_manager(C);
+    const wmEvent *event = wm->winactive->eventstate;
+    if (ED_region_overlap_isect_xy(region, event->xy)) {
+      return false;
+    }
+    /* Find the visible region under the cursor.
+     * TODO(Germano): Shouldn't this be the region in context? */
+    region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
+  }
+
   RegionView3D *rv3d = region->regiondata;
   if (rv3d->rflag & RV3D_NAVIGATING) {
     /* Don't draw the cursor while navigating. It can be distracting. */



More information about the Bf-blender-cvs mailing list